From e63079caff7fa3876445f49c4f88e9c2079b1c66 Mon Sep 17 00:00:00 2001 From: aB0t Date: Sat, 10 Feb 2024 11:13:31 +0200 Subject: [PATCH 1/3] Stable release of v3.0.0 Moved all classes to 'use' classes away from JText format. Build with new JCB 3.1.31 beta. --- CHANGELOG.md | 5 + README.md | 28 +- admin/README.txt | 28 +- admin/assets/css/admin.css | 2 +- admin/assets/css/dashboard.css | 204 +- admin/assets/css/external_source.css | 2 +- admin/assets/css/external_sources.css | 2 +- admin/assets/css/help_document.css | 2 +- admin/assets/css/help_documents.css | 2 +- admin/assets/css/local_listing.css | 2 +- admin/assets/css/local_listings.css | 2 +- admin/assets/css/manual_updater.css | 2 +- admin/assets/css/preacher.css | 2 +- admin/assets/css/preachers.css | 2 +- admin/assets/css/series.css | 2 +- admin/assets/css/series_list.css | 2 +- admin/assets/css/sermon.css | 2 +- admin/assets/css/sermons.css | 2 +- admin/assets/css/statistic.css | 2 +- admin/assets/css/statistics.css | 2 +- admin/assets/images/import.gif | Bin 65516 -> 66680 bytes admin/assets/js/admin.js | 2 +- admin/config.xml | 12 + admin/controller.php | 36 +- admin/controllers/ajax.json.php | 92 +- admin/controllers/external_source.php | 109 +- admin/controllers/external_sources.php | 40 +- admin/controllers/help.php | 35 +- admin/controllers/help_document.php | 63 +- admin/controllers/help_documents.php | 40 +- admin/controllers/import.php | 14 +- admin/controllers/local_listing.php | 63 +- admin/controllers/local_listings.php | 40 +- admin/controllers/manual_updater.php | 18 +- admin/controllers/preacher.php | 63 +- admin/controllers/preachers.php | 40 +- admin/controllers/series.php | 63 +- admin/controllers/series_list.php | 40 +- admin/controllers/sermon.php | 61 +- admin/controllers/sermondistributor.php | 6 +- admin/controllers/sermons.php | 40 +- admin/controllers/statistic.php | 63 +- admin/controllers/statistics.php | 40 +- admin/helpers/headercheck.php | 50 +- admin/helpers/html/batch_.php | 4 +- admin/helpers/sermondistributor.php | 2467 ++++------------- .../en-GB/en-GB.com_sermondistributor.ini | 44 +- .../en-GB/en-GB.com_sermondistributor.sys.ini | 28 +- admin/layouts/batchselection.php | 21 +- .../build_option_fullwidth.php | 4 +- .../layouts/external_source/details_above.php | 4 +- .../external_source/details_fullwidth.php | 4 +- .../layouts/external_source/details_left.php | 4 +- .../layouts/external_source/details_right.php | 4 +- .../layouts/external_source/details_under.php | 4 +- admin/layouts/external_source/publishing.php | 4 +- admin/layouts/external_source/publlshing.php | 4 +- admin/layouts/help_document/details_above.php | 4 +- .../help_document/details_fullwidth.php | 4 +- admin/layouts/help_document/details_left.php | 4 +- admin/layouts/help_document/details_right.php | 4 +- admin/layouts/help_document/details_under.php | 4 +- admin/layouts/help_document/metadata.php | 6 +- admin/layouts/help_document/publishing.php | 4 +- admin/layouts/local_listing/details_above.php | 4 +- .../local_listing/details_fullwidth.php | 4 +- admin/layouts/local_listing/details_left.php | 4 +- admin/layouts/local_listing/details_right.php | 4 +- admin/layouts/local_listing/publishing.php | 4 +- admin/layouts/local_listing/publlshing.php | 4 +- admin/layouts/preacher/details_above.php | 4 +- admin/layouts/preacher/details_fullwidth.php | 4 +- admin/layouts/preacher/details_left.php | 4 +- admin/layouts/preacher/details_right.php | 4 +- admin/layouts/preacher/metadata.php | 6 +- admin/layouts/preacher/publishing.php | 4 +- admin/layouts/preacher/sermons_fullwidth.php | 64 +- admin/layouts/series/details_above.php | 4 +- admin/layouts/series/details_fullwidth.php | 4 +- admin/layouts/series/details_left.php | 4 +- admin/layouts/series/details_right.php | 4 +- admin/layouts/series/metadata.php | 6 +- admin/layouts/series/publishing.php | 4 +- admin/layouts/series/sermons_fullwidth.php | 62 +- admin/layouts/sermon/details_above.php | 4 +- admin/layouts/sermon/details_fullwidth.php | 4 +- admin/layouts/sermon/details_left.php | 4 +- admin/layouts/sermon/details_right.php | 4 +- admin/layouts/sermon/details_under.php | 4 +- admin/layouts/sermon/files_fullwidth.php | 4 +- admin/layouts/sermon/metadata.php | 6 +- admin/layouts/sermon/publishing.php | 4 +- admin/layouts/sermon/stastics_fullwidth.php | 52 +- admin/layouts/statistic/details_above.php | 4 +- admin/layouts/statistic/details_left.php | 4 +- admin/layouts/statistic/details_right.php | 4 +- admin/layouts/statistic/metadata.php | 6 +- admin/layouts/statistic/publishing.php | 4 +- admin/layouts/trashhelper.php | 23 +- admin/models/ajax.php | 135 +- admin/models/external_source.php | 184 +- admin/models/external_sources.php | 102 +- admin/models/fields/adminviewfolderlist.php | 36 +- admin/models/fields/articles.php | 10 +- admin/models/fields/externalsource.php | 26 +- admin/models/fields/externalsourcefiles.php | 14 +- .../fields/externalsourcesfilterbuild.php | 30 +- .../externalsourcesfilterexternalsources.php | 30 +- .../externalsourcesfilterupdatemethod.php | 30 +- .../fields/helpdocumentsfilterlocation.php | 30 +- .../models/fields/helpdocumentsfiltertype.php | 30 +- admin/models/fields/localfiles.php | 25 +- .../fields/locallistingsfilterbuild.php | 30 +- admin/models/fields/preachers.php | 26 +- admin/models/fields/series.php | 26 +- admin/models/fields/sermon.php | 26 +- admin/models/fields/sermonsfilterlinktype.php | 30 +- admin/models/fields/sermonsfiltersource.php | 30 +- admin/models/fields/siteviewfolderlist.php | 36 +- admin/models/forms/external_source.xml | 3 +- admin/models/forms/filter_help_documents.xml | 8 +- admin/models/forms/help_document.xml | 8 +- admin/models/forms/local_listing.xml | 3 +- admin/models/forms/preacher.xml | 3 +- admin/models/forms/series.xml | 3 +- admin/models/forms/sermon.xml | 4 +- admin/models/forms/statistic.xml | 3 +- admin/models/help_document.php | 176 +- admin/models/help_documents.php | 113 +- admin/models/import.php | 152 +- admin/models/local_listing.php | 165 +- admin/models/local_listings.php | 88 +- admin/models/manual_updater.php | 37 +- admin/models/preacher.php | 195 +- admin/models/preachers.php | 81 +- admin/models/series.php | 195 +- admin/models/series_list.php | 81 +- admin/models/sermon.php | 193 +- admin/models/sermondistributor.php | 349 ++- admin/models/sermons.php | 131 +- admin/models/statistic.php | 158 +- admin/models/statistics.php | 87 +- admin/sermondistributor.php | 65 +- admin/sql/install.mysql.utf8.sql | 2 +- admin/sql/updates/mysql/2.1.1.sql | 1 + admin/tables/external_source.php | 112 +- admin/tables/help_document.php | 116 +- admin/tables/local_listing.php | 112 +- admin/tables/preacher.php | 116 +- admin/tables/series.php | 116 +- admin/tables/sermon.php | 118 +- admin/tables/statistic.php | 112 +- admin/views/external_source/submitbutton.js | 4 +- admin/views/external_source/tmpl/edit.php | 85 +- admin/views/external_source/view.html.php | 98 +- admin/views/external_sources/tmpl/default.php | 31 +- .../tmpl/default_batch_body.php | 7 +- .../tmpl/default_batch_footer.php | 8 +- .../external_sources/tmpl/default_body.php | 32 +- .../external_sources/tmpl/default_foot.php | 2 +- .../external_sources/tmpl/default_head.php | 25 +- .../external_sources/tmpl/default_toolbar.php | 61 +- admin/views/external_sources/view.html.php | 131 +- admin/views/help_document/submitbutton.js | 4 +- admin/views/help_document/tmpl/edit.php | 75 +- admin/views/help_document/view.html.php | 92 +- admin/views/help_documents/tmpl/default.php | 33 +- .../tmpl/default_batch_body.php | 7 +- .../tmpl/default_batch_footer.php | 8 +- .../help_documents/tmpl/default_body.php | 28 +- .../help_documents/tmpl/default_foot.php | 2 +- .../help_documents/tmpl/default_head.php | 27 +- .../help_documents/tmpl/default_toolbar.php | 61 +- admin/views/help_documents/view.html.php | 147 +- admin/views/import/tmpl/default.php | 84 +- admin/views/import/view.html.php | 30 +- admin/views/local_listing/submitbutton.js | 4 +- admin/views/local_listing/tmpl/edit.php | 77 +- admin/views/local_listing/view.html.php | 98 +- admin/views/local_listings/tmpl/default.php | 31 +- .../tmpl/default_batch_body.php | 7 +- .../tmpl/default_batch_footer.php | 8 +- .../local_listings/tmpl/default_body.php | 26 +- .../local_listings/tmpl/default_foot.php | 2 +- .../local_listings/tmpl/default_head.php | 25 +- .../local_listings/tmpl/default_toolbar.php | 61 +- admin/views/local_listings/view.html.php | 123 +- admin/views/manual_updater/tmpl/default.php | 61 +- admin/views/manual_updater/view.html.php | 74 +- admin/views/preacher/submitbutton.js | 4 +- admin/views/preacher/tmpl/edit.php | 83 +- admin/views/preacher/view.html.php | 106 +- admin/views/preachers/tmpl/default.php | 33 +- .../preachers/tmpl/default_batch_body.php | 7 +- .../preachers/tmpl/default_batch_footer.php | 8 +- admin/views/preachers/tmpl/default_body.php | 24 +- admin/views/preachers/tmpl/default_foot.php | 2 +- admin/views/preachers/tmpl/default_head.php | 19 +- .../views/preachers/tmpl/default_toolbar.php | 61 +- admin/views/preachers/view.html.php | 101 +- admin/views/series/submitbutton.js | 4 +- admin/views/series/tmpl/edit.php | 83 +- admin/views/series/view.html.php | 106 +- admin/views/series_list/tmpl/default.php | 33 +- .../series_list/tmpl/default_batch_body.php | 7 +- .../series_list/tmpl/default_batch_footer.php | 8 +- admin/views/series_list/tmpl/default_body.php | 24 +- admin/views/series_list/tmpl/default_foot.php | 2 +- admin/views/series_list/tmpl/default_head.php | 19 +- .../series_list/tmpl/default_toolbar.php | 61 +- admin/views/series_list/view.html.php | 99 +- admin/views/sermon/submitbutton.js | 4 +- admin/views/sermon/tmpl/edit.php | 91 +- admin/views/sermon/view.html.php | 108 +- .../views/sermondistributor/tmpl/default.php | 90 +- ...sed_issues_the_closed_issues_on_github.php | 6 +- .../sermondistributor/tmpl/default_main.php | 10 +- ..._open_issues_the_open_issues_on_github.php | 6 +- .../tmpl/default_readme_information.php | 6 +- .../tmpl/default_releases_information.php | 6 +- ...t_vast_development_method_notice_board.php | 6 +- .../sermondistributor/tmpl/default_vdm.php | 23 +- admin/views/sermondistributor/view.html.php | 47 +- admin/views/sermons/tmpl/default.php | 39 +- .../views/sermons/tmpl/default_batch_body.php | 7 +- .../sermons/tmpl/default_batch_footer.php | 8 +- admin/views/sermons/tmpl/default_body.php | 28 +- admin/views/sermons/tmpl/default_foot.php | 2 +- admin/views/sermons/tmpl/default_head.php | 29 +- admin/views/sermons/tmpl/default_toolbar.php | 61 +- admin/views/sermons/view.html.php | 155 +- admin/views/statistic/submitbutton.js | 4 +- admin/views/statistic/tmpl/edit.php | 48 +- admin/views/statistic/view.html.php | 92 +- admin/views/statistics/tmpl/default.php | 33 +- .../statistics/tmpl/default_batch_body.php | 7 +- .../statistics/tmpl/default_batch_footer.php | 8 +- admin/views/statistics/tmpl/default_body.php | 24 +- admin/views/statistics/tmpl/default_foot.php | 2 +- admin/views/statistics/tmpl/default_head.php | 25 +- .../views/statistics/tmpl/default_toolbar.php | 61 +- admin/views/statistics/view.html.php | 137 +- libraries/jcb_powers/.htaccess | 9 + .../jcb_powers/VDM.Joomla.FOF/index.html | 0 .../VDM.Joomla.FOF/src/Encrypt/AES.php | 300 ++ .../src/Encrypt/AES/Abstraction.php | 100 + .../src/Encrypt/AES/AesInterface.php | 98 + .../VDM.Joomla.FOF/src/Encrypt/AES/Mcrypt.php | 178 ++ .../src/Encrypt/AES/Openssl.php | 193 ++ .../VDM.Joomla.FOF/src/Encrypt/AES/index.html | 1 + .../VDM.Joomla.FOF/src/Encrypt/Randval.php | 69 + .../src/Encrypt/Randvalinterface.php | 37 + .../VDM.Joomla.FOF/src/Encrypt/index.html | 1 + .../VDM.Joomla.FOF/src/Utils/Phpfunc.php | 44 + .../VDM.Joomla.FOF/src/Utils/index.html | 1 + libraries/jcb_powers/VDM.Joomla/index.html | 1 + .../VDM.Joomla/src/Utilities/ArrayHelper.php | 107 + .../src/Utilities/Component/Helper.php | 296 ++ .../src/Utilities/Component/index.html | 1 + .../VDM.Joomla/src/Utilities/FileHelper.php | 363 +++ .../VDM.Joomla/src/Utilities/FormHelper.php | 187 ++ .../VDM.Joomla/src/Utilities/GetHelper.php | 253 ++ .../VDM.Joomla/src/Utilities/JsonHelper.php | 101 + .../VDM.Joomla/src/Utilities/MimeHelper.php | 1113 ++++++++ .../VDM.Joomla/src/Utilities/ObjectHelper.php | 78 + .../src/Utilities/String/NamespaceHelper.php | 78 + .../src/Utilities/String/index.html | 1 + .../VDM.Joomla/src/Utilities/StringHelper.php | 416 +++ .../VDM.Joomla/src/Utilities/index.html | 1 + libraries/jcb_powers/htaccess.txt | 9 + libraries/jcb_powers/index.html | 1 + libraries/jcb_powers/web.config | 7 + media/js/external_source.js | 8 +- media/js/help_document.js | 8 +- media/js/local_listing.js | 4 +- media/js/preacher.js | 4 +- media/js/series.js | 4 +- media/js/sermon.js | 8 +- media/js/statistic.js | 4 +- script.php | 319 +-- sermondistributor.xml | 10 +- sermondistributor_update_server.xml | 18 + site/assets/css/api.css | 2 +- site/assets/css/categories.css | 2 +- site/assets/css/category.css | 2 +- site/assets/css/preacher.css | 2 +- site/assets/css/preachers.css | 2 +- site/assets/css/series.css | 2 +- site/assets/css/serieslist.css | 2 +- site/assets/css/sermon.css | 2 +- site/assets/css/site.css | 2 +- site/assets/js/site.js | 2 +- site/controller.php | 47 +- site/controllers/ajax.json.php | 46 +- site/controllers/api.php | 35 +- site/controllers/download.php | 2 +- site/controllers/help.php | 33 +- site/helpers/category.php | 2 +- site/helpers/categorysermon.php | 4 +- site/helpers/dropboxupdater.php | 2 +- site/helpers/headercheck.php | 48 +- site/helpers/route.php | 70 +- site/helpers/sermondistributor.php | 2440 ++++------------ site/layouts/addtodropboxbutton.php | 13 +- site/layouts/addtodropboxicon.php | 13 +- site/layouts/categorieslistitem.php | 11 +- site/layouts/categoriespanel.php | 15 +- site/layouts/categoriesrow.php | 7 +- site/layouts/downloadsermonbutton.php | 15 +- site/layouts/htmlfive.php | 7 +- site/layouts/isnew.php | 9 +- site/layouts/jplayerbluemonday.php | 29 +- site/layouts/jplayerbluemondaylist.php | 35 +- site/layouts/mediaplayer.php | 37 +- site/layouts/opensermonbutton.php | 27 +- site/layouts/preacherslistitem.php | 15 +- site/layouts/preacherspanel.php | 21 +- site/layouts/preachersrow.php | 7 +- site/layouts/serieslistitem.php | 11 +- site/layouts/seriespanel.php | 15 +- site/layouts/seriesrow.php | 7 +- site/layouts/sermonslistitem.php | 11 +- site/layouts/sermonspanel.php | 33 +- site/layouts/sermonsrow.php | 15 +- site/layouts/soundmanagerthreesixty.php | 7 +- site/models/ajax.php | 52 +- site/models/api.php | 68 +- site/models/categories.php | 42 +- site/models/category.php | 68 +- site/models/preacher.php | 94 +- site/models/preachers.php | 45 +- site/models/series.php | 90 +- site/models/serieslist.php | 45 +- site/models/sermon.php | 60 +- site/router.php | 37 +- site/sermondistributor.php | 58 +- site/views/api/submitbutton.js | 4 +- site/views/api/tmpl/default.php | 10 +- site/views/api/view.html.php | 62 +- site/views/categories/tmpl/default.php | 12 +- .../tmpl/default_categories-grid.php | 20 +- .../tmpl/default_categories-list.php | 8 +- .../tmpl/default_categories-table.php | 16 +- site/views/categories/view.html.php | 87 +- site/views/category/tmpl/default.php | 14 +- .../category/tmpl/default_categorybox.php | 12 +- .../category/tmpl/default_categorypanel.php | 12 +- .../category/tmpl/default_categorysmall.php | 12 +- .../category/tmpl/default_sermons-grid.php | 32 +- .../category/tmpl/default_sermons-list.php | 8 +- .../category/tmpl/default_sermons-table.php | 24 +- site/views/category/view.html.php | 95 +- site/views/preacher/tmpl/default.php | 14 +- .../preacher/tmpl/default_preacherbox.php | 16 +- .../preacher/tmpl/default_preacherpanel.php | 16 +- .../preacher/tmpl/default_preachersmall.php | 16 +- .../preacher/tmpl/default_sermons-grid.php | 32 +- .../preacher/tmpl/default_sermons-list.php | 8 +- .../preacher/tmpl/default_sermons-table.php | 24 +- site/views/preacher/view.html.php | 95 +- site/views/preachers/tmpl/default.php | 12 +- .../preachers/tmpl/default_preachers-grid.php | 20 +- .../preachers/tmpl/default_preachers-list.php | 8 +- .../tmpl/default_preachers-table.php | 20 +- site/views/preachers/view.html.php | 91 +- site/views/series/tmpl/default.php | 14 +- site/views/series/tmpl/default_seriesbox.php | 12 +- .../views/series/tmpl/default_seriespanel.php | 12 +- .../views/series/tmpl/default_seriessmall.php | 12 +- .../series/tmpl/default_sermons-grid.php | 32 +- .../series/tmpl/default_sermons-list.php | 8 +- .../series/tmpl/default_sermons-table.php | 24 +- site/views/series/view.html.php | 95 +- site/views/serieslist/tmpl/default.php | 12 +- .../serieslist/tmpl/default_series-grid.php | 20 +- .../serieslist/tmpl/default_series-list.php | 8 +- .../serieslist/tmpl/default_series-table.php | 16 +- site/views/serieslist/view.html.php | 91 +- site/views/sermon/tmpl/default.php | 11 +- site/views/sermon/tmpl/default_sermonbig.php | 24 +- site/views/sermon/tmpl/default_sermonbox.php | 24 +- .../views/sermon/tmpl/default_sermonpanel.php | 24 +- site/views/sermon/view.html.php | 97 +- 383 files changed, 12182 insertions(+), 9377 deletions(-) create mode 100644 admin/sql/updates/mysql/2.1.1.sql create mode 100644 libraries/jcb_powers/.htaccess rename index.html => libraries/jcb_powers/VDM.Joomla.FOF/index.html (100%) create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Abstraction.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/AesInterface.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Mcrypt.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Openssl.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randval.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randvalinterface.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Utils/Phpfunc.php create mode 100644 libraries/jcb_powers/VDM.Joomla.FOF/src/Utils/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/MimeHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html create mode 100644 libraries/jcb_powers/htaccess.txt create mode 100644 libraries/jcb_powers/index.html create mode 100644 libraries/jcb_powers/web.config diff --git a/CHANGELOG.md b/CHANGELOG.md index 93439eb3..c6894454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v3.0.0 + +- Moved all classes to 'use' classes away from JText format. +- Build with new JCB 3.1.31 beta + # v2.1.1 - Moved over to a Joomla Package \ No newline at end of file diff --git a/README.md b/README.md index d5b2c31e..661980e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sermon Distributor (2.1.x) +# Sermon Distributor (3.0.x) ![Sermon Distributor image](https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor") @@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 29th May, 2023 -+ *Version*: 2.1.x ++ *Last Build*: 10th February, 2024 ++ *Version*: 3.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time :hourglass: -**210 Hours** or **26 Eight Hour Days** (actual time the author saved - +**242 Hours** or **30 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **75271** -+ *File count*: **486** -+ *Folder count*: **105** ++ *Line count*: **86920** ++ *File count*: **592** ++ *Folder count*: **113** -**138 Hours** or **18 Eight Hour Days** (the actual time the author spent) +**160 Hours** or **20 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @52hours** = codingtime / 4; -> **planning @30hours** = codingtime / 7; -> **mapping @21hours** = codingtime / 10; -> **office @35hours** = codingtime / 6;) +> **debugging @61hours** = codingtime / 4; +> **planning @35hours** = codingtime / 7; +> **mapping @24hours** = codingtime / 10; +> **office @40hours** = codingtime / 6;) -**348 Hours** or **44 Eight Hour Days** +**402 Hours** or **50 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **8.8 weeks** or **1.8 months** +Project duration: **10 weeks** or **2.1 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) \ No newline at end of file diff --git a/admin/README.txt b/admin/README.txt index d5b2c31e..661980e7 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Sermon Distributor (2.1.x) +# Sermon Distributor (3.0.x) ![Sermon Distributor image](https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor") @@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Sermon Distributor](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 29th May, 2023 -+ *Version*: 2.1.x ++ *Last Build*: 10th February, 2024 ++ *Version*: 3.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time :hourglass: -**210 Hours** or **26 Eight Hour Days** (actual time the author saved - +**242 Hours** or **30 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **75271** -+ *File count*: **486** -+ *Folder count*: **105** ++ *Line count*: **86920** ++ *File count*: **592** ++ *Folder count*: **113** -**138 Hours** or **18 Eight Hour Days** (the actual time the author spent) +**160 Hours** or **20 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @52hours** = codingtime / 4; -> **planning @30hours** = codingtime / 7; -> **mapping @21hours** = codingtime / 10; -> **office @35hours** = codingtime / 6;) +> **debugging @61hours** = codingtime / 4; +> **planning @35hours** = codingtime / 7; +> **mapping @24hours** = codingtime / 10; +> **office @40hours** = codingtime / 6;) -**348 Hours** or **44 Eight Hour Days** +**402 Hours** or **50 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **8.8 weeks** or **1.8 months** +Project duration: **10 weeks** or **2.1 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) \ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index b5842c4c..a9acb33a 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage admin.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 407f3138..b1a2a221 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage dashboard.css @@ -24,153 +24,153 @@ /* CSS Document */ .dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; + margin-left: 10px; + margin-top: 10px; + width: 100%; } .dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; + display: block; + float: none; + margin-left: 0; + width: auto; } .dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; + content: ""; + display: table; } .dashboard-container:after { - clear: both; + clear: both; } .dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; } .dashboard-container [class*="span"]:first-child { - margin-left: 0; + margin-left: 0; } .dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; } .dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; } .dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; } .dashboard-title { - display: block; - padding-top: 5px; + display: block; + padding-top: 5px; } .dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; } .dashboard-info span { - display: block; - text-align: center; + display: block; + text-align: center; } .dashboard-info img { - margin: 0 auto; + margin: 0 auto; } .dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; } .dashboard-info h5 { - font-size: 11px; - font-weight: bold; + font-size: 11px; + font-weight: bold; } .dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; } .dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; } .dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; } .dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; } .dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; } .dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; + margin-top: 0 !important; } .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; } .dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; } .dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/assets/css/external_source.css b/admin/assets/css/external_source.css index d5dcd5d6..56be6927 100644 --- a/admin/assets/css/external_source.css +++ b/admin/assets/css/external_source.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_source.css diff --git a/admin/assets/css/external_sources.css b/admin/assets/css/external_sources.css index b0ebcb10..d042e928 100644 --- a/admin/assets/css/external_sources.css +++ b/admin/assets/css/external_sources.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_sources.css diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index d466832c..5cd4b970 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.css diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index 8f301dc7..b032496b 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.css diff --git a/admin/assets/css/local_listing.css b/admin/assets/css/local_listing.css index 668726f4..3105af1c 100644 --- a/admin/assets/css/local_listing.css +++ b/admin/assets/css/local_listing.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listing.css diff --git a/admin/assets/css/local_listings.css b/admin/assets/css/local_listings.css index 34354d3d..47113d5b 100644 --- a/admin/assets/css/local_listings.css +++ b/admin/assets/css/local_listings.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listings.css diff --git a/admin/assets/css/manual_updater.css b/admin/assets/css/manual_updater.css index eea232d1..fed66dad 100644 --- a/admin/assets/css/manual_updater.css +++ b/admin/assets/css/manual_updater.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage manual_updater.css diff --git a/admin/assets/css/preacher.css b/admin/assets/css/preacher.css index 99d15e58..b13eddb3 100644 --- a/admin/assets/css/preacher.css +++ b/admin/assets/css/preacher.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.css diff --git a/admin/assets/css/preachers.css b/admin/assets/css/preachers.css index 5f209cd8..82117a22 100644 --- a/admin/assets/css/preachers.css +++ b/admin/assets/css/preachers.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.css diff --git a/admin/assets/css/series.css b/admin/assets/css/series.css index 7bcfec11..0d4455cc 100644 --- a/admin/assets/css/series.css +++ b/admin/assets/css/series.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.css diff --git a/admin/assets/css/series_list.css b/admin/assets/css/series_list.css index 52c14012..f3ed2c4b 100644 --- a/admin/assets/css/series_list.css +++ b/admin/assets/css/series_list.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.css diff --git a/admin/assets/css/sermon.css b/admin/assets/css/sermon.css index f4192d9c..befe041d 100644 --- a/admin/assets/css/sermon.css +++ b/admin/assets/css/sermon.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.css diff --git a/admin/assets/css/sermons.css b/admin/assets/css/sermons.css index b16e2bea..57731d3a 100644 --- a/admin/assets/css/sermons.css +++ b/admin/assets/css/sermons.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.css diff --git a/admin/assets/css/statistic.css b/admin/assets/css/statistic.css index 93f896fa..3f8b6765 100644 --- a/admin/assets/css/statistic.css +++ b/admin/assets/css/statistic.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.css diff --git a/admin/assets/css/statistics.css b/admin/assets/css/statistics.css index 637e843b..ded275c5 100644 --- a/admin/assets/css/statistics.css +++ b/admin/assets/css/statistics.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.css diff --git a/admin/assets/images/import.gif b/admin/assets/images/import.gif index 4371cc618bdc1702aad69fc871a50182a01537ec..10bcb856924dbc48ac739332a40ce1617c88687b 100644 GIT binary patch delta 4162 zcmeHKYgm&<7S5MIE)Xuka1RiIcvnJE7O+;tsI<09tst#biMkbwNRYA?9xV|F0i-rK zRG?77T9sC$DFgJ8b=`u>qQYv?LKbg$tE`I))cRPeXfqf1g8koL=1TA|H z8%G|sPGV#z^1553X>X!OPV(#-Cch~++#&?F1DH`Ma26ngm+B9E#cn_?@F%JCf)ti5 z*v#ey-Gv)zs-2>B1a(_vAt=Z!$OGotSX0z)+XjMCi9cnz{$fUX0;7{H=v~W)BD+%* z{crnHg5K!x^4N3$W95IqM~-t{k;Z^rL!|Yt%*;ZGtmv}{J{kgN9otA0kUV8`1fv|# z=yZ*-Lns&Zfhkik{8MQMiweVfwa(kAf)STXgsaoFlSN^@@T6Nd` zgi#)@G&aF=s~d99GHF``ldTz!?=Xg-F`z7!0j;wL+RNez9433UGi;GXbuv&D>Inu+ zd{|Swo59s`p7JV&XNM1NSm%`M5dHuYE#3PgN$gu<$HqftsRI{}gYeJ(r9jATq18iY z)qeS!)B5=JQh)!o!Z-H67m+hmwiWXX`A4IFxiDV4eupBGFXbpNX)8A@R)i&NpWfe^ zi$U>|;>IMx!SXUHz2NgnwB~R3jj#Y?CyQO8xpYejf%jbzFh+^M{1ab* z?~nA5sPdX38a1<4KQ5|x4!mDGg-7(b)Fry3bbW`8{J*K+#nZ}i4PjAT0%MQdSC6Gh zduovdnfg1F_-;coON{mv-r-Q&_#IuCkYj5|mXc$8$La*^!aIPprW*vY>hDL0@x$UF zY`}-dB^HOmAF74(Pb?-nVD3L@ioNsKe+rV^t$X4M1~B{+T~ zeuDT(?BQ-7^a)nAD+wU4{jBBGy2GT7(M>Bjzkyb@`9kCPsytx$4=U=^b)Ljj@YRco zQT(OtmZYcx5x8(#1PnSc=(r_<6MuB3(6Fwrh>+V|uM%Tc_iMyR?_Nxd@4Ksrp*BTZ z>IiI7!KbD?%B1gkg`iq{s>P_t09jinF7|`V1;q30@)BY!xe~+*B*&!y#9a*{Uc=Qo zVn{aS5Tosy7dGHe*OpuCDzs@`p?6|AkpP=E2T(EhlH?@Pc1!E?nfRbC`8c6V);Q8o zZHlYKst=Z%1S?EcSbbXRWFP;Hn@|ED@CMQsu zzX=3v+eipXwk;>d-EBLF@z)Q(B!*48iWtk&DW)>rg^V<&`w*im-NzSYPVK0PJ*4sT zy{D-@Xn*dIbajbRY;a!Q_Wm5>el(C*x9J1Yy>W|xz z`TQK&9%%lEdRsEXaem0t?in{l-C#>r7LhiT>Rr2_PW)Uf<_yuw$T&T z>Rx9&km{Mg<(DzaD*qJ&S9EI4BApIzAYiXgB>Wlr>BKmspM}q9{=n9>Cxy1mWL)!g z{df4rU~pvIybQfn#bWuzZiYYg?QG>?45-PA#jUquDtI&04fx~>SV^M`)=DyX71Wbb zIt$j)QeG;gr_s7XEjv*~bv}^yv6f(9&Ta`8mlD`pm8Gt?9@k7cB!_o}2wpaXF%d{p z1CJXOBx#(<@7pzJTEqFt?ooDO?uxK>Q%r!t8Uak+L(^lIpQ_exsZ-YQ6)R3G6i8YMe7KfcUNqwu&G2|@ zR=yc{5#iRjFRkGE*-SiJrg*)stgQLArsJ*91;M4rx93sP*wVq|M`>I(n;*{hYmHZA0 Cx!!>Q delta 2752 zcmeHJ`&Z0q81Fl`dYjs2=r+@I9V()tqzh||R_^5zp{20OCY2RS*)Ehzp}eg`+F7hD z9c|u5II%@*J7{wkT1^htC0({XyOhg5&s6Ncu;=*Yb7nrz=lwj-dwbsR%gut8cl?|U zJVMH{EI0un29C5$YsIR$c^pTmJwFpUC2byV&d&4wfZHiNf|R#jc1ak^4Ixd|6B>5K z$T!A$4{1=kHe0I=#cf388aV#sstThi2Ym(OGmRb9?$Om!LSqe8;9F*xfF?d*V#_8P zMPaUTvItOatk38L8Re|TScs82u@*4XwldyB$kl} zTwMu$YhH(DDz$<}xLGiPrM|p4s~a#f$od+@n4?U?8I#SW;pM|8d?_I8s@w{TX|Y); zCGHKW=L}thoPpyjOyUbOQL?>?2oSJ$wwF2dF4Zb%RaQS*(rCsc4%;~?F?h=_eC4fb zU$UrQrkSdf(5~G#VZe4LQ~j=>i=6$e?8G$Pg}(x(Im-dRa}EU@U1SY7wOhp3IFB8tnUHbCA)e5LgAah6^TRnn+e3c6V&+r)nAbP( z^^sOS8BFLgZ$~h;E(twz}@;a>ewmqTE^`5|A3A@-c7uoTv z1z5qpYfG?#s_+v%6)0HKjX-2vZk>m4>n$hzQy-Cxi;FeLSzM$Sa?kJl2)O(1L_p2r zNr0`3#{;gvrvY?q3`N8CsqU<#QG@!B`=0_%jXEqM9*Wv)gmTeaf!Glp1Zc1GLV3?+ z3IHOZ`8c4D6V zDM8`NudMWAb64F1WqjgtKwYAffYc`tX0kdAU82`?{`UZ>X(6?sR@qDGsI^fLE?yf9 z*tK>&VA8sSfXbvmz?dZD&n8&{HYC{tcI(kDSq8rYlI6Y20Qb&?QfkBMlJ&JO|3-;f zX-dk6s*PAzssLGDI&>^HK7D6z)wgNI#&qCEXW)^TpRpQ6H#2el7H^u51}gP9MmA63 z%*oKMEd`vXX5fsr#*E1L&oVMh2#wnk1Je6j+yG6tx{HaZZDr!?Y%%9T=#;G$mLx~Q zS=;95G5=8{dsLr`1(kS-SR(c3{D_v%3-OYk7%F;_ zHDa)~-bEH->MwKhzuYj}BS%OY>^j`Sf@=^KwW*)ij$H4)a4XRq%X zAMWVK9tVf{V~_iv_PA25B^&*)2rpIBqgj9>A9ov*U&PY9E7c}KSDKbIfO*D{nLaJtDRSk*`|(ijE?Di zjU#>EKgBvBVe9_#$4Bkt-|+2147?y_&Q$+=j{5Ikx?2%0@29Ux=sBT6=@;g5L{&SP z2F8vewC&|qsFt3p3->0#R8`(#|sLoAI8_s^c(B5 zo6tqwv6#eL|6Fx;&*kAiC05B|-%f+CE@4fffsoMJcllthjp97PJRjQfY*P~065!;p auROd_WJmG^JT4v-70Em<5+%)iF8^Od#l!;u diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 0ac8b757..c96fcb5d 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage admin.js diff --git a/admin/config.xml b/admin/config.xml index bbd532ef..22a86bb7 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -301,6 +301,18 @@ name="uikit_config" label="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LABEL" description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_DESC"> + + + " + " + input->getCmd('view', 'sermondistributor'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $view = $this->input->getCmd('view', 'sermondistributor'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); // Check for edit form. - if(SermondistributorHelper::checkArray($data)) + if(UtilitiesArrayHelper::check($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_sermondistributor.edit.'.$data['view'], $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && SermondistributorHelper::checkString($ref)) + if ($refid > 0 && StringHelper::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (SermondistributorHelper::checkString($ref)) + elseif (StringHelper::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.$data['views'], false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view='.$data['views'], false)); } return false; @@ -102,7 +106,7 @@ class SermondistributorController extends BaseController protected function getViewRelation($view) { // check the we have a value - if (SermondistributorHelper::checkString($view)) + if (StringHelper::check($view)) { // the view relationships $views = array( diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 4e2ec5a3..354d9c7c 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.json.php @@ -25,7 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -37,9 +39,9 @@ class SermondistributorControllerAjax extends BaseController { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks @@ -54,16 +56,16 @@ class SermondistributorControllerAjax extends BaseController public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task @@ -76,7 +78,15 @@ class SermondistributorControllerAjax extends BaseController $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { - $result = $this->getModel('ajax')->isNew($noticeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->isNew($noticeValue); + } + else + { + $result = false; + } } else { @@ -95,7 +105,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -117,7 +127,15 @@ class SermondistributorControllerAjax extends BaseController $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { - $result = $this->getModel('ajax')->isRead($noticeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->isRead($noticeValue); + } + else + { + $result = false; + } } else { @@ -136,7 +154,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -159,7 +177,15 @@ class SermondistributorControllerAjax extends BaseController $ojectValue = $jinput->get('oject', NULL, 'STRING'); if($idNameValue && $user->id != 0 && $ojectValue) { - $result = $this->getModel('ajax')->getBuildTable($idNameValue, $ojectValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getBuildTable($idNameValue, $ojectValue); + } + else + { + $result = false; + } } else { @@ -178,7 +204,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -200,7 +226,15 @@ class SermondistributorControllerAjax extends BaseController $idValue = $jinput->get('id', NULL, 'INT'); if($idValue && $user->id != 0) { - $result = $this->getModel('ajax')->getSourceStatus($idValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getSourceStatus($idValue); + } + else + { + $result = false; + } } else { @@ -219,7 +253,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -241,7 +275,15 @@ class SermondistributorControllerAjax extends BaseController $getTypeValue = $jinput->get('getType', NULL, 'WORD'); if($getTypeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getCronPath($getTypeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->getCronPath($getTypeValue); + } + else + { + $result = false; + } } else { @@ -260,7 +302,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -285,7 +327,15 @@ class SermondistributorControllerAjax extends BaseController $sleutelValue = $jinput->get('sleutel', NULL, 'CMD'); if($idValue && $user->id != 0 && $targetValue && $typeValue && $sleutelValue) { - $result = $this->getModel('ajax')->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue); + } + else + { + $result = false; + } } else { @@ -304,7 +354,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { diff --git a/admin/controllers/external_source.php b/admin/controllers/external_source.php index f06e4479..c2c1e6c9 100644 --- a/admin/controllers/external_source.php +++ b/admin/controllers/external_source.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_source.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * External_source Form Controller @@ -49,7 +55,7 @@ class SermondistributorControllerExternal_source extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'External_sources'; // safeguard for setting the return view listing to the main view. parent::__construct($config); @@ -58,26 +64,26 @@ class SermondistributorControllerExternal_source extends FormController public function clearLocalListing() { // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // get the data $originalData = $this->input->post->get('jform', array(), 'array'); if (isset($originalData['id']) && $originalData['id'] > 0) { // get the needed - $app = JFactory::getApplication(); - $lang = JFactory::getLanguage(); + $app = Factory::getApplication(); + $lang = Factory::getLanguage(); $model = $this->getModel(); - $user = JFactory::getUser(); + $user = Factory::getUser(); $context = "$this->option.edit.$this->context"; if (!$user->authorise('external_source.clear_local_listing', 'com_sermondistributor')) { // force production is not permitted - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_YOU_DO_NOT_HAVE_PERMISSION_TO_CLEAR_LOCAL_LISTING'), 'error'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_YOU_DO_NOT_HAVE_PERMISSION_TO_CLEAR_LOCAL_LISTING'), 'error'); // Save the data in the session. $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) @@ -89,12 +95,12 @@ class SermondistributorControllerExternal_source extends FormController if (!$cleared) { // force production is not permitted - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_NOT_CLEARED'), 'error'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_NOT_CLEARED'), 'error'); // Save the data in the session. $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) @@ -102,23 +108,23 @@ class SermondistributorControllerExternal_source extends FormController return false; } // force production is not permitted - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_CLEARED_SUCCESSFULLY'), 'success'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_WAS_CLEARED_SUCCESSFULLY'), 'success'); // Save the data in the session. $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) ); return true; } - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_CLEARING_LOCAL_LISTING_CAN_NOT_BE_DONE')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_CLEARING_LOCAL_LISTING_CAN_NOT_BE_DONE')); $this->setMessage($this->getError(), 'error'); // Redirect back to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false ) @@ -129,26 +135,26 @@ class SermondistributorControllerExternal_source extends FormController public function resetUpdateStatus() { // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // get the data $originalData = $this->input->post->get('jform', array(), 'array'); if (isset($originalData['id']) && $originalData['id'] > 0) { // get the needed - $app = JFactory::getApplication(); - $lang = JFactory::getLanguage(); + $app = Factory::getApplication(); + $lang = Factory::getLanguage(); $model = $this->getModel(); - $user = JFactory::getUser(); + $user = Factory::getUser(); $context = "$this->option.edit.$this->context"; if (!$user->authorise('external_source.reset_update_status', 'com_sermondistributor')) { // force production is not permitted - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_UPDATE_STATUS'), 'error'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_UPDATE_STATUS'), 'error'); // Save the data in the session. $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) @@ -165,7 +171,7 @@ class SermondistributorControllerExternal_source extends FormController $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) @@ -173,23 +179,23 @@ class SermondistributorControllerExternal_source extends FormController return false; } // reset update status success - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_RESETTING_THE_UPDATE_STATUS_WAS_SUCCESSFUL'), 'success'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_RESETTING_THE_UPDATE_STATUS_WAS_SUCCESSFUL'), 'success'); // Save the data in the session. $app->setUserState($context . '.data', $originalData); // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($originalData['id'], 'id'), false ) ); return true; } - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS_CAN_NOT_BE_DONE')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS_CAN_NOT_BE_DONE')); $this->setMessage($this->getError(), 'error'); // Redirect back to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false ) @@ -197,7 +203,7 @@ class SermondistributorControllerExternal_source extends FormController return false; } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -206,10 +212,10 @@ class SermondistributorControllerExternal_source extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('external_source.access', 'com_sermondistributor'); if (!$access) @@ -217,7 +223,7 @@ class SermondistributorControllerExternal_source extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('external_source.create', $this->option); } @@ -231,16 +237,16 @@ class SermondistributorControllerExternal_source extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $recordId) && $user->authorise('external_source.access', 'com_sermondistributor')); + $access = ($user->authorise('external_source.access', 'com_sermondistributor.external_source.' . (int) $recordId) && $user->authorise('external_source.access', 'com_sermondistributor')); if (!$access) { return false; @@ -305,12 +311,12 @@ class SermondistributorControllerExternal_source extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -327,13 +333,13 @@ class SermondistributorControllerExternal_source extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('External_source', '', array()); + $model = $this->getModel('External_source', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=external_sources' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -358,13 +364,13 @@ class SermondistributorControllerExternal_source extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -375,7 +381,7 @@ class SermondistributorControllerExternal_source extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -386,7 +392,7 @@ class SermondistributorControllerExternal_source extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -412,7 +418,7 @@ class SermondistributorControllerExternal_source extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -430,29 +436,29 @@ class SermondistributorControllerExternal_source extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -464,16 +470,15 @@ class SermondistributorControllerExternal_source extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/external_sources.php b/admin/controllers/external_sources.php index d3bd3db0..3eb4f367 100644 --- a/admin/controllers/external_sources.php +++ b/admin/controllers/external_sources.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_sources.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * External_sources Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerExternal_sources extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('external_source.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerExternal_sources extends AdminController $model = $this->getModel('External_sources'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'External_sources_'.$date->format('jS_F_Y'),'External sources exported ('.$date->format('jS F, Y').')','external sources'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerExternal_sources extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('external_source.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('External_sources'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('external_source_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'external_sources'); $session->set('dataType_VDM_IMPORTINTO', 'external_source'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_EXTERNAL_SOURCES'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_EXTERNAL_SOURCES'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=external_sources', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/help.php b/admin/controllers/help.php index 91892d00..38fe38d2 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -42,12 +45,12 @@ class SermondistributorControllerHelp extends BaseController public function help() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token) + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) { $task = $this->getTask(); switch($task){ @@ -75,7 +78,7 @@ class SermondistributorControllerHelp extends BaseController break; } } - else + else { // stop execution gracefully jexit(); @@ -84,8 +87,8 @@ class SermondistributorControllerHelp extends BaseController protected function getHelpDocumentText($id) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); + $db = Factory::getDbo(); + $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__sermondistributor_help_document AS a'); $query->where('a.id = '.(int) $id); @@ -94,21 +97,21 @@ class SermondistributorControllerHelp extends BaseController $db->execute(); if($db->getNumRows()) { - $text = array(); + $text = []; $document = $db->loadObject(); // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = ""; $text[] = ''; $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; + $text[] = ''; + $text[] = ''; $text[] = ""; $text[] = '
'; $text[] = '
'; diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index ec8b60e4..5ad0d67d 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Help_document Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerHelp_document extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerHelp_document extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('help_document.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerHelp_document extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('help_document.create', $this->option); } @@ -89,16 +95,16 @@ class SermondistributorControllerHelp_document extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_sermondistributor')); + $access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_sermondistributor')); if (!$access) { return false; @@ -163,12 +169,12 @@ class SermondistributorControllerHelp_document extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -185,13 +191,13 @@ class SermondistributorControllerHelp_document extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Help_document', '', array()); + $model = $this->getModel('Help_document', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=help_documents' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -216,13 +222,13 @@ class SermondistributorControllerHelp_document extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -233,7 +239,7 @@ class SermondistributorControllerHelp_document extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -244,7 +250,7 @@ class SermondistributorControllerHelp_document extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -270,7 +276,7 @@ class SermondistributorControllerHelp_document extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -288,29 +294,29 @@ class SermondistributorControllerHelp_document extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -322,16 +328,15 @@ class SermondistributorControllerHelp_document extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index d41cc2e3..1ee7c550 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Help_documents Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerHelp_documents extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('help_document.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerHelp_documents extends AdminController $model = $this->getModel('Help_documents'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerHelp_documents extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('help_document.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Help_documents'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('help_document_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'help_documents'); $session->set('dataType_VDM_IMPORTINTO', 'help_document'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/import.php b/admin/controllers/import.php index b26652bc..bf98668d 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage import.php @@ -25,7 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -41,21 +45,21 @@ class SermondistributorControllerImport extends BaseController public function import() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel('import'); if ($model->import()) { - $cache = JFactory::getCache('mod_menu'); + $cache = Factory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $redirect_url = $app->getUserState('com_sermondistributor.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_sermondistributor&view=import', false); + $redirect_url = Route::_('index.php?option=com_sermondistributor&view=import', false); } else { diff --git a/admin/controllers/local_listing.php b/admin/controllers/local_listing.php index 7c01f87a..dbbbe9e0 100644 --- a/admin/controllers/local_listing.php +++ b/admin/controllers/local_listing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listing.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Local_listing Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerLocal_listing extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Local_listings'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerLocal_listing extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('local_listing.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerLocal_listing extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('local_listing.create', $this->option); } @@ -89,16 +95,16 @@ class SermondistributorControllerLocal_listing extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $recordId) && $user->authorise('local_listing.access', 'com_sermondistributor')); + $access = ($user->authorise('local_listing.access', 'com_sermondistributor.local_listing.' . (int) $recordId) && $user->authorise('local_listing.access', 'com_sermondistributor')); if (!$access) { return false; @@ -163,12 +169,12 @@ class SermondistributorControllerLocal_listing extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -185,13 +191,13 @@ class SermondistributorControllerLocal_listing extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Local_listing', '', array()); + $model = $this->getModel('Local_listing', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=local_listings' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -216,13 +222,13 @@ class SermondistributorControllerLocal_listing extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -233,7 +239,7 @@ class SermondistributorControllerLocal_listing extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -244,7 +250,7 @@ class SermondistributorControllerLocal_listing extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -270,7 +276,7 @@ class SermondistributorControllerLocal_listing extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -288,29 +294,29 @@ class SermondistributorControllerLocal_listing extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -322,16 +328,15 @@ class SermondistributorControllerLocal_listing extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/local_listings.php b/admin/controllers/local_listings.php index d5f3e1ec..e1ff2ea3 100644 --- a/admin/controllers/local_listings.php +++ b/admin/controllers/local_listings.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listings.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Local_listings Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerLocal_listings extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('local_listing.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerLocal_listings extends AdminController $model = $this->getModel('Local_listings'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Local_listings_'.$date->format('jS_F_Y'),'Local listings exported ('.$date->format('jS F, Y').')','local listings'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerLocal_listings extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('local_listing.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Local_listings'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('local_listing_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'local_listings'); $session->set('dataType_VDM_IMPORTINTO', 'local_listing'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_LOCAL_LISTINGS'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_LOCAL_LISTINGS'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=local_listings', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/manual_updater.php b/admin/controllers/manual_updater.php index 48b34601..64dc9ab7 100644 --- a/admin/controllers/manual_updater.php +++ b/admin/controllers/manual_updater.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage manual_updater.php @@ -25,8 +25,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Manual_updater Admin Controller @@ -43,9 +47,9 @@ class SermondistributorControllerManual_updater extends AdminController /** * Proxy for getModel. - * @since 2.5 + * @since 2.5 */ - public function getModel($name = 'Manual_updater', $prefix = 'SermondistributorModel', $config = array()) + public function getModel($name = 'Manual_updater', $prefix = 'SermondistributorModel', $config = []) { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); @@ -54,14 +58,14 @@ class SermondistributorControllerManual_updater extends AdminController public function dashboard() { - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor', false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor', false)); return; } - public function gotoExternalSources() + public function gotoExternalSources() { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=external_sources', false)); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=external_sources', false)); return; } } diff --git a/admin/controllers/preacher.php b/admin/controllers/preacher.php index af2ef781..84b24438 100644 --- a/admin/controllers/preacher.php +++ b/admin/controllers/preacher.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Preacher Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerPreacher extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Preachers'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerPreacher extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('preacher.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerPreacher extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('preacher.create', $this->option); } @@ -89,16 +95,16 @@ class SermondistributorControllerPreacher extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $recordId) && $user->authorise('preacher.access', 'com_sermondistributor')); + $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $recordId) && $user->authorise('preacher.access', 'com_sermondistributor')); if (!$access) { return false; @@ -163,12 +169,12 @@ class SermondistributorControllerPreacher extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -185,13 +191,13 @@ class SermondistributorControllerPreacher extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Preacher', '', array()); + $model = $this->getModel('Preacher', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=preachers' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -216,13 +222,13 @@ class SermondistributorControllerPreacher extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -233,7 +239,7 @@ class SermondistributorControllerPreacher extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -244,7 +250,7 @@ class SermondistributorControllerPreacher extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -270,7 +276,7 @@ class SermondistributorControllerPreacher extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -288,29 +294,29 @@ class SermondistributorControllerPreacher extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -322,16 +328,15 @@ class SermondistributorControllerPreacher extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/preachers.php b/admin/controllers/preachers.php index 95168672..dd9131f1 100644 --- a/admin/controllers/preachers.php +++ b/admin/controllers/preachers.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Preachers Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerPreachers extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('preacher.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerPreachers extends AdminController $model = $this->getModel('Preachers'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Preachers_'.$date->format('jS_F_Y'),'Preachers exported ('.$date->format('jS F, Y').')','preachers'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerPreachers extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('preacher.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Preachers'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('preacher_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'preachers'); $session->set('dataType_VDM_IMPORTINTO', 'preacher'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/series.php b/admin/controllers/series.php index c39f8846..52898846 100644 --- a/admin/controllers/series.php +++ b/admin/controllers/series.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Series Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerSeries extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Series_list'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerSeries extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('series.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerSeries extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('series.create', $this->option); } @@ -89,16 +95,16 @@ class SermondistributorControllerSeries extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $recordId) && $user->authorise('series.access', 'com_sermondistributor')); + $access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $recordId) && $user->authorise('series.access', 'com_sermondistributor')); if (!$access) { return false; @@ -163,12 +169,12 @@ class SermondistributorControllerSeries extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -185,13 +191,13 @@ class SermondistributorControllerSeries extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Series', '', array()); + $model = $this->getModel('Series', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=series_list' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -216,13 +222,13 @@ class SermondistributorControllerSeries extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -233,7 +239,7 @@ class SermondistributorControllerSeries extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -244,7 +250,7 @@ class SermondistributorControllerSeries extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -270,7 +276,7 @@ class SermondistributorControllerSeries extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -288,29 +294,29 @@ class SermondistributorControllerSeries extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -322,16 +328,15 @@ class SermondistributorControllerSeries extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/series_list.php b/admin/controllers/series_list.php index 64a172fc..f504640b 100644 --- a/admin/controllers/series_list.php +++ b/admin/controllers/series_list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Series_list Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerSeries_list extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('series.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerSeries_list extends AdminController $model = $this->getModel('Series_list'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Series_list_'.$date->format('jS_F_Y'),'Series list exported ('.$date->format('jS F, Y').')','series list'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerSeries_list extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('series.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Series_list'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('series_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'series_list'); $session->set('dataType_VDM_IMPORTINTO', 'series'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/sermon.php b/admin/controllers/sermon.php index 38d90ab9..ba02002d 100644 --- a/admin/controllers/sermon.php +++ b/admin/controllers/sermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Sermon Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerSermon extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Sermons'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerSermon extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('sermon.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerSermon extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('sermon.create', $this->option); } @@ -89,9 +95,9 @@ class SermondistributorControllerSermon extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; @@ -162,12 +168,12 @@ class SermondistributorControllerSermon extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -184,13 +190,13 @@ class SermondistributorControllerSermon extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Sermon', '', array()); + $model = $this->getModel('Sermon', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=sermons' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -215,13 +221,13 @@ class SermondistributorControllerSermon extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -232,7 +238,7 @@ class SermondistributorControllerSermon extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -243,7 +249,7 @@ class SermondistributorControllerSermon extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -269,7 +275,7 @@ class SermondistributorControllerSermon extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -287,29 +293,29 @@ class SermondistributorControllerSermon extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -321,16 +327,15 @@ class SermondistributorControllerSermon extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/sermondistributor.php b/admin/controllers/sermondistributor.php index cca77968..a31d337c 100644 --- a/admin/controllers/sermondistributor.php +++ b/admin/controllers/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,8 +25,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Sermondistributor Admin Controller diff --git a/admin/controllers/sermons.php b/admin/controllers/sermons.php index 3bb2b568..39d42339 100644 --- a/admin/controllers/sermons.php +++ b/admin/controllers/sermons.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Sermons Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerSermons extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('sermon.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerSermons extends AdminController $model = $this->getModel('Sermons'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Sermons_'.$date->format('jS_F_Y'),'Sermons exported ('.$date->format('jS F, Y').')','sermons'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerSermons extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('sermon.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Sermons'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('sermon_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'sermons'); $session->set('dataType_VDM_IMPORTINTO', 'sermon'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/controllers/statistic.php b/admin/controllers/statistic.php index ea1fe35f..f3de54f0 100644 --- a/admin/controllers/statistic.php +++ b/admin/controllers/statistic.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; /** * Statistic Form Controller @@ -49,13 +55,13 @@ class SermondistributorControllerStatistic extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Statistics'; // safeguard for setting the return view listing to the main view. parent::__construct($config); } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -64,10 +70,10 @@ class SermondistributorControllerStatistic extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // Get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access check. $access = $user->authorise('statistic.access', 'com_sermondistributor'); if (!$access) @@ -75,7 +81,7 @@ class SermondistributorControllerStatistic extends FormController return false; } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('statistic.create', $this->option); } @@ -89,16 +95,16 @@ class SermondistributorControllerStatistic extends FormController * * @since 1.6 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // get user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; // Access check. - $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $recordId) && $user->authorise('statistic.access', 'com_sermondistributor')); + $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $recordId) && $user->authorise('statistic.access', 'com_sermondistributor')); if (!$access) { return false; @@ -163,12 +169,12 @@ class SermondistributorControllerStatistic extends FormController // set the referral options if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + { + $append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append; } elseif ($ref) { - $append = '&ref='. (string)$ref . $append; + $append = '&ref='. (string) $ref . $append; } return $append; @@ -185,13 +191,13 @@ class SermondistributorControllerStatistic extends FormController */ public function batch($model = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Set the model - $model = $this->getModel('Statistic', '', array()); + $model = $this->getModel('Statistic', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=statistics' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -216,13 +222,13 @@ class SermondistributorControllerStatistic extends FormController $cancel = parent::cancel($key); - if (!is_null($return) && JUri::isInternal(base64_decode($return))) + if (!is_null($return) && Uri::isInternal(base64_decode($return))) { $redirect = base64_decode($return); // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); @@ -233,7 +239,7 @@ class SermondistributorControllerStatistic extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -244,7 +250,7 @@ class SermondistributorControllerStatistic extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -270,7 +276,7 @@ class SermondistributorControllerStatistic extends FormController // Check if there is a return value $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + $canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return))); if ($this->ref || $this->refid || $canReturn) { @@ -288,29 +294,29 @@ class SermondistributorControllerStatistic extends FormController // Redirect to the return value. $this->setRedirect( - JRoute::_( + Route::_( $redirect, false ) ); } elseif ($this->refid && $this->ref) { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + $redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid; // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); } elseif ($this->ref) { - $redirect = '&view=' . (string)$this->ref; + $redirect = '&view=' . (string) $this->ref; // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -322,16 +328,15 @@ class SermondistributorControllerStatistic extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param JModel &$model The data model object. - * @param array $validData The validated data. + * @param BaseDatabaseModel &$model The data model object. + * @param array $validData The validated data. * * @return void * * @since 11.1 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { return; } - } diff --git a/admin/controllers/statistics.php b/admin/controllers/statistics.php index 44380186..b58ad031 100644 --- a/admin/controllers/statistics.php +++ b/admin/controllers/statistics.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.php @@ -25,8 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; /** * Statistics Admin Controller @@ -60,13 +66,13 @@ class SermondistributorControllerStatistics extends AdminController public function exportData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if export is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('statistic.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input $pks = ArrayHelper::toInteger($pks); @@ -74,16 +80,16 @@ class SermondistributorControllerStatistics extends AdminController $model = $this->getModel('Statistics'); // get the data to export $data = $model->getExportData($pks); - if (SermondistributorHelper::checkArray($data)) + if (UtilitiesArrayHelper::check($data)) { // now set the data to the spreadsheet - $date = JFactory::getDate(); + $date = Factory::getDate(); SermondistributorHelper::xls($data,'Statistics_'.$date->format('jS_F_Y'),'Statistics exported ('.$date->format('jS F, Y').')','statistics'); } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); return; } @@ -91,32 +97,32 @@ class SermondistributorControllerStatistics extends AdminController public function importData() { // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->authorise('statistic.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // Get the import model $model = $this->getModel('Statistics'); // get the headers to import $headers = $model->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { // Load headers to session. - $session = JFactory::getSession(); + $session = Factory::getSession(); $headers = json_encode($headers); $session->set('statistic_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'statistics'); $session->set('dataType_VDM_IMPORTINTO', 'statistic'); // Redirect to import view. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_STATISTICS'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_STATISTICS'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=import', false), $message); return; } } // Redirect to the list screen with error. - $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); + $message = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); return; } -} +} \ No newline at end of file diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index a049a32a..f7105232 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage headercheck.php @@ -25,24 +25,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class sermondistributorHeaderCheck { + protected $document = null; + protected $app = null; + function js_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['scripts']) as $script) { if (stristr($script, $script_name)) @@ -53,24 +65,30 @@ class sermondistributorHeaderCheck return false; } - + function css_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['styleSheets']) as $script) { if (stristr($script, $script_name)) @@ -81,4 +99,4 @@ class sermondistributorHeaderCheck return false; } -} \ No newline at end of file +} diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index ff7f840d..511de06b 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage batch_.php @@ -38,7 +38,7 @@ abstract class JHtmlBatch_ * @var array * @since 3.0 */ - protected static $ListSelection = array(); + protected static $ListSelection = []; /** * Render the batch selection options. diff --git a/admin/helpers/sermondistributor.php b/admin/helpers/sermondistributor.php index beee197d..67506b77 100644 --- a/admin/helpers/sermondistributor.php +++ b/admin/helpers/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,8 +25,62 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// register additional namespace +\spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ]; + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // not found so move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Access; +use Joomla\CMS\Access\Rules as AccessRules; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Language; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Version; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; @@ -34,6 +88,15 @@ use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\MimeHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\FormHelper; /** * Sermondistributor component helper. @@ -42,14 +105,14 @@ abstract class SermondistributorHelper { /** * Composer Switch - * + * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language - * + * * @var string */ public static $langTag; @@ -134,7 +197,7 @@ abstract class SermondistributorHelper // decrypt the urls $safe = new FOFEncryptAes($localkey, 128); // internal download url - $keyCounter = new stdClass; + $keyCounter = new \stdClass; $keyCounter->sermon = $sermon->id; if ($sermon->preacher) { @@ -147,7 +210,7 @@ abstract class SermondistributorHelper $keyCounterRAW = $safe->encryptString(json_encode($keyCounter)); $keyCounter = self::base64_urlencode($keyCounterRAW); $token = JSession::getFormToken(); - $downloadURL = JURI::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token; + $downloadURL = Uri::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token; // check if local .htaccess should be set $setHtaccess = false; $onclick = ' onclick="sermonCounter(\''.$keyCounterRAW.'\',\'FILENAME\');"'; @@ -162,7 +225,7 @@ abstract class SermondistributorHelper if (2 == $sermon->link_type && strpos($localFolder, JPATH_ROOT) !== false) { $allowDirect = true; - $localFolderURL = JURI::root().str_replace(JPATH_ROOT, '', $localFolder); + $localFolderURL = Uri::root().str_replace(JPATH_ROOT, '', $localFolder); // insure no double // is in the URL $localFolderURL = str_replace('//', '/', $localFolderURL); $localFolderURL = str_replace(':/', '://', $localFolderURL); @@ -388,112 +451,37 @@ abstract class SermondistributorHelper } /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * @deprecated 3.3 Use FileHelper::getPath(...); + */ public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) { - // make sure to always have a string/path - if(!self::checkString($default)) - { - $default = JPATH_SITE . '/images/'; - } - // get the global settings - if (!self::checkObject(self::$params)) - { - self::$params = JComponentHelper::getParams('com_sermondistributor'); - } - $filePath = self::$params->get($target, $default); - // check the file path (revert to default only of not a hidden file path) - if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false) - { - $filePath = $default; - } - // create the folder if it does not exist - if ($createIfNotSet && !Folder::exists($filePath)) - { - Folder::create($filePath); - } - // setup the file name - $fileName = ''; - // Get basic key - $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; - if (method_exists(get_called_class(), "getCryptKey")) - { - $basickey = self::getCryptKey('basic', $basickey); - } - // check the key - if (!self::checkString($key)) - { - $key = 'vDm'; - } - // set the file name - if (self::checkString($fileType)) - { - // set the name - $fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.')); - } - else - { - $fileName = trim(md5($type.$target.$basickey.$key)) . '.txt'; - } - // return the url - if ('url' === $type) - { - if (strpos($filePath, JPATH_SITE) !== false) - { - $filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/'); - return JURI::root() . $filePath . '/' . $fileName; - } - // since the path is behind the root folder of the site, return only the root url (may be used to build the link) - return JURI::root(); - } - // sanitize the path - return '/' . trim( $filePath, '/' ) . '/' . $fileName; + // Get the file path or url + return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); } - /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * @deprecated 3.3 Use FileHelper::write(...); + */ public static function writeFile($path, $data) { - $klaar = false; - if (self::checkString($data)) - { - // open the file - $fh = fopen($path, "w"); - if (!is_resource($fh)) - { - return $klaar; - } - // write to the file - if (fwrite($fh, $data)) - { - // has been done - $klaar = true; - } - // close file. - fclose($fh); - } - return $klaar; + return FileHelper::write($path, $data); } - protected static function saveFile($data, $path_filename) { return self::writeFile($path_filename, $data); @@ -684,1101 +672,13 @@ abstract class SermondistributorHelper // get the size of the file $info['filesize'] = $db->loadResult(); // get the mime type - $info['type'] = self::mimeType($key); + $info['type'] = MimeHelper::mimeType($key); // return info return $info; } } return false; } - - /** - * File Extensions to Mimetypes - * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b - * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array - */ - protected static $fileExtensionToMimeType = array( - '123' => 'application/vnd.lotus-1-2-3', - '3dml' => 'text/vnd.in3d.3dml', - '3ds' => 'image/x-3ds', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gpp', - '7z' => 'application/x-7z-compressed', - 'aab' => 'application/x-authorware-bin', - 'aac' => 'audio/x-aac', - 'aam' => 'application/x-authorware-map', - 'aas' => 'application/x-authorware-seg', - 'abw' => 'application/x-abiword', - 'ac' => 'application/pkix-attr-cert', - 'acc' => 'application/vnd.americandynamics.acc', - 'ace' => 'application/x-ace-compressed', - 'acu' => 'application/vnd.acucobol', - 'acutc' => 'application/vnd.acucorp', - 'adp' => 'audio/adpcm', - 'aep' => 'application/vnd.audiograph', - 'afm' => 'application/x-font-type1', - 'afp' => 'application/vnd.ibm.modcap', - 'ahead' => 'application/vnd.ahead.space', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'air' => 'application/vnd.adobe.air-application-installer-package+zip', - 'ait' => 'application/vnd.dvb.ait', - 'ami' => 'application/vnd.amiga.ami', - 'apk' => 'application/vnd.android.package-archive', - 'appcache' => 'text/cache-manifest', - 'application' => 'application/x-ms-application', - 'apr' => 'application/vnd.lotus-approach', - 'arc' => 'application/x-freearc', - 'asc' => 'application/pgp-signature', - 'asf' => 'video/x-ms-asf', - 'asm' => 'text/x-asm', - 'aso' => 'application/vnd.accpac.simply.aso', - 'asx' => 'video/x-ms-asf', - 'atc' => 'application/vnd.acucorp', - 'atom' => 'application/atom+xml', - 'atomcat' => 'application/atomcat+xml', - 'atomsvc' => 'application/atomsvc+xml', - 'atx' => 'application/vnd.antix.game-component', - 'au' => 'audio/basic', - 'avi' => 'video/x-msvideo', - 'aw' => 'application/applixware', - 'azf' => 'application/vnd.airzip.filesecure.azf', - 'azs' => 'application/vnd.airzip.filesecure.azs', - 'azw' => 'application/vnd.amazon.ebook', - 'bat' => 'application/x-msdownload', - 'bcpio' => 'application/x-bcpio', - 'bdf' => 'application/x-font-bdf', - 'bdm' => 'application/vnd.syncml.dm+wbxml', - 'bed' => 'application/vnd.realvnc.bed', - 'bh2' => 'application/vnd.fujitsu.oasysprs', - 'bin' => 'application/octet-stream', - 'blb' => 'application/x-blorb', - 'blorb' => 'application/x-blorb', - 'bmi' => 'application/vnd.bmi', - 'bmp' => 'image/bmp', - 'book' => 'application/vnd.framemaker', - 'box' => 'application/vnd.previewsystems.box', - 'boz' => 'application/x-bzip2', - 'bpk' => 'application/octet-stream', - 'btif' => 'image/prs.btif', - 'bz' => 'application/x-bzip', - 'bz2' => 'application/x-bzip2', - 'c' => 'text/x-c', - 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', - 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', - 'c4d' => 'application/vnd.clonk.c4group', - 'c4f' => 'application/vnd.clonk.c4group', - 'c4g' => 'application/vnd.clonk.c4group', - 'c4p' => 'application/vnd.clonk.c4group', - 'c4u' => 'application/vnd.clonk.c4group', - 'cab' => 'application/vnd.ms-cab-compressed', - 'caf' => 'audio/x-caf', - 'cap' => 'application/vnd.tcpdump.pcap', - 'car' => 'application/vnd.curl.car', - 'cat' => 'application/vnd.ms-pki.seccat', - 'cb7' => 'application/x-cbr', - 'cba' => 'application/x-cbr', - 'cbr' => 'application/x-cbr', - 'cbt' => 'application/x-cbr', - 'cbz' => 'application/x-cbr', - 'cc' => 'text/x-c', - 'cct' => 'application/x-director', - 'ccxml' => 'application/ccxml+xml', - 'cdbcmsg' => 'application/vnd.contact.cmsg', - 'cdf' => 'application/x-netcdf', - 'cdkey' => 'application/vnd.mediastation.cdkey', - 'cdmia' => 'application/cdmi-capability', - 'cdmic' => 'application/cdmi-container', - 'cdmid' => 'application/cdmi-domain', - 'cdmio' => 'application/cdmi-object', - 'cdmiq' => 'application/cdmi-queue', - 'cdx' => 'chemical/x-cdx', - 'cdxml' => 'application/vnd.chemdraw+xml', - 'cdy' => 'application/vnd.cinderella', - 'cer' => 'application/pkix-cert', - 'cfs' => 'application/x-cfs-compressed', - 'cgm' => 'image/cgm', - 'chat' => 'application/x-chat', - 'chm' => 'application/vnd.ms-htmlhelp', - 'chrt' => 'application/vnd.kde.kchart', - 'cif' => 'chemical/x-cif', - 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', - 'cil' => 'application/vnd.ms-artgalry', - 'cla' => 'application/vnd.claymore', - 'class' => 'application/java-vm', - 'clkk' => 'application/vnd.crick.clicker.keyboard', - 'clkp' => 'application/vnd.crick.clicker.palette', - 'clkt' => 'application/vnd.crick.clicker.template', - 'clkw' => 'application/vnd.crick.clicker.wordbank', - 'clkx' => 'application/vnd.crick.clicker', - 'clp' => 'application/x-msclip', - 'cmc' => 'application/vnd.cosmocaller', - 'cmdf' => 'chemical/x-cmdf', - 'cml' => 'chemical/x-cml', - 'cmp' => 'application/vnd.yellowriver-custom-menu', - 'cmx' => 'image/x-cmx', - 'cod' => 'application/vnd.rim.cod', - 'com' => 'application/x-msdownload', - 'conf' => 'text/plain', - 'cpio' => 'application/x-cpio', - 'cpp' => 'text/x-c', - 'cpt' => 'application/mac-compactpro', - 'crd' => 'application/x-mscardfile', - 'crl' => 'application/pkix-crl', - 'crt' => 'application/x-x509-ca-cert', - 'cryptonote' => 'application/vnd.rig.cryptonote', - 'csh' => 'application/x-csh', - 'csml' => 'chemical/x-csml', - 'csp' => 'application/vnd.commonspace', - 'css' => 'text/css', - 'cst' => 'application/x-director', - 'csv' => 'text/csv', - 'cu' => 'application/cu-seeme', - 'curl' => 'text/vnd.curl', - 'cww' => 'application/prs.cww', - 'cxt' => 'application/x-director', - 'cxx' => 'text/x-c', - 'dae' => 'model/vnd.collada+xml', - 'daf' => 'application/vnd.mobius.daf', - 'dart' => 'application/vnd.dart', - 'dataless' => 'application/vnd.fdsn.seed', - 'davmount' => 'application/davmount+xml', - 'dbk' => 'application/docbook+xml', - 'dcr' => 'application/x-director', - 'dcurl' => 'text/vnd.curl.dcurl', - 'dd2' => 'application/vnd.oma.dd2+xml', - 'ddd' => 'application/vnd.fujixerox.ddd', - 'deb' => 'application/x-debian-package', - 'def' => 'text/plain', - 'deploy' => 'application/octet-stream', - 'der' => 'application/x-x509-ca-cert', - 'dfac' => 'application/vnd.dreamfactory', - 'dgc' => 'application/x-dgc-compressed', - 'dic' => 'text/x-c', - 'dir' => 'application/x-director', - 'dis' => 'application/vnd.mobius.dis', - 'dist' => 'application/octet-stream', - 'distz' => 'application/octet-stream', - 'djv' => 'image/vnd.djvu', - 'djvu' => 'image/vnd.djvu', - 'dll' => 'application/x-msdownload', - 'dmg' => 'application/x-apple-diskimage', - 'dmp' => 'application/vnd.tcpdump.pcap', - 'dms' => 'application/octet-stream', - 'dna' => 'application/vnd.dna', - 'doc' => 'application/msword', - 'docm' => 'application/vnd.ms-word.document.macroenabled.12', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot' => 'application/msword', - 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'dp' => 'application/vnd.osgi.dp', - 'dpg' => 'application/vnd.dpgraph', - 'dra' => 'audio/vnd.dra', - 'dsc' => 'text/prs.lines.tag', - 'dssc' => 'application/dssc+der', - 'dtb' => 'application/x-dtbook+xml', - 'dtd' => 'application/xml-dtd', - 'dts' => 'audio/vnd.dts', - 'dtshd' => 'audio/vnd.dts.hd', - 'dump' => 'application/octet-stream', - 'dvb' => 'video/vnd.dvb.file', - 'dvi' => 'application/x-dvi', - 'dwf' => 'model/vnd.dwf', - 'dwg' => 'image/vnd.dwg', - 'dxf' => 'image/vnd.dxf', - 'dxp' => 'application/vnd.spotfire.dxp', - 'dxr' => 'application/x-director', - 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', - 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', - 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', - 'ecma' => 'application/ecmascript', - 'edm' => 'application/vnd.novadigm.edm', - 'edx' => 'application/vnd.novadigm.edx', - 'efif' => 'application/vnd.picsel', - 'ei6' => 'application/vnd.pg.osasli', - 'elc' => 'application/octet-stream', - 'emf' => 'application/x-msmetafile', - 'eml' => 'message/rfc822', - 'emma' => 'application/emma+xml', - 'emz' => 'application/x-msmetafile', - 'eol' => 'audio/vnd.digital-winds', - 'eot' => 'application/vnd.ms-fontobject', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'es3' => 'application/vnd.eszigno3+xml', - 'esa' => 'application/vnd.osgi.subsystem', - 'esf' => 'application/vnd.epson.esf', - 'et3' => 'application/vnd.eszigno3+xml', - 'etx' => 'text/x-setext', - 'eva' => 'application/x-eva', - 'evy' => 'application/x-envoy', - 'exe' => 'application/x-msdownload', - 'exi' => 'application/exi', - 'ext' => 'application/vnd.novadigm.ext', - 'ez' => 'application/andrew-inset', - 'ez2' => 'application/vnd.ezpix-album', - 'ez3' => 'application/vnd.ezpix-package', - 'f' => 'text/x-fortran', - 'f4v' => 'video/x-f4v', - 'f77' => 'text/x-fortran', - 'f90' => 'text/x-fortran', - 'fbs' => 'image/vnd.fastbidsheet', - 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', - 'fcs' => 'application/vnd.isac.fcs', - 'fdf' => 'application/vnd.fdf', - 'fe_launch' => 'application/vnd.denovo.fcselayout-link', - 'fg5' => 'application/vnd.fujitsu.oasysgp', - 'fgd' => 'application/x-director', - 'fh' => 'image/x-freehand', - 'fh4' => 'image/x-freehand', - 'fh5' => 'image/x-freehand', - 'fh7' => 'image/x-freehand', - 'fhc' => 'image/x-freehand', - 'fig' => 'application/x-xfig', - 'flac' => 'audio/x-flac', - 'fli' => 'video/x-fli', - 'flo' => 'application/vnd.micrografx.flo', - 'flv' => 'video/x-flv', - 'flw' => 'application/vnd.kde.kivio', - 'flx' => 'text/vnd.fmi.flexstor', - 'fly' => 'text/vnd.fly', - 'fm' => 'application/vnd.framemaker', - 'fnc' => 'application/vnd.frogans.fnc', - 'for' => 'text/x-fortran', - 'fpx' => 'image/vnd.fpx', - 'frame' => 'application/vnd.framemaker', - 'fsc' => 'application/vnd.fsc.weblaunch', - 'fst' => 'image/vnd.fst', - 'ftc' => 'application/vnd.fluxtime.clip', - 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', - 'fvt' => 'video/vnd.fvt', - 'fxp' => 'application/vnd.adobe.fxp', - 'fxpl' => 'application/vnd.adobe.fxp', - 'fzs' => 'application/vnd.fuzzysheet', - 'g2w' => 'application/vnd.geoplan', - 'g3' => 'image/g3fax', - 'g3w' => 'application/vnd.geospace', - 'gac' => 'application/vnd.groove-account', - 'gam' => 'application/x-tads', - 'gbr' => 'application/rpki-ghostbusters', - 'gca' => 'application/x-gca-compressed', - 'gdl' => 'model/vnd.gdl', - 'geo' => 'application/vnd.dynageo', - 'gex' => 'application/vnd.geometry-explorer', - 'ggb' => 'application/vnd.geogebra.file', - 'ggt' => 'application/vnd.geogebra.tool', - 'ghf' => 'application/vnd.groove-help', - 'gif' => 'image/gif', - 'gim' => 'application/vnd.groove-identity-message', - 'gml' => 'application/gml+xml', - 'gmx' => 'application/vnd.gmx', - 'gnumeric' => 'application/x-gnumeric', - 'gph' => 'application/vnd.flographit', - 'gpx' => 'application/gpx+xml', - 'gqf' => 'application/vnd.grafeq', - 'gqs' => 'application/vnd.grafeq', - 'gram' => 'application/srgs', - 'gramps' => 'application/x-gramps-xml', - 'gre' => 'application/vnd.geometry-explorer', - 'grv' => 'application/vnd.groove-injector', - 'grxml' => 'application/srgs+xml', - 'gsf' => 'application/x-font-ghostscript', - 'gtar' => 'application/x-gtar', - 'gtm' => 'application/vnd.groove-tool-message', - 'gtw' => 'model/vnd.gtw', - 'gv' => 'text/vnd.graphviz', - 'gxf' => 'application/gxf', - 'gxt' => 'application/vnd.geonext', - 'h' => 'text/x-c', - 'h261' => 'video/h261', - 'h263' => 'video/h263', - 'h264' => 'video/h264', - 'hal' => 'application/vnd.hal+xml', - 'hbci' => 'application/vnd.hbci', - 'hdf' => 'application/x-hdf', - 'hh' => 'text/x-c', - 'hlp' => 'application/winhlp', - 'hpgl' => 'application/vnd.hp-hpgl', - 'hpid' => 'application/vnd.hp-hpid', - 'hps' => 'application/vnd.hp-hps', - 'hqx' => 'application/mac-binhex40', - 'htke' => 'application/vnd.kenameaapp', - 'htm' => 'text/html', - 'html' => 'text/html', - 'hvd' => 'application/vnd.yamaha.hv-dic', - 'hvp' => 'application/vnd.yamaha.hv-voice', - 'hvs' => 'application/vnd.yamaha.hv-script', - 'i2g' => 'application/vnd.intergeo', - 'icc' => 'application/vnd.iccprofile', - 'ice' => 'x-conference/x-cooltalk', - 'icm' => 'application/vnd.iccprofile', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ief' => 'image/ief', - 'ifb' => 'text/calendar', - 'ifm' => 'application/vnd.shana.informed.formdata', - 'iges' => 'model/iges', - 'igl' => 'application/vnd.igloader', - 'igm' => 'application/vnd.insors.igm', - 'igs' => 'model/iges', - 'igx' => 'application/vnd.micrografx.igx', - 'iif' => 'application/vnd.shana.informed.interchange', - 'imp' => 'application/vnd.accpac.simply.imp', - 'ims' => 'application/vnd.ms-ims', - 'in' => 'text/plain', - 'ink' => 'application/inkml+xml', - 'inkml' => 'application/inkml+xml', - 'install' => 'application/x-install-instructions', - 'iota' => 'application/vnd.astraea-software.iota', - 'ipfix' => 'application/ipfix', - 'ipk' => 'application/vnd.shana.informed.package', - 'irm' => 'application/vnd.ibm.rights-management', - 'irp' => 'application/vnd.irepository.package+xml', - 'iso' => 'application/x-iso9660-image', - 'itp' => 'application/vnd.shana.informed.formtemplate', - 'ivp' => 'application/vnd.immervision-ivp', - 'ivu' => 'application/vnd.immervision-ivu', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'jam' => 'application/vnd.jam', - 'jar' => 'application/java-archive', - 'java' => 'text/x-java-source', - 'jisp' => 'application/vnd.jisp', - 'jlt' => 'application/vnd.hp-jlyt', - 'jnlp' => 'application/x-java-jnlp-file', - 'joda' => 'application/vnd.joost.joda-archive', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'jpgm' => 'video/jpm', - 'jpgv' => 'video/jpeg', - 'jpm' => 'video/jpm', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'jsonml' => 'application/jsonml+json', - 'kar' => 'audio/midi', - 'karbon' => 'application/vnd.kde.karbon', - 'kfo' => 'application/vnd.kde.kformula', - 'kia' => 'application/vnd.kidspiration', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kne' => 'application/vnd.kinar', - 'knp' => 'application/vnd.kinar', - 'kon' => 'application/vnd.kde.kontour', - 'kpr' => 'application/vnd.kde.kpresenter', - 'kpt' => 'application/vnd.kde.kpresenter', - 'kpxx' => 'application/vnd.ds-keypoint', - 'ksp' => 'application/vnd.kde.kspread', - 'ktr' => 'application/vnd.kahootz', - 'ktx' => 'image/ktx', - 'ktz' => 'application/vnd.kahootz', - 'kwd' => 'application/vnd.kde.kword', - 'kwt' => 'application/vnd.kde.kword', - 'lasxml' => 'application/vnd.las.las+xml', - 'latex' => 'application/x-latex', - 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', - 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', - 'les' => 'application/vnd.hhe.lesson-player', - 'lha' => 'application/x-lzh-compressed', - 'link66' => 'application/vnd.route66.link66+xml', - 'list' => 'text/plain', - 'list3820' => 'application/vnd.ibm.modcap', - 'listafp' => 'application/vnd.ibm.modcap', - 'lnk' => 'application/x-ms-shortcut', - 'log' => 'text/plain', - 'lostxml' => 'application/lost+xml', - 'lrf' => 'application/octet-stream', - 'lrm' => 'application/vnd.ms-lrm', - 'ltf' => 'application/vnd.frogans.ltf', - 'lvp' => 'audio/vnd.lucent.voice', - 'lwp' => 'application/vnd.lotus-wordpro', - 'lzh' => 'application/x-lzh-compressed', - 'm13' => 'application/x-msmediaview', - 'm14' => 'application/x-msmediaview', - 'm1v' => 'video/mpeg', - 'm21' => 'application/mp21', - 'm2a' => 'audio/mpeg', - 'm2v' => 'video/mpeg', - 'm3a' => 'audio/mpeg', - 'm3u' => 'audio/x-mpegurl', - 'm3u8' => 'application/vnd.apple.mpegurl', - 'm4a' => 'audio/mp4', - 'm4u' => 'video/vnd.mpegurl', - 'm4v' => 'video/x-m4v', - 'ma' => 'application/mathematica', - 'mads' => 'application/mads+xml', - 'mag' => 'application/vnd.ecowin.chart', - 'maker' => 'application/vnd.framemaker', - 'man' => 'text/troff', - 'mar' => 'application/octet-stream', - 'mathml' => 'application/mathml+xml', - 'mb' => 'application/mathematica', - 'mbk' => 'application/vnd.mobius.mbk', - 'mbox' => 'application/mbox', - 'mc1' => 'application/vnd.medcalcdata', - 'mcd' => 'application/vnd.mcd', - 'mcurl' => 'text/vnd.curl.mcurl', - 'mdb' => 'application/x-msaccess', - 'mdi' => 'image/vnd.ms-modi', - 'me' => 'text/troff', - 'mesh' => 'model/mesh', - 'meta4' => 'application/metalink4+xml', - 'metalink' => 'application/metalink+xml', - 'mets' => 'application/mets+xml', - 'mfm' => 'application/vnd.mfmp', - 'mft' => 'application/rpki-manifest', - 'mgp' => 'application/vnd.osgeo.mapguide.package', - 'mgz' => 'application/vnd.proteus.magazine', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mie' => 'application/x-mie', - 'mif' => 'application/vnd.mif', - 'mime' => 'message/rfc822', - 'mj2' => 'video/mj2', - 'mjp2' => 'video/mj2', - 'mk3d' => 'video/x-matroska', - 'mka' => 'audio/x-matroska', - 'mks' => 'video/x-matroska', - 'mkv' => 'video/x-matroska', - 'mlp' => 'application/vnd.dolby.mlp', - 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', - 'mmf' => 'application/vnd.smaf', - 'mmr' => 'image/vnd.fujixerox.edmics-mmr', - 'mng' => 'video/x-mng', - 'mny' => 'application/x-msmoney', - 'mobi' => 'application/x-mobipocket-ebook', - 'mods' => 'application/mods+xml', - 'mov' => 'video/quicktime', - 'movie' => 'video/x-sgi-movie', - 'mp2' => 'audio/mpeg', - 'mp21' => 'application/mp21', - 'mp2a' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mp4a' => 'audio/mp4', - 'mp4s' => 'application/mp4', - 'mp4v' => 'video/mp4', - 'mpc' => 'application/vnd.mophun.certificate', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpg4' => 'video/mp4', - 'mpga' => 'audio/mpeg', - 'mpkg' => 'application/vnd.apple.installer+xml', - 'mpm' => 'application/vnd.blueice.multipass', - 'mpn' => 'application/vnd.mophun.application', - 'mpp' => 'application/vnd.ms-project', - 'mpt' => 'application/vnd.ms-project', - 'mpy' => 'application/vnd.ibm.minipay', - 'mqy' => 'application/vnd.mobius.mqy', - 'mrc' => 'application/marc', - 'mrcx' => 'application/marcxml+xml', - 'ms' => 'text/troff', - 'mscml' => 'application/mediaservercontrol+xml', - 'mseed' => 'application/vnd.fdsn.mseed', - 'mseq' => 'application/vnd.mseq', - 'msf' => 'application/vnd.epson.msf', - 'msh' => 'model/mesh', - 'msi' => 'application/x-msdownload', - 'msl' => 'application/vnd.mobius.msl', - 'msty' => 'application/vnd.muvee.style', - 'mts' => 'model/vnd.mts', - 'mus' => 'application/vnd.musician', - 'musicxml' => 'application/vnd.recordare.musicxml+xml', - 'mvb' => 'application/x-msmediaview', - 'mwf' => 'application/vnd.mfer', - 'mxf' => 'application/mxf', - 'mxl' => 'application/vnd.recordare.musicxml', - 'mxml' => 'application/xv+xml', - 'mxs' => 'application/vnd.triscape.mxs', - 'mxu' => 'video/vnd.mpegurl', - 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', - 'n3' => 'text/n3', - 'nb' => 'application/mathematica', - 'nbp' => 'application/vnd.wolfram.player', - 'nc' => 'application/x-netcdf', - 'ncx' => 'application/x-dtbncx+xml', - 'nfo' => 'text/x-nfo', - 'ngdat' => 'application/vnd.nokia.n-gage.data', - 'nitf' => 'application/vnd.nitf', - 'nlu' => 'application/vnd.neurolanguage.nlu', - 'nml' => 'application/vnd.enliven', - 'nnd' => 'application/vnd.noblenet-directory', - 'nns' => 'application/vnd.noblenet-sealer', - 'nnw' => 'application/vnd.noblenet-web', - 'npx' => 'image/vnd.net-fpx', - 'nsc' => 'application/x-conference', - 'nsf' => 'application/vnd.lotus-notes', - 'ntf' => 'application/vnd.nitf', - 'nzb' => 'application/x-nzb', - 'oa2' => 'application/vnd.fujitsu.oasys2', - 'oa3' => 'application/vnd.fujitsu.oasys3', - 'oas' => 'application/vnd.fujitsu.oasys', - 'obd' => 'application/x-msbinder', - 'obj' => 'application/x-tgif', - 'oda' => 'application/oda', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odft' => 'application/vnd.oasis.opendocument.formula-template', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'oga' => 'audio/ogg', - 'ogg' => 'audio/ogg', - 'ogv' => 'video/ogg', - 'ogx' => 'application/ogg', - 'omdoc' => 'application/omdoc+xml', - 'onepkg' => 'application/onenote', - 'onetmp' => 'application/onenote', - 'onetoc' => 'application/onenote', - 'onetoc2' => 'application/onenote', - 'opf' => 'application/oebps-package+xml', - 'opml' => 'text/x-opml', - 'oprc' => 'application/vnd.palm', - 'opus' => 'audio/ogg', - 'org' => 'application/vnd.lotus-organizer', - 'osf' => 'application/vnd.yamaha.openscoreformat', - 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', - 'otc' => 'application/vnd.oasis.opendocument.chart-template', - 'otf' => 'font/otf', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'oti' => 'application/vnd.oasis.opendocument.image-template', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'oxps' => 'application/oxps', - 'oxt' => 'application/vnd.openofficeorg.extension', - 'p' => 'text/x-pascal', - 'p10' => 'application/pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7b' => 'application/x-pkcs7-certificates', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'p8' => 'application/pkcs8', - 'pas' => 'text/x-pascal', - 'paw' => 'application/vnd.pawaafile', - 'pbd' => 'application/vnd.powerbuilder6', - 'pbm' => 'image/x-portable-bitmap', - 'pcap' => 'application/vnd.tcpdump.pcap', - 'pcf' => 'application/x-font-pcf', - 'pcl' => 'application/vnd.hp-pcl', - 'pclxl' => 'application/vnd.hp-pclxl', - 'pct' => 'image/x-pict', - 'pcurl' => 'application/vnd.curl.pcurl', - 'pcx' => 'image/x-pcx', - 'pdb' => 'application/vnd.palm', - 'pdf' => 'application/pdf', - 'pfa' => 'application/x-font-type1', - 'pfb' => 'application/x-font-type1', - 'pfm' => 'application/x-font-type1', - 'pfr' => 'application/font-tdpfr', - 'pfx' => 'application/x-pkcs12', - 'pgm' => 'image/x-portable-graymap', - 'pgn' => 'application/x-chess-pgn', - 'pgp' => 'application/pgp-encrypted', - 'pic' => 'image/x-pict', - 'pkg' => 'application/octet-stream', - 'pki' => 'application/pkixcmp', - 'pkipath' => 'application/pkix-pkipath', - 'plb' => 'application/vnd.3gpp.pic-bw-large', - 'plc' => 'application/vnd.mobius.plc', - 'plf' => 'application/vnd.pocketlearn', - 'pls' => 'application/pls+xml', - 'pml' => 'application/vnd.ctc-posml', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'portpkg' => 'application/vnd.macports.portpkg', - 'pot' => 'application/vnd.ms-powerpoint', - 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', - 'ppd' => 'application/vnd.cups-ppd', - 'ppm' => 'image/x-portable-pixmap', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppt' => 'application/vnd.ms-powerpoint', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'pqa' => 'application/vnd.palm', - 'prc' => 'application/x-mobipocket-ebook', - 'pre' => 'application/vnd.lotus-freelance', - 'prf' => 'application/pics-rules', - 'ps' => 'application/postscript', - 'psb' => 'application/vnd.3gpp.pic-bw-small', - 'psd' => 'image/vnd.adobe.photoshop', - 'psf' => 'application/x-font-linux-psf', - 'pskcxml' => 'application/pskc+xml', - 'ptid' => 'application/vnd.pvi.ptid1', - 'pub' => 'application/x-mspublisher', - 'pvb' => 'application/vnd.3gpp.pic-bw-var', - 'pwn' => 'application/vnd.3m.post-it-notes', - 'pya' => 'audio/vnd.ms-playready.media.pya', - 'pyv' => 'video/vnd.ms-playready.media.pyv', - 'qam' => 'application/vnd.epson.quickanime', - 'qbo' => 'application/vnd.intu.qbo', - 'qfx' => 'application/vnd.intu.qfx', - 'qps' => 'application/vnd.publishare-delta-tree', - 'qt' => 'video/quicktime', - 'qwd' => 'application/vnd.quark.quarkxpress', - 'qwt' => 'application/vnd.quark.quarkxpress', - 'qxb' => 'application/vnd.quark.quarkxpress', - 'qxd' => 'application/vnd.quark.quarkxpress', - 'qxl' => 'application/vnd.quark.quarkxpress', - 'qxt' => 'application/vnd.quark.quarkxpress', - 'ra' => 'audio/x-pn-realaudio', - 'ram' => 'audio/x-pn-realaudio', - 'rar' => 'application/x-rar-compressed', - 'ras' => 'image/x-cmu-raster', - 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', - 'rdf' => 'application/rdf+xml', - 'rdz' => 'application/vnd.data-vision.rdz', - 'rep' => 'application/vnd.businessobjects', - 'res' => 'application/x-dtbresource+xml', - 'rgb' => 'image/x-rgb', - 'rif' => 'application/reginfo+xml', - 'rip' => 'audio/vnd.rip', - 'ris' => 'application/x-research-info-systems', - 'rl' => 'application/resource-lists+xml', - 'rlc' => 'image/vnd.fujixerox.edmics-rlc', - 'rld' => 'application/resource-lists-diff+xml', - 'rm' => 'application/vnd.rn-realmedia', - 'rmi' => 'audio/midi', - 'rmp' => 'audio/x-pn-realaudio-plugin', - 'rms' => 'application/vnd.jcp.javame.midlet-rms', - 'rmvb' => 'application/vnd.rn-realmedia-vbr', - 'rnc' => 'application/relax-ng-compact-syntax', - 'roa' => 'application/rpki-roa', - 'roff' => 'text/troff', - 'rp9' => 'application/vnd.cloanto.rp9', - 'rpss' => 'application/vnd.nokia.radio-presets', - 'rpst' => 'application/vnd.nokia.radio-preset', - 'rq' => 'application/sparql-query', - 'rs' => 'application/rls-services+xml', - 'rsd' => 'application/rsd+xml', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'rtx' => 'text/richtext', - 's' => 'text/x-asm', - 's3m' => 'audio/s3m', - 'saf' => 'application/vnd.yamaha.smaf-audio', - 'sbml' => 'application/sbml+xml', - 'sc' => 'application/vnd.ibm.secure-container', - 'scd' => 'application/x-msschedule', - 'scm' => 'application/vnd.lotus-screencam', - 'scq' => 'application/scvp-cv-request', - 'scs' => 'application/scvp-cv-response', - 'scurl' => 'text/vnd.curl.scurl', - 'sda' => 'application/vnd.stardivision.draw', - 'sdc' => 'application/vnd.stardivision.calc', - 'sdd' => 'application/vnd.stardivision.impress', - 'sdkd' => 'application/vnd.solent.sdkm+xml', - 'sdkm' => 'application/vnd.solent.sdkm+xml', - 'sdp' => 'application/sdp', - 'sdw' => 'application/vnd.stardivision.writer', - 'see' => 'application/vnd.seemail', - 'seed' => 'application/vnd.fdsn.seed', - 'sema' => 'application/vnd.sema', - 'semd' => 'application/vnd.semd', - 'semf' => 'application/vnd.semf', - 'ser' => 'application/java-serialized-object', - 'setpay' => 'application/set-payment-initiation', - 'setreg' => 'application/set-registration-initiation', - 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', - 'sfs' => 'application/vnd.spotfire.sfs', - 'sfv' => 'text/x-sfv', - 'sgi' => 'image/sgi', - 'sgl' => 'application/vnd.stardivision.writer-global', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'sh' => 'application/x-sh', - 'shar' => 'application/x-shar', - 'shf' => 'application/shf+xml', - 'sid' => 'image/x-mrsid-image', - 'sig' => 'application/pgp-signature', - 'sil' => 'audio/silk', - 'silo' => 'model/mesh', - 'sis' => 'application/vnd.symbian.install', - 'sisx' => 'application/vnd.symbian.install', - 'sit' => 'application/x-stuffit', - 'sitx' => 'application/x-stuffitx', - 'skd' => 'application/vnd.koan', - 'skm' => 'application/vnd.koan', - 'skp' => 'application/vnd.koan', - 'skt' => 'application/vnd.koan', - 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'slt' => 'application/vnd.epson.salt', - 'sm' => 'application/vnd.stepmania.stepchart', - 'smf' => 'application/vnd.stardivision.math', - 'smi' => 'application/smil+xml', - 'smil' => 'application/smil+xml', - 'smv' => 'video/x-smv', - 'smzip' => 'application/vnd.stepmania.package', - 'snd' => 'audio/basic', - 'snf' => 'application/x-font-snf', - 'so' => 'application/octet-stream', - 'spc' => 'application/x-pkcs7-certificates', - 'spf' => 'application/vnd.yamaha.smaf-phrase', - 'spl' => 'application/x-futuresplash', - 'spot' => 'text/vnd.in3d.spot', - 'spp' => 'application/scvp-vp-response', - 'spq' => 'application/scvp-vp-request', - 'spx' => 'audio/ogg', - 'sql' => 'application/x-sql', - 'src' => 'application/x-wais-source', - 'srt' => 'application/x-subrip', - 'sru' => 'application/sru+xml', - 'srx' => 'application/sparql-results+xml', - 'ssdl' => 'application/ssdl+xml', - 'sse' => 'application/vnd.kodak-descriptor', - 'ssf' => 'application/vnd.epson.ssf', - 'ssml' => 'application/ssml+xml', - 'st' => 'application/vnd.sailingtracker.track', - 'stc' => 'application/vnd.sun.xml.calc.template', - 'std' => 'application/vnd.sun.xml.draw.template', - 'stf' => 'application/vnd.wt.stf', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'stk' => 'application/hyperstudio', - 'stl' => 'application/vnd.ms-pki.stl', - 'str' => 'application/vnd.pg.format', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sub' => 'text/vnd.dvb.subtitle', - 'sus' => 'application/vnd.sus-calendar', - 'susp' => 'application/vnd.sus-calendar', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'svc' => 'application/vnd.dvb.service', - 'svd' => 'application/vnd.svd', - 'svg' => 'image/svg+xml', - 'svgz' => 'image/svg+xml', - 'swa' => 'application/x-director', - 'swf' => 'application/x-shockwave-flash', - 'swi' => 'application/vnd.aristanetworks.swi', - 'sxc' => 'application/vnd.sun.xml.calc', - 'sxd' => 'application/vnd.sun.xml.draw', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sxm' => 'application/vnd.sun.xml.math', - 'sxw' => 'application/vnd.sun.xml.writer', - 't' => 'text/troff', - 't3' => 'application/x-t3vm-image', - 'taglet' => 'application/vnd.mynfc', - 'tao' => 'application/vnd.tao.intent-module-archive', - 'tar' => 'application/x-tar', - 'tcap' => 'application/vnd.3gpp2.tcap', - 'tcl' => 'application/x-tcl', - 'teacher' => 'application/vnd.smart.teacher', - 'tei' => 'application/tei+xml', - 'teicorpus' => 'application/tei+xml', - 'tex' => 'application/x-tex', - 'texi' => 'application/x-texinfo', - 'texinfo' => 'application/x-texinfo', - 'text' => 'text/plain', - 'tfi' => 'application/thraud+xml', - 'tfm' => 'application/x-tex-tfm', - 'tga' => 'image/x-tga', - 'thmx' => 'application/vnd.ms-officetheme', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'tmo' => 'application/vnd.tmobile-livetv', - 'torrent' => 'application/x-bittorrent', - 'tpl' => 'application/vnd.groove-tool-template', - 'tpt' => 'application/vnd.trid.tpt', - 'tr' => 'text/troff', - 'tra' => 'application/vnd.trueapp', - 'trm' => 'application/x-msterminal', - 'tsd' => 'application/timestamped-data', - 'tsv' => 'text/tab-separated-values', - 'ttc' => 'font/collection', - 'ttf' => 'font/ttf', - 'ttl' => 'text/turtle', - 'twd' => 'application/vnd.simtech-mindmapper', - 'twds' => 'application/vnd.simtech-mindmapper', - 'txd' => 'application/vnd.genomatix.tuxedo', - 'txf' => 'application/vnd.mobius.txf', - 'txt' => 'text/plain', - 'u32' => 'application/x-authorware-bin', - 'udeb' => 'application/x-debian-package', - 'ufd' => 'application/vnd.ufdl', - 'ufdl' => 'application/vnd.ufdl', - 'ulx' => 'application/x-glulx', - 'umj' => 'application/vnd.umajin', - 'unityweb' => 'application/vnd.unity', - 'uoml' => 'application/vnd.uoml+xml', - 'uri' => 'text/uri-list', - 'uris' => 'text/uri-list', - 'urls' => 'text/uri-list', - 'ustar' => 'application/x-ustar', - 'utz' => 'application/vnd.uiq.theme', - 'uu' => 'text/x-uuencode', - 'uva' => 'audio/vnd.dece.audio', - 'uvd' => 'application/vnd.dece.data', - 'uvf' => 'application/vnd.dece.data', - 'uvg' => 'image/vnd.dece.graphic', - 'uvh' => 'video/vnd.dece.hd', - 'uvi' => 'image/vnd.dece.graphic', - 'uvm' => 'video/vnd.dece.mobile', - 'uvp' => 'video/vnd.dece.pd', - 'uvs' => 'video/vnd.dece.sd', - 'uvt' => 'application/vnd.dece.ttml+xml', - 'uvu' => 'video/vnd.uvvu.mp4', - 'uvv' => 'video/vnd.dece.video', - 'uvva' => 'audio/vnd.dece.audio', - 'uvvd' => 'application/vnd.dece.data', - 'uvvf' => 'application/vnd.dece.data', - 'uvvg' => 'image/vnd.dece.graphic', - 'uvvh' => 'video/vnd.dece.hd', - 'uvvi' => 'image/vnd.dece.graphic', - 'uvvm' => 'video/vnd.dece.mobile', - 'uvvp' => 'video/vnd.dece.pd', - 'uvvs' => 'video/vnd.dece.sd', - 'uvvt' => 'application/vnd.dece.ttml+xml', - 'uvvu' => 'video/vnd.uvvu.mp4', - 'uvvv' => 'video/vnd.dece.video', - 'uvvx' => 'application/vnd.dece.unspecified', - 'uvvz' => 'application/vnd.dece.zip', - 'uvx' => 'application/vnd.dece.unspecified', - 'uvz' => 'application/vnd.dece.zip', - 'vcard' => 'text/vcard', - 'vcd' => 'application/x-cdlink', - 'vcf' => 'text/x-vcard', - 'vcg' => 'application/vnd.groove-vcard', - 'vcs' => 'text/x-vcalendar', - 'vcx' => 'application/vnd.vcx', - 'vis' => 'application/vnd.visionary', - 'viv' => 'video/vnd.vivo', - 'vob' => 'video/x-ms-vob', - 'vor' => 'application/vnd.stardivision.writer', - 'vox' => 'application/x-authorware-bin', - 'vrml' => 'model/vrml', - 'vsd' => 'application/vnd.visio', - 'vsf' => 'application/vnd.vsf', - 'vss' => 'application/vnd.visio', - 'vst' => 'application/vnd.visio', - 'vsw' => 'application/vnd.visio', - 'vtu' => 'model/vnd.vtu', - 'vxml' => 'application/voicexml+xml', - 'w3d' => 'application/x-director', - 'wad' => 'application/x-doom', - 'wav' => 'audio/x-wav', - 'wax' => 'audio/x-ms-wax', - 'wbmp' => 'image/vnd.wap.wbmp', - 'wbs' => 'application/vnd.criticaltools.wbs+xml', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wcm' => 'application/vnd.ms-works', - 'wdb' => 'application/vnd.ms-works', - 'wdp' => 'image/vnd.ms-photo', - 'weba' => 'audio/webm', - 'webm' => 'video/webm', - 'webp' => 'image/webp', - 'wg' => 'application/vnd.pmi.widget', - 'wgt' => 'application/widget', - 'wks' => 'application/vnd.ms-works', - 'wm' => 'video/x-ms-wm', - 'wma' => 'audio/x-ms-wma', - 'wmd' => 'application/x-ms-wmd', - 'wmf' => 'application/x-msmetafile', - 'wml' => 'text/vnd.wap.wml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmls' => 'text/vnd.wap.wmlscript', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'wmv' => 'video/x-ms-wmv', - 'wmx' => 'video/x-ms-wmx', - 'wmz' => 'application/x-msmetafile', - 'woff' => 'font/woff', - 'woff2' => 'font/woff2', - 'wpd' => 'application/vnd.wordperfect', - 'wpl' => 'application/vnd.ms-wpl', - 'wps' => 'application/vnd.ms-works', - 'wqd' => 'application/vnd.wqd', - 'wri' => 'application/x-mswrite', - 'wrl' => 'model/vrml', - 'wsdl' => 'application/wsdl+xml', - 'wspolicy' => 'application/wspolicy+xml', - 'wtb' => 'application/vnd.webturbo', - 'wvx' => 'video/x-ms-wvx', - 'x32' => 'application/x-authorware-bin', - 'x3d' => 'model/x3d+xml', - 'x3db' => 'model/x3d+binary', - 'x3dbz' => 'model/x3d+binary', - 'x3dv' => 'model/x3d+vrml', - 'x3dvz' => 'model/x3d+vrml', - 'x3dz' => 'model/x3d+xml', - 'xaml' => 'application/xaml+xml', - 'xap' => 'application/x-silverlight-app', - 'xar' => 'application/vnd.xara', - 'xbap' => 'application/x-ms-xbap', - 'xbd' => 'application/vnd.fujixerox.docuworks.binder', - 'xbm' => 'image/x-xbitmap', - 'xdf' => 'application/xcap-diff+xml', - 'xdm' => 'application/vnd.syncml.dm+xml', - 'xdp' => 'application/vnd.adobe.xdp+xml', - 'xdssc' => 'application/dssc+xml', - 'xdw' => 'application/vnd.fujixerox.docuworks', - 'xenc' => 'application/xenc+xml', - 'xer' => 'application/patch-ops-error+xml', - 'xfdf' => 'application/vnd.adobe.xfdf', - 'xfdl' => 'application/vnd.xfdl', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xhvml' => 'application/xv+xml', - 'xif' => 'image/vnd.xiff', - 'xla' => 'application/vnd.ms-excel', - 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', - 'xlc' => 'application/vnd.ms-excel', - 'xlf' => 'application/x-xliff+xml', - 'xlm' => 'application/vnd.ms-excel', - 'xls' => 'application/vnd.ms-excel', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xlt' => 'application/vnd.ms-excel', - 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlw' => 'application/vnd.ms-excel', - 'xm' => 'audio/xm', - 'xml' => 'application/xml', - 'xo' => 'application/vnd.olpc-sugar', - 'xop' => 'application/xop+xml', - 'xpi' => 'application/x-xpinstall', - 'xpl' => 'application/xproc+xml', - 'xpm' => 'image/x-xpixmap', - 'xpr' => 'application/vnd.is-xpr', - 'xps' => 'application/vnd.ms-xpsdocument', - 'xpw' => 'application/vnd.intercon.formnet', - 'xpx' => 'application/vnd.intercon.formnet', - 'xsl' => 'application/xml', - 'xslt' => 'application/xslt+xml', - 'xsm' => 'application/vnd.syncml+xml', - 'xspf' => 'application/xspf+xml', - 'xul' => 'application/vnd.mozilla.xul+xml', - 'xvm' => 'application/xv+xml', - 'xvml' => 'application/xv+xml', - 'xwd' => 'image/x-xwindowdump', - 'xyz' => 'chemical/x-xyz', - 'xz' => 'application/x-xz', - 'yang' => 'application/yang', - 'yin' => 'application/yin+xml', - 'z1' => 'application/x-zmachine', - 'z2' => 'application/x-zmachine', - 'z3' => 'application/x-zmachine', - 'z4' => 'application/x-zmachine', - 'z5' => 'application/x-zmachine', - 'z6' => 'application/x-zmachine', - 'z7' => 'application/x-zmachine', - 'z8' => 'application/x-zmachine', - 'zaz' => 'application/vnd.zzazz.deck+xml', - 'zip' => 'application/zip', - 'zir' => 'application/vnd.zul', - 'zirz' => 'application/vnd.zul', - 'zmm' => 'application/vnd.handheld-entertainment+xml' - ); - - /** - * Get the mime type based on file extension - * - * @param string $file The file name or path - * - * @return string the mime type on success - * - */ - public static function mimeType($file) - { - /** - * **DISCLAIMER** - * This will just match the file extension to the following - * array. It does not guarantee that the file is TRULY that - * of the extension that this function returns. - * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b - */ - - // get the extension form file - $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION)); - // check if we have the extension listed - if (isset(self::$fileExtensionToMimeType[$extension])) - { - return self::$fileExtensionToMimeType[$extension]; - } - elseif (function_exists('mime_content_type')) - { - return mime_content_type($file); - } - elseif (function_exists('finfo_open')) - { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $file); - finfo_close($finfo); - return $mimetype; - } - return 'application/octet-stream'; - } - - /** - * Get the file extensions - * - * @param string $target The targeted/filter option - * @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used) - * - * @return array All the extensions (targeted & sorted) - * - */ - public static function getFileExtensions($target = null, $sorted = false) - { - // we have some in-house grouping/filters :) - $filters = array( - 'image' => array('image', 'font', 'model'), - 'document' => array('application', 'text', 'chemical', 'message'), - 'media' => array('video', 'audio'), - 'file' => array('image', 'application', 'text', 'video', 'audio'), - 'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference') - ); - // sould we filter - if ($target) - { - // the bucket to get extensions - $fileextensions = array(); - // check if filter exist (if not return empty array) - if (isset($filters[$target])) - { - foreach (self::$fileExtensionToMimeType as $extension => $mimetype) - { - // get the key mime type - $mimearr = explode("/", $mimetype, 2); - // check if this file extension should be added - if (in_array($mimearr[0], $filters[$target])) - { - if ($sorted) - { - if (!isset($fileextensions[$mimearr[0]])) - { - $fileextensions[$mimearr[0]] = array(); - } - $fileextensions[$mimearr[0]][$extension] = $extension; - } - else - { - $fileextensions[$extension] = $extension; - } - } - } - } - return $fileextensions; - } - // we just return all file extensions - return array_keys(self::$fileExtensionToMimeType); - } protected static function getDownloadFileName(&$sermon, $file, $type) { @@ -2217,44 +1117,48 @@ abstract class SermondistributorHelper /** - * Workers to load tasks - * - * @var array - */ - protected static $worker = array(); + * Workers to load tasks + * + * @var array + * @since 3.1 + */ + protected static array $worker = []; /** - * Set a worker dynamic URLs - * - * @var array - */ - protected static $workerURL = array(); + * Set a worker dynamic URLs + * + * @var array + * @since 3.1 + */ + protected static array $workerURL = []; /** - * Set a worker dynamic HEADERs - * - * @var array - */ - protected static $workerHEADER = array(); + * Set a worker dynamic HEADERs + * + * @var array + * @since 3.1 + */ + protected static array $workerHEADER = []; /** - * Curl Error Notice - * - * @var bool - */ - protected static $curlErrorLoaded = false; + * Curl Error Notice + * + * @var bool + * @since 3.1 + */ + protected static bool $curlErrorLoaded = false; /** - * check if a worker has more work - * - * @param string $function The function to target to perform the task - * - * @return bool - * - */ - public static function hasWork(&$function) + * check if a worker has more work + * + * @param string $function The function to target to perform the task + * + * @return bool + * @since 3.1 + */ + public static function hasWork(string $function): bool { - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { return count( (array) self::$worker[$function]); } @@ -2262,18 +1166,18 @@ abstract class SermondistributorHelper } /** - * Set a worker url - * - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * - * @return void - * - */ - public static function setWorkerUrl(&$function, &$url) + * Set a worker url + * + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * + * @return void + * @since 3.1 + */ + public static function setWorkerUrl(string $function, string $url): void { // set the URL if found - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure task function url is up self::$workerURL[$function] = $url; @@ -2281,18 +1185,18 @@ abstract class SermondistributorHelper } /** - * Set a worker headers - * - * @param string $function The function to target to perform the task - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorkerHeaders(&$function, &$headers) + * Set a worker headers + * + * @param string $function The function to target to perform the task + * @param array|null $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorkerHeaders(string $function, ?array $headers): void { // set the Headers if found - if (self::checkArray($headers)) + if (UtilitiesArrayHelper::check($headers)) { // make sure task function headers are set self::$workerHEADER[$function] = $headers; @@ -2300,30 +1204,33 @@ abstract class SermondistributorHelper } /** - * Set a worker that needs to perform a task - * - * @param mixed $data The data to pass to the task - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorker($data, $function, $url = null, $headers = null) + * Set a worker that needs to perform a task + * + * @param mixed $data The data to pass to the task + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * @param array $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorker($data, string $function, ?string $url = null, ?array $headers = null) { // make sure task function is up if (!isset(self::$worker[$function])) { - self::$worker[$function] = array(); + self::$worker[$function] = []; } + // load the task self::$worker[$function][] = self::lock($data); + // set the Headers if found if ($headers && !isset(self::$workerHEADER[$function])) { self::setWorkerHeaders($function, $headers); } + // set the URL if found if ($url && !isset(self::$workerURL[$function])) { @@ -2332,24 +1239,24 @@ abstract class SermondistributorHelper } /** - * Run set Workers - * - * @param string $function The function to target to perform the task - * @param string $perTask The amount of task per worker - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ - public static function runWorker($function, $perTask = 50, $callback = null, $threadSize = 20) + * Run set Workers + * + * @param string $function The function to target to perform the task + * @param string $perTask The amount of task per worker + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ + public static function runWorker(string $function, $perTask = 50, $callback = null, $threadSize = 20): bool { // set task $task = self::lock($function); // build headers $headers = array('VDM-TASK: ' .$task); // build dynamic headers - if (isset(self::$workerHEADER[$function]) && self::checkArray(self::$workerHEADER[$function])) + if (isset(self::$workerHEADER[$function]) && UtilitiesArrayHelper::check(self::$workerHEADER[$function])) { foreach (self::$workerHEADER[$function] as $header) { @@ -2359,7 +1266,7 @@ abstract class SermondistributorHelper // build worker options $options = array(); // make sure worker is up - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { // this load method is for each if (1 == $perTask) @@ -2388,7 +1295,7 @@ abstract class SermondistributorHelper self::$worker[$function] = array(); } // do the execution - if (self::checkArray($options)) + if (UtilitiesArrayHelper::check($options)) { if (isset(self::$workerURL[$function])) { @@ -2396,7 +1303,7 @@ abstract class SermondistributorHelper } else { - $url = JURI::root() . '/index.php?option=com_sermondistributor&task=api.worker'; + $url = Uri::root() . '/index.php?option=com_sermondistributor&task=api.worker'; } return self::curlMultiExec($url, $options, $callback, $threadSize); } @@ -2404,16 +1311,16 @@ abstract class SermondistributorHelper } /** - * Do a multi curl execution of tasks - * - * @param string $url The url of where the task is to be performed - * @param array $_options The array of curl options/headers to set - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ + * Do a multi curl execution of tasks + * + * @param string $url The url of where the task is to be performed + * @param array $_options The array of curl options/headers to set + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ public static function curlMultiExec(&$url, &$_options, $callback = null, $threadSize = 20) { // make sure we have curl available @@ -2422,14 +1329,14 @@ abstract class SermondistributorHelper if (!self::$curlErrorLoaded) { // set the notice - JFactory::getApplication()->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); // load the notice only once self::$curlErrorLoaded = true; } return false; } // make sure we have an url - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure the thread size isn't greater than the # of _options $threadSize = (count($_options) < $threadSize) ? count($_options) : $threadSize; @@ -2503,42 +1410,45 @@ abstract class SermondistributorHelper } /** - * the locker - * - * @var array - **/ - protected static $locker = array(); + * the locker + * + * @var array + * @since 3.1 + */ + protected static array $locker = []; /** - * the dynamic replacement salt - * - * @var array - **/ - protected static $globalSalt = array(); + * the dynamic replacement salt + * + * @var array + * @since 3.1 + */ + protected static array $globalSalt = []; /** - * the timer - * - * @var object - **/ + * the timer + * + * @var object + * @since 3.1 + */ protected static $keytimer; /** - * To Lock string - * - * @param string $string The string/array to lock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url encoding - * - * @return string Encrypted String - * - **/ - public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To Lock string + * + * @param string $string The string/array to lock + * @param string|null $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int|null $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String + * @since 3.1 + */ + public static function lock(string $string, ?string $key = null, int $salt = 2, ?int $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -2562,12 +1472,12 @@ abstract class SermondistributorHelper $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // convert array or object to string - if (self::checkArray($string) || self::checkObject($string)) + if (UtilitiesArrayHelper::check($string) || ObjectHelper::check($string)) { $string = serialize($string); } @@ -2580,21 +1490,21 @@ abstract class SermondistributorHelper } /** - * To un-Lock string - * - * @param string $string The string to unlock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url decoding - * - * @return string Decrypted String - * - **/ - public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String + * @since 3.1 + */ + public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -2618,9 +1528,9 @@ abstract class SermondistributorHelper $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // make sure we have real base64 if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) @@ -2637,24 +1547,25 @@ abstract class SermondistributorHelper $string = unserialize($string); } } + return $string; } /** - * The Salt - * - * @param int $type The type of length the salt should be valid - * @param int $dynamic The dynamic replacement array of salt build string - * - * @return string - * - **/ - public static function salt($type = 1, $dynamic = null) + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string + * @since 3.1 + */ + public static function salt(int $type = 1, $dynamic = null): string { // get dynamic replacement salt $dynamic = self::getDynamicSalt($dynamic); // get the key timer - if (!self::checkObject(self::$keytimer)) + if (!ObjectHelper::check(self::$keytimer)) { // load the date time object self::$keytimer = new DateTime; @@ -2684,7 +1595,7 @@ abstract class SermondistributorHelper $format = 'Y-m-d \o\n H:' . self::periodFix(self::$keytimer->format('i')); } // get key - if (self::checkArray($dynamic)) + if (UtilitiesArrayHelper::check($dynamic)) { return md5(str_replace(array_keys($dynamic), array_values($dynamic), self::$keytimer->format($format) . ' @ VDM.I0')); } @@ -2692,35 +1603,37 @@ abstract class SermondistributorHelper } /** - * The function to insure the salt is valid within the given period (third try) - * - * @param int $main The main number - */ - protected static function periodFix($main) + * The function to insure the salt is valid within the given period (third try) + * + * @param int $main The main number + * @since 3.1 + */ + protected static function periodFix(int $main): int { return round($main / 3) * 3; } /** - * Check if a string is serialized - * - * @param string $string - * - * @return Boolean - * - */ - public static function is_serial($string) + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * @since 3.1 + */ + public static function is_serial(string $string): bool { return (@unserialize($string) !== false); } /** - * Get dynamic replacement salt - */ + * Get dynamic replacement salt + * @since 3.1 + */ public static function getDynamicSalt($dynamic = null) { // load global if not manually set - if (!self::checkArray($dynamic)) + if (!UtilitiesArrayHelper::check($dynamic)) { return self::getGlobalSalt(); } @@ -2732,8 +1645,9 @@ abstract class SermondistributorHelper } /** - * The random or dynamic secret salt - */ + * The random or dynamic secret salt + * @since 3.1 + */ public static function getSecretSalt($string = null, $size = 9) { // set the string @@ -2743,7 +1657,7 @@ abstract class SermondistributorHelper $string = self::randomkey($size); } // convert string to array - $string = self::safeString($string); + $string = UtilitiesStringHelper::safe($string); // convert string to array $array = str_split($string); // insure only unique values are used @@ -2755,24 +1669,25 @@ abstract class SermondistributorHelper } /** - * Get global replacement salt - */ + * Get global replacement salt + * @since 3.1 + */ public static function getGlobalSalt() { // load from memory if found - if (!self::checkArray(self::$globalSalt)) + if (!UtilitiesArrayHelper::check(self::$globalSalt)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_sermondistributor'); + self::$params = ComponentHelper::getParams('com_sermondistributor'); } // check if we have a global dynamic replacement array available (format --> ' 1->!,3->E,4->A') $tmp = self::$params->get('dynamic_salt', null); - if (self::checkString($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) + if (UtilitiesStringHelper::check($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) { $salt = array_map('trim', (array) explode(',', $tmp)); - if (self::checkArray($salt )) + if (UtilitiesArrayHelper::check($salt )) { foreach($salt as $replace) { @@ -2786,7 +1701,7 @@ abstract class SermondistributorHelper } } // return global if found - if (self::checkArray(self::$globalSalt)) + if (UtilitiesArrayHelper::check(self::$globalSalt)) { return self::$globalSalt; } @@ -2795,8 +1710,9 @@ abstract class SermondistributorHelper } /** - * Close public protocol - */ + * Close public protocol + * @since 3.1 + */ public static function closePublicProtocol($id, $public) { // get secret salt @@ -2822,8 +1738,9 @@ abstract class SermondistributorHelper } /** - * Open public protocol - */ + * Open public protocol + * @since 3.1 + */ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) { // get secret salt @@ -2855,7 +1772,7 @@ abstract class SermondistributorHelper if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = UtilitiesStringHelper::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -2877,7 +1794,7 @@ abstract class SermondistributorHelper /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -2886,9 +1803,9 @@ abstract class SermondistributorHelper public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -2899,18 +1816,18 @@ abstract class SermondistributorHelper public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_sermondistributor'); + $params = ComponentHelper::getParams('com_sermondistributor'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -2924,8 +1841,8 @@ abstract class SermondistributorHelper $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -2936,9 +1853,9 @@ abstract class SermondistributorHelper **/ public static function getHelpUrl($view) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $groups = $user->get('groups'); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); $query->from('#__sermondistributor_help_document AS a'); @@ -2950,7 +1867,7 @@ abstract class SermondistributorHelper if($db->getNumRows()) { $helps = $db->loadObjectList(); - if (self::checkArray($helps)) + if (UtilitiesArrayHelper::check($helps)) { foreach ($helps as $nr => $help) { @@ -2991,7 +1908,7 @@ abstract class SermondistributorHelper **/ protected static function loadArticleLink($id) { - return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; + return Uri::root() . 'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; } /** @@ -2999,8 +1916,8 @@ abstract class SermondistributorHelper **/ protected static function loadHelpTextLink($id) { - $token = JSession::getFormToken(); - return 'index.php?option=com_sermondistributor&task=help.getText&id=' . (int) $id . '&token=' . $token; + $token = Session::getFormToken(); + return 'index.php?option=com_sermondistributor&task=help.getText&id=' . (int) $id . '&' . $token . '=1'; } /** @@ -3009,42 +1926,42 @@ abstract class SermondistributorHelper public static function addSubmenu($submenu) { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // load the submenus to sidebar - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_DASHBOARD'), 'index.php?option=com_sermondistributor&view=sermondistributor', $submenu === 'sermondistributor'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_DASHBOARD'), 'index.php?option=com_sermondistributor&view=sermondistributor', $submenu === 'sermondistributor'); if ($user->authorise('preacher.access', 'com_sermondistributor') && $user->authorise('preacher.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_PREACHERS'), 'index.php?option=com_sermondistributor&view=preachers', $submenu === 'preachers'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_PREACHERS'), 'index.php?option=com_sermondistributor&view=preachers', $submenu === 'preachers'); } if ($user->authorise('sermon.access', 'com_sermondistributor') && $user->authorise('sermon.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERMONS'), 'index.php?option=com_sermondistributor&view=sermons', $submenu === 'sermons'); - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermon', $submenu === 'categories.sermon'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERMONS'), 'index.php?option=com_sermondistributor&view=sermons', $submenu === 'sermons'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermon', $submenu === 'categories.sermon'); } if ($user->authorise('series.access', 'com_sermondistributor') && $user->authorise('series.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERIES_LIST'), 'index.php?option=com_sermondistributor&view=series_list', $submenu === 'series_list'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERIES_LIST'), 'index.php?option=com_sermondistributor&view=series_list', $submenu === 'series_list'); } if ($user->authorise('statistic.access', 'com_sermondistributor') && $user->authorise('statistic.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_STATISTICS'), 'index.php?option=com_sermondistributor&view=statistics', $submenu === 'statistics'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_STATISTICS'), 'index.php?option=com_sermondistributor&view=statistics', $submenu === 'statistics'); } if ($user->authorise('external_source.access', 'com_sermondistributor') && $user->authorise('external_source.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES'), 'index.php?option=com_sermondistributor&view=external_sources', $submenu === 'external_sources'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_EXTERNAL_SOURCES'), 'index.php?option=com_sermondistributor&view=external_sources', $submenu === 'external_sources'); } // Access control (manual_updater.access && manual_updater.submenu). if ($user->authorise('manual_updater.access', 'com_sermondistributor') && $user->authorise('manual_updater.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_MANUAL_UPDATER'), 'index.php?option=com_sermondistributor&view=manual_updater', $submenu === 'manual_updater'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_MANUAL_UPDATER'), 'index.php?option=com_sermondistributor&view=manual_updater', $submenu === 'manual_updater'); } if ($user->authorise('local_listing.access', 'com_sermondistributor') && $user->authorise('local_listing.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_LOCAL_LISTINGS'), 'index.php?option=com_sermondistributor&view=local_listings', $submenu === 'local_listings'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_LOCAL_LISTINGS'), 'index.php?option=com_sermondistributor&view=local_listings', $submenu === 'local_listings'); } if ($user->authorise('help_document.access', 'com_sermondistributor') && $user->authorise('help_document.submenu', 'com_sermondistributor')) { - JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_sermondistributor&view=help_documents', $submenu === 'help_documents'); + JHtmlSidebar::addEntry(Text::_('COM_SERMONDISTRIBUTOR_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_sermondistributor&view=help_documents', $submenu === 'help_documents'); } } @@ -3118,7 +2035,7 @@ abstract class SermondistributorHelper if (strpos($content,'class="uk-') !== false) { // reset - $temp = array(); + $temp = []; foreach (self::$uk_components as $looking => $add) { if (strpos($content,$looking) !== false) @@ -3132,10 +2049,10 @@ abstract class SermondistributorHelper self::$uikit = true; } // sorter - if (self::checkArray($temp)) + if (UtilitiesArrayHelper::check($temp)) { // merger - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { $newTemp = array_merge($temp,$classes); $temp = array_unique($newTemp); @@ -3143,7 +2060,7 @@ abstract class SermondistributorHelper return $temp; } } - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { return $classes; } @@ -3156,11 +2073,11 @@ abstract class SermondistributorHelper public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Vast Development Method', $description = null, $category = null,$keywords = null, $modified = null) { // set the user - $user = JFactory::getUser(); + $user = Factory::getUser(); // set fileName if not set if (!$fileName) { - $fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y'); + $fileName = 'exported_'.Factory::getDate()->format('jS_F_Y'); } // set modified if not set if (!$modified) @@ -3232,7 +2149,7 @@ abstract class SermondistributorHelper )); // Add some data - if (($size = self::checkArray($rows)) !== false) + if (($size = UtilitiesArrayHelper::check($rows)) !== false) { $i = 1; @@ -3315,7 +2232,7 @@ abstract class SermondistributorHelper // make sure we have the composer classes loaded self::composerAutoload('phpspreadsheet'); // get session object - $session = JFactory::getSession(); + $session = Factory::getSession(); $package = $session->get('package', null); $package = json_decode($package, true); // set the headers @@ -3332,7 +2249,7 @@ abstract class SermondistributorHelper $excelReader->setReadDataOnly(true); // load the rows (only first three) $excelObj = $excelReader->load($package['dir']); - $headers = array(); + $headers = []; foreach ($excelObj->getActiveSheet()->getRowIterator() as $row) { if($row->getRowIndex() == 1) @@ -3370,7 +2287,7 @@ abstract class SermondistributorHelper } /** - * Get a Variable + * Get a Variable * * @param string $table The table from which to get the variable * @param string $where The value where @@ -3380,46 +2297,18 @@ abstract class SermondistributorHelper * @param string $main The component in which the table is found * * @return mix string/int/float - * + * @deprecated 3.3 Use GetHelper::var(...); */ public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'sermondistributor') { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; + return GetHelper::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); } /** @@ -3434,110 +2323,38 @@ abstract class SermondistributorHelper * @param bool $unique The switch to return a unique array * * @return array - * + * @deprecated 3.3 Use GetHelper::vars(...); */ public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'sermondistributor', $unique = true) { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; + return GetHelper::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); } + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use JsonHelper::string(...); + */ public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; + return JsonHelper::string( + $value, + $sperator, + $table, + $id, + $name + ); } public static function isPublished($id,$type) @@ -3546,7 +2363,7 @@ abstract class SermondistributorHelper { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__sermondistributor_'.$type.' AS a'); @@ -3564,7 +2381,7 @@ abstract class SermondistributorHelper public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -3573,7 +2390,7 @@ abstract class SermondistributorHelper $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -3589,39 +2406,39 @@ abstract class SermondistributorHelper * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!ObjectHelper::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = UtilitiesStringHelper::safe($view); + if (UtilitiesStringHelper::check($views)) { - $views = self::safeString($views); - } + $views = UtilitiesStringHelper::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (ObjectHelper::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = GetHelper::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -3630,12 +2447,12 @@ abstract class SermondistributorHelper if ($target) { // convert to an array - if (self::checkString($target)) + if (UtilitiesStringHelper::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (UtilitiesArrayHelper::check($target)) { $checkTarget = true; } @@ -3656,7 +2473,7 @@ abstract class SermondistributorHelper // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (ObjectHelper::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -3689,7 +2506,7 @@ abstract class SermondistributorHelper } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (UtilitiesStringHelper::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -3761,7 +2578,7 @@ abstract class SermondistributorHelper * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -3780,22 +2597,22 @@ abstract class SermondistributorHelper /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Sermondistributor', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Sermondistributor', $config = []) { // fix the name - $name = self::safeString($name); + $name = UtilitiesStringHelper::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + if (!isset($config['table_path']) || !UtilitiesStringHelper::check($config['table_path'])) { // This is the JCB default path to tables in Joomla 3.x $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -3830,14 +2647,14 @@ abstract class SermondistributorHelper */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_sermondistributor'); - + $parentId = $parent->id; $name = 'com_sermondistributor.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -3861,14 +2678,14 @@ abstract class SermondistributorHelper $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_sermondistributor', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -3881,7 +2698,7 @@ abstract class SermondistributorHelper $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__sermondistributor_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__sermondistributor_'.$table, $object, 'id'); } } return false; @@ -3898,7 +2715,7 @@ abstract class SermondistributorHelper if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -3913,8 +2730,8 @@ abstract class SermondistributorHelper } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -3929,7 +2746,7 @@ abstract class SermondistributorHelper elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -3937,8 +2754,8 @@ abstract class SermondistributorHelper { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -3952,35 +2769,12 @@ abstract class SermondistributorHelper * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + FormHelper::append($xml, $node); } /** @@ -3989,16 +2783,12 @@ abstract class SermondistributorHelper * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + FormHelper::comment($xml, $comment); } /** @@ -4008,14 +2798,11 @@ abstract class SermondistributorHelper * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use FormHelper::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + FormHelper::attributes($xml, $attributes); } /** @@ -4025,16 +2812,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use FormHelper::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + FormHelper::options($xml, $options); } /** @@ -4045,28 +2827,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return FormHelper::field($attributes, $default, $options); } /** @@ -4076,27 +2841,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return FormHelper::xml($attributes, $options); } /** @@ -4120,94 +2869,69 @@ abstract class SermondistributorHelper // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? UtilitiesStringHelper::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? UtilitiesStringHelper::safe(UtilitiesStringHelper::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? UtilitiesStringHelper::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? UtilitiesStringHelper::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return FormHelper::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success + * @deprecated 3.3 Use JsonHelper::check($string); */ public static function checkJson($string) { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; + return JsonHelper::check($string); } /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success + * @deprecated 3.3 Use ObjectHelper::check($object); */ public static function checkObject($object) { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; + return ObjectHelper::check($object); } /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); */ public static function checkArray($array, $removeEmptyString = false) { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; + return UtilitiesArrayHelper::check($array, $removeEmptyString); } /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success + * @deprecated 3.3 Use UtilitiesStringHelper::check($string); */ public static function checkString($string) { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; + return UtilitiesStringHelper::check($string); } /** @@ -4219,8 +2943,8 @@ abstract class SermondistributorHelper public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -4238,25 +2962,14 @@ abstract class SermondistributorHelper /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); */ public static function mergeArrays($arrays) { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; + return UtilitiesArrayHelper::merge($arrays); } // typo sorry! @@ -4268,310 +2981,101 @@ abstract class SermondistributorHelper /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); */ public static function shorten($string, $length = 40, $addTip = true) { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; + return UtilitiesStringHelper::shorten($string, $length, $addTip); } /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); */ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; + return UtilitiesStringHelper::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); } + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); + */ public static function transliterate($string) { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_sermondistributor')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); + return UtilitiesStringHelper::transliterate($string); } + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::html(...); + */ public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } + return UtilitiesStringHelper::html( + $var, + $charset, + $shorten, + $length + ); } + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); + */ public static function replaceNumbers($string) { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; + return UtilitiesStringHelper::numbers($string); } /** * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::number($x); */ public static function numberToString($x) { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; + return UtilitiesStringHelper::number($x); } /** * Random Key * * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::random($size); */ public static function randomkey($size) { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); + return UtilitiesStringHelper::random($size); } /** @@ -4586,12 +3090,12 @@ abstract class SermondistributorHelper public static function getCryptKey($type, $default = false) { // Get the global params - $params = JComponentHelper::getParams('com_sermondistributor', true); + $params = ComponentHelper::getParams('com_sermondistributor', true); // Basic Encryption Type if ('basic' === $type) { $basic_key = $params->get('basic_key', $default); - if (self::checkString($basic_key)) + if (UtilitiesStringHelper::check($basic_key)) { return $basic_key; } @@ -4600,4 +3104,3 @@ abstract class SermondistributorHelper return $default; } } - diff --git a/admin/language/en-GB/en-GB.com_sermondistributor.ini b/admin/language/en-GB/en-GB.com_sermondistributor.ini index 85b198d3..9ec1008f 100644 --- a/admin/language/en-GB/en-GB.com_sermondistributor.ini +++ b/admin/language/en-GB/en-GB.com_sermondistributor.ini @@ -1,7 +1,7 @@ COM_SERMONDISTRIBUTOR="Sermon Distributor" COM_SERMONDISTRIBUTOR_ADD_THE_STRONGAPP_GENERATED_ACCESS_TOKENSTRONG_HERE="Add the App Generated access token here." COM_SERMONDISTRIBUTOR_ADD_TOKEN_HERE="ADD TOKEN HERE!" -COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." +COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER="All is good, please check again later" COM_SERMONDISTRIBUTOR_ALWAYS_BETTER_TO_ADD_THE_FILES_TO_EXTERNAL_SOURCE_AND_LET_THE_SYSTEM_CREATE_THE_SERMON_FOR_YOU_PLEASE_READ_INSTRUCTIONS_BELOW_CAREFULLY="Always better to add the files to External Source and let the system create the sermon for you. Please read instructions below carefully." COM_SERMONDISTRIBUTOR_ARCHIVED="Archived" COM_SERMONDISTRIBUTOR_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS="Are you sure you want to delete? Confirming will permanently delete the selected item(s)!" @@ -138,6 +138,10 @@ COM_SERMONDISTRIBUTOR_CONFIG_GREEN="Green" COM_SERMONDISTRIBUTOR_CONFIG_GRID="Grid" COM_SERMONDISTRIBUTOR_CONFIG_HTML_5_BASIC="HTML 5 (basic)" COM_SERMONDISTRIBUTOR_CONFIG_JPLAYER="jPlayer" +COM_SERMONDISTRIBUTOR_CONFIG_JQUERY_LOAD="Load jQuery" +COM_SERMONDISTRIBUTOR_CONFIG_JQUERY_LOAD_DESC="Would you like to load the Joomla jQuery Framework?" +COM_SERMONDISTRIBUTOR_CONFIG_JQUERY_LOAD_LABEL="Load Joomla jQuery" +COM_SERMONDISTRIBUTOR_CONFIG_JQUERY_REMOVE="Remove jQuery" COM_SERMONDISTRIBUTOR_CONFIG_LEGACY="Legacy" COM_SERMONDISTRIBUTOR_CONFIG_LINES="Lines" COM_SERMONDISTRIBUTOR_CONFIG_LIST="List" @@ -315,7 +319,7 @@ COM_SERMONDISTRIBUTOR_CONFIG_SPACED="Spaced" COM_SERMONDISTRIBUTOR_CONFIG_STRIPED="Striped" COM_SERMONDISTRIBUTOR_CONFIG_TABLE="Table" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT="Uikit" -COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
Uikit is a lightweight and modular front-end frameworkfor developing fast and powerful web interfaces. For more info visit version 2 or version 3" +COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
Uikit is a lightweight and modular front-end frameworkfor developing fast and powerful web interfaces. For more info visit version 2 or version 3" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LABEL="Uikit2 and Uikit3 Settings" COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LOAD_DESC="Set the uikit loading option." COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LOAD_LABEL="Loading Options" @@ -368,7 +372,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_ACCESS_DESC="Allows the users in this gro COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS="Batch process the selected External Sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_TIP="All changes will be applied to all selected External Sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE="External Sources Batch Use" -COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE="External Sources Create" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE_DESC="Allows the users in this group to create create external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_ADD="External Sources Dashboard Add" @@ -388,7 +392,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OWN_DESC="Allows the users in this g COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE="External Sources Edit State" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE_DESC="Allows the users in this group to update the state of the external source" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION="External Sources Edit Version" -COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT="External Sources Export" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT_DESC="Allows the users in this group to export export external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_IMPORT="External Sources Import" @@ -444,6 +448,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOXOPTIONS_LABEL="Options" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT="Editing the External Source" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS="Another External Source has the same alias." +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed External Source has the same alias ." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_DESCRIPTION="Only one option at this time" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL="External Sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES_DESCRIPTION="Select the file types you would like to use from this external sources." @@ -606,7 +611,7 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_OPTIONS="Batch process the selected Help Documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_TIP="All changes will be applied to all selected Help Documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" -COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents" +COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" @@ -620,7 +625,7 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this gro COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version" -COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents" +COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT="Help Documents Export" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_IMPORT="Help Documents Import" @@ -661,6 +666,7 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_CREATED_DATE_LABEL="Created Date" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_DETAILS="Details" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT="Editing the Help Document" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS="Another Help Document has the same alias." +COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Help Document has the same alias ." COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_GROUPS_DESCRIPTION="Select a group/s" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_GROUPS_LABEL="Group/s" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ID="Id" @@ -759,7 +765,7 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_ACCESS_DESC="Allows the users in this group COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_OPTIONS="Batch process the selected Local Listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_TIP="All changes will be applied to all selected Local Listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE="Local Listings Batch Use" -COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE="Local Listings Create" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE_DESC="Allows the users in this group to create create local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DASHBOARD_LIST="Local Listings Dashboard List" @@ -789,7 +795,7 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_STATE_DESC="Allows the users in this g COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL="Local Listings Edit Url" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL_DESC="Allows the users in this group to edit url of local listing" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION="Local Listings Edit Version" -COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT="Local Listings Export" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT_DESC="Allows the users in this group to export export local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_IMPORT="Local Listings Import" @@ -825,6 +831,7 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DETAILS="Details" COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EDIT="Editing the Local Listing" COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS="Another Local Listing has the same alias." +COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Local Listing has the same alias ." COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_DESCRIPTION="The external source of this listing" COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL="External Source" COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ID="Id" @@ -888,6 +895,7 @@ COM_SERMONDISTRIBUTOR_OPENED_THIS="opened this" COM_SERMONDISTRIBUTOR_OPEN_ON_GITHUB="Open on Github" COM_SERMONDISTRIBUTOR_OUT_OF_DATE="Out of date" COM_SERMONDISTRIBUTOR_PLEASE_ADD_FILES_TO_S="Please add files to (%s)" +COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATER="Please check again later" COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATTER="Please check again latter." COM_SERMONDISTRIBUTOR_PREACHER="Preacher" COM_SERMONDISTRIBUTOR_PREACHERS="Preachers" @@ -898,7 +906,7 @@ COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_SITE_DESC="Allows the users in this group COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_OPTIONS="Batch process the selected Preachers" COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_TIP="All changes will be applied to all selected Preachers" COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE="Preachers Batch Use" -COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch preachers" +COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch preachers" COM_SERMONDISTRIBUTOR_PREACHERS_CREATE="Preachers Create" COM_SERMONDISTRIBUTOR_PREACHERS_CREATE_DESC="Allows the users in this group to create create preachers" COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_ADD="Preachers Dashboard Add" @@ -918,7 +926,7 @@ COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN_DESC="Allows the users in this group to COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE="Preachers Edit State" COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the preacher" COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION="Preachers Edit Version" -COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version preachers" +COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version preachers" COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT="Preachers Export" COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT_DESC="Allows the users in this group to export export preachers" COM_SERMONDISTRIBUTOR_PREACHERS_IMPORT="Preachers Import" @@ -961,6 +969,7 @@ COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_HINT="demo@example.com" COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_LABEL="Email
not required" COM_SERMONDISTRIBUTOR_PREACHER_EMAIL_MESSAGE="Error! Please add email address here." COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS="Another Preacher has the same alias." +COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Preacher has the same alias ." COM_SERMONDISTRIBUTOR_PREACHER_ICON_DESCRIPTION="Must be 358px x 358px" COM_SERMONDISTRIBUTOR_PREACHER_ICON_LABEL="Icon" COM_SERMONDISTRIBUTOR_PREACHER_ID="Id" @@ -1011,6 +1020,7 @@ COM_SERMONDISTRIBUTOR_SERIES_DESCRIPTION_LABEL="Description" COM_SERMONDISTRIBUTOR_SERIES_DETAILS="Details" COM_SERMONDISTRIBUTOR_SERIES_EDIT="Editing the Series" COM_SERMONDISTRIBUTOR_SERIES_ERROR_UNIQUE_ALIAS="Another Series has the same alias." +COM_SERMONDISTRIBUTOR_SERIES_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Series has the same alias ." COM_SERMONDISTRIBUTOR_SERIES_ICON_DESCRIPTION="Must be 358px x 358px" COM_SERMONDISTRIBUTOR_SERIES_ICON_LABEL="Icon" COM_SERMONDISTRIBUTOR_SERIES_ID="Id" @@ -1022,7 +1032,7 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_SITE_DESC="Allows the users in this gro COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_OPTIONS="Batch process the selected Series List" COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_TIP="All changes will be applied to all selected Series List" COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE="Series List Batch Use" -COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch series list" +COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE="Series List Create" COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE_DESC="Allows the users in this group to create create series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_ADD="Series List Dashboard Add" @@ -1042,7 +1052,7 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN_DESC="Allows the users in this group COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE="Series List Edit State" COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE_DESC="Allows the users in this group to update the state of the series" COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION="Series List Edit Version" -COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC="Allows users in this group to edit versions of version series list" +COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT="Series List Export" COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT_DESC="Allows the users in this group to export export series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_IMPORT="Series List Import" @@ -1096,7 +1106,7 @@ COM_SERMONDISTRIBUTOR_SERMONS_ACCESS_DESC="Allows the users in this group to acc COM_SERMONDISTRIBUTOR_SERMONS_BATCH_OPTIONS="Batch process the selected Sermons" COM_SERMONDISTRIBUTOR_SERMONS_BATCH_TIP="All changes will be applied to all selected Sermons" COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE="Sermons Batch Use" -COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch sermons" +COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch sermons" COM_SERMONDISTRIBUTOR_SERMONS_CREATE="Sermons Create" COM_SERMONDISTRIBUTOR_SERMONS_CREATE_DESC="Allows the users in this group to create create sermons" COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_ADD="Sermons Dashboard Add" @@ -1116,7 +1126,7 @@ COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN_DESC="Allows the users in this group to e COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE="Sermons Edit State" COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the sermon" COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION="Sermons Edit Version" -COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version sermons" +COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version sermons" COM_SERMONDISTRIBUTOR_SERMONS_EXPORT="Sermons Export" COM_SERMONDISTRIBUTOR_SERMONS_EXPORT_DESC="Allows the users in this group to export export sermons" COM_SERMONDISTRIBUTOR_SERMONS_IMPORT="Sermons Import" @@ -1162,6 +1172,7 @@ COM_SERMONDISTRIBUTOR_SERMON_DYNAMIC_AUTOMATIC_BUILD="Dynamic Automatic Build" COM_SERMONDISTRIBUTOR_SERMON_EDIT="Editing the Sermon" COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED="Encrypted" COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS="Another Sermon has the same alias." +COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Sermon has the same alias ." COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE="External Source" COM_SERMONDISTRIBUTOR_SERMON_FILES="Files" COM_SERMONDISTRIBUTOR_SERMON_ICON_DESCRIPTION="Must be 358px x 358px" @@ -1234,7 +1245,7 @@ COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS_DESC="Allows the users in this group to COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_OPTIONS="Batch process the selected Statistics" COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_TIP="All changes will be applied to all selected Statistics" COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE="Statistics Batch Use" -COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch statistics" +COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch statistics" COM_SERMONDISTRIBUTOR_STATISTICS_CREATE="Statistics Create" COM_SERMONDISTRIBUTOR_STATISTICS_CREATE_DESC="Allows the users in this group to create create statistics" COM_SERMONDISTRIBUTOR_STATISTICS_DASHBOARD_LIST="Statistics Dashboard List" @@ -1252,7 +1263,7 @@ COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN_DESC="Allows the users in this group t COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE="Statistics Edit State" COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE_DESC="Allows the users in this group to update the state of the statistic" COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION="Statistics Edit Version" -COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version statistics" +COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version statistics" COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT="Statistics Export" COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT_DESC="Allows the users in this group to export export statistics" COM_SERMONDISTRIBUTOR_STATISTICS_IMPORT="Statistics Import" @@ -1289,6 +1300,7 @@ COM_SERMONDISTRIBUTOR_STATISTIC_CREATED_DATE_LABEL="Created Date" COM_SERMONDISTRIBUTOR_STATISTIC_DETAILS="Details" COM_SERMONDISTRIBUTOR_STATISTIC_EDIT="Editing the Statistic" COM_SERMONDISTRIBUTOR_STATISTIC_ERROR_UNIQUE_ALIAS="Another Statistic has the same alias." +COM_SERMONDISTRIBUTOR_STATISTIC_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Statistic has the same alias ." COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_DESCRIPTION="Enter the file name." COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_HINT="the_file_name.mp3" COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL="File Name" diff --git a/admin/language/en-GB/en-GB.com_sermondistributor.sys.ini b/admin/language/en-GB/en-GB.com_sermondistributor.sys.ini index 5410fe93..910b2b74 100644 --- a/admin/language/en-GB/en-GB.com_sermondistributor.sys.ini +++ b/admin/language/en-GB/en-GB.com_sermondistributor.sys.ini @@ -15,7 +15,7 @@ COM_SERMONDISTRIBUTOR_EXPORT_DATA_DESC="Allows users in this group to export dat COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_ACCESS="External Sources Access" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_ACCESS_DESC="Allows the users in this group to access access external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE="External Sources Batch Use" -COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE="External Sources Create" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_CREATE_DESC="Allows the users in this group to create create external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_DASHBOARD_ADD="External Sources Dashboard Add" @@ -35,7 +35,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_OWN_DESC="Allows the users in this g COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE="External Sources Edit State" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_STATE_DESC="Allows the users in this group to update the state of the external source" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION="External Sources Edit Version" -COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version external sources" +COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT="External Sources Export" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_EXPORT_DESC="Allows the users in this group to export export external sources" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_IMPORT="External Sources Import" @@ -49,7 +49,7 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_RESET_UPDATE_STATUS_BUTTON_ACCESS_DESC="Al COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS="Help Documents Access" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" -COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents" +COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" @@ -63,7 +63,7 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this gro COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version" -COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents" +COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT="Help Documents Export" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_IMPORT="Help Documents Import" @@ -75,7 +75,7 @@ COM_SERMONDISTRIBUTOR_IMPORT_DATA_DESC="Allows users in this group to import dat COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_ACCESS="Local Listings Access" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_ACCESS_DESC="Allows the users in this group to access access local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE="Local Listings Batch Use" -COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE="Local Listings Create" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_CREATE_DESC="Allows the users in this group to create create local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_DASHBOARD_LIST="Local Listings Dashboard List" @@ -105,7 +105,7 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_STATE_DESC="Allows the users in this g COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL="Local Listings Edit Url" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_URL_DESC="Allows the users in this group to edit url of local listing" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION="Local Listings Edit Version" -COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version local listings" +COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT="Local Listings Export" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_EXPORT_DESC="Allows the users in this group to export export local listings" COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_IMPORT="Local Listings Import" @@ -147,7 +147,7 @@ COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_DESC="Allows the users in this group to a COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_SITE="Preachers (Site) Access" COM_SERMONDISTRIBUTOR_PREACHERS_ACCESS_SITE_DESC="Allows the users in this group to access site preachers." COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE="Preachers Batch Use" -COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch preachers" +COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch preachers" COM_SERMONDISTRIBUTOR_PREACHERS_CREATE="Preachers Create" COM_SERMONDISTRIBUTOR_PREACHERS_CREATE_DESC="Allows the users in this group to create create preachers" COM_SERMONDISTRIBUTOR_PREACHERS_DASHBOARD_ADD="Preachers Dashboard Add" @@ -167,7 +167,7 @@ COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_OWN_DESC="Allows the users in this group to COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE="Preachers Edit State" COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the preacher" COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION="Preachers Edit Version" -COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version preachers" +COM_SERMONDISTRIBUTOR_PREACHERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version preachers" COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT="Preachers Export" COM_SERMONDISTRIBUTOR_PREACHERS_EXPORT_DESC="Allows the users in this group to export export preachers" COM_SERMONDISTRIBUTOR_PREACHERS_IMPORT="Preachers Import" @@ -183,7 +183,7 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_DESC="Allows the users in this group to COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_SITE="Series List (Site) Access" COM_SERMONDISTRIBUTOR_SERIES_LIST_ACCESS_SITE_DESC="Allows the users in this group to access site series list." COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE="Series List Batch Use" -COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch series list" +COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE="Series List Create" COM_SERMONDISTRIBUTOR_SERIES_LIST_CREATE_DESC="Allows the users in this group to create create series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_DASHBOARD_ADD="Series List Dashboard Add" @@ -203,7 +203,7 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_OWN_DESC="Allows the users in this group COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE="Series List Edit State" COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_STATE_DESC="Allows the users in this group to update the state of the series" COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION="Series List Edit Version" -COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC="Allows users in this group to edit versions of version series list" +COM_SERMONDISTRIBUTOR_SERIES_LIST_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT="Series List Export" COM_SERMONDISTRIBUTOR_SERIES_LIST_EXPORT_DESC="Allows the users in this group to export export series list" COM_SERMONDISTRIBUTOR_SERIES_LIST_IMPORT="Series List Import" @@ -213,7 +213,7 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_SUBMENU_DESC="Allows the users in this group t COM_SERMONDISTRIBUTOR_SERMONS_ACCESS="Sermons Access" COM_SERMONDISTRIBUTOR_SERMONS_ACCESS_DESC="Allows the users in this group to access access sermons" COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE="Sermons Batch Use" -COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch sermons" +COM_SERMONDISTRIBUTOR_SERMONS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch sermons" COM_SERMONDISTRIBUTOR_SERMONS_CREATE="Sermons Create" COM_SERMONDISTRIBUTOR_SERMONS_CREATE_DESC="Allows the users in this group to create create sermons" COM_SERMONDISTRIBUTOR_SERMONS_DASHBOARD_ADD="Sermons Dashboard Add" @@ -233,7 +233,7 @@ COM_SERMONDISTRIBUTOR_SERMONS_EDIT_OWN_DESC="Allows the users in this group to e COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE="Sermons Edit State" COM_SERMONDISTRIBUTOR_SERMONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the sermon" COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION="Sermons Edit Version" -COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version sermons" +COM_SERMONDISTRIBUTOR_SERMONS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version sermons" COM_SERMONDISTRIBUTOR_SERMONS_EXPORT="Sermons Export" COM_SERMONDISTRIBUTOR_SERMONS_EXPORT_DESC="Allows the users in this group to export export sermons" COM_SERMONDISTRIBUTOR_SERMONS_IMPORT="Sermons Import" @@ -245,7 +245,7 @@ COM_SERMONDISTRIBUTOR_SERMON_ACCESS_SITE_DESC="Allows the users in this group to COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS="Statistics Access" COM_SERMONDISTRIBUTOR_STATISTICS_ACCESS_DESC="Allows the users in this group to access access statistics" COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE="Statistics Batch Use" -COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch statistics" +COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch statistics" COM_SERMONDISTRIBUTOR_STATISTICS_CREATE="Statistics Create" COM_SERMONDISTRIBUTOR_STATISTICS_CREATE_DESC="Allows the users in this group to create create statistics" COM_SERMONDISTRIBUTOR_STATISTICS_DASHBOARD_LIST="Statistics Dashboard List" @@ -263,7 +263,7 @@ COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_OWN_DESC="Allows the users in this group t COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE="Statistics Edit State" COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_STATE_DESC="Allows the users in this group to update the state of the statistic" COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION="Statistics Edit Version" -COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version statistics" +COM_SERMONDISTRIBUTOR_STATISTICS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version statistics" COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT="Statistics Export" COM_SERMONDISTRIBUTOR_STATISTICS_EXPORT_DESC="Allows the users in this group to export export statistics" COM_SERMONDISTRIBUTOR_STATISTICS_IMPORT="Statistics Import" diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 3492b47b..43403a04 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage batchselection.php @@ -25,6 +25,7 @@ // No direct access to this file defined('JPATH_BASE') or die; +use Joomla\CMS\Language\Text; JHtmlBehavior::core(); $divWrapper = range(1,120,2); $counter = 0; @@ -32,8 +33,8 @@ $counter = 0; ListSelection) : ?>
ListSelection as $ListSelection) : ?> -
-
+
+
-
+
- +
- - -
+ + +
\ No newline at end of file diff --git a/admin/layouts/external_source/build_option_fullwidth.php b/admin/layouts/external_source/build_option_fullwidth.php index 85847056..8b9f49f1 100644 --- a/admin/layouts/external_source/build_option_fullwidth.php +++ b/admin/layouts/external_source/build_option_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage build_option_fullwidth.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'note_auto_externalsource' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/details_above.php b/admin/layouts/external_source/details_above.php index 324e42c9..c45e784a 100644 --- a/admin/layouts/external_source/details_above.php +++ b/admin/layouts/external_source/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'externalsources' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/details_fullwidth.php b/admin/layouts/external_source/details_fullwidth.php index 21c767bc..d95787f0 100644 --- a/admin/layouts/external_source/details_fullwidth.php +++ b/admin/layouts/external_source/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'apicronjob_note' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/details_left.php b/admin/layouts/external_source/details_left.php index f64196ba..85c0b861 100644 --- a/admin/layouts/external_source/details_left.php +++ b/admin/layouts/external_source/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'dropboxoptions' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/details_right.php b/admin/layouts/external_source/details_right.php index dd57d52f..71e75a1b 100644 --- a/admin/layouts/external_source/details_right.php +++ b/admin/layouts/external_source/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'filetypes' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/details_under.php b/admin/layouts/external_source/details_under.php index aaadd756..b3b85b4a 100644 --- a/admin/layouts/external_source/details_under.php +++ b/admin/layouts/external_source/details_under.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_under.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/publishing.php b/admin/layouts/external_source/publishing.php index 1c3304ab..0b5189c2 100644 --- a/admin/layouts/external_source/publishing.php +++ b/admin/layouts/external_source/publishing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/external_source/publlshing.php b/admin/layouts/external_source/publlshing.php index 57b2f712..7d29f081 100644 --- a/admin/layouts/external_source/publlshing.php +++ b/admin/layouts/external_source/publlshing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage publlshing.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php index 275a4093..8839fff6 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'alias' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 030bf924..dbe96a17 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'content' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index 95657c04..a4ac9562 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'site_view' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index 05a0d500..f2cf2aa7 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'article' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index aaadd756..b3b85b4a 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_under.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'not_required' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/help_document/metadata.php b/admin/layouts/help_document/metadata.php index cf54d36d..8f35000b 100644 --- a/admin/layouts/help_document/metadata.php +++ b/admin/layouts/help_document/metadata.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -33,7 +35,7 @@ $fieldSets = $form->getFieldsets('metadata'); $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/details_above.php b/admin/layouts/local_listing/details_above.php index 01c7bdc9..18b6a3fa 100644 --- a/admin/layouts/local_listing/details_above.php +++ b/admin/layouts/local_listing/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'size' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/details_fullwidth.php b/admin/layouts/local_listing/details_fullwidth.php index ca312c37..b3385782 100644 --- a/admin/layouts/local_listing/details_fullwidth.php +++ b/admin/layouts/local_listing/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'url' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/details_left.php b/admin/layouts/local_listing/details_left.php index 58b6da11..89840897 100644 --- a/admin/layouts/local_listing/details_left.php +++ b/admin/layouts/local_listing/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'external_source' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/details_right.php b/admin/layouts/local_listing/details_right.php index 33c7251b..731152d2 100644 --- a/admin/layouts/local_listing/details_right.php +++ b/admin/layouts/local_listing/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'build' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/publishing.php b/admin/layouts/local_listing/publishing.php index 1c3304ab..0b5189c2 100644 --- a/admin/layouts/local_listing/publishing.php +++ b/admin/layouts/local_listing/publishing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage publishing.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'modified_by' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/local_listing/publlshing.php b/admin/layouts/local_listing/publlshing.php index 57b2f712..7d29f081 100644 --- a/admin/layouts/local_listing/publlshing.php +++ b/admin/layouts/local_listing/publlshing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage publlshing.php @@ -46,7 +46,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/details_above.php b/admin/layouts/preacher/details_above.php index 5f52f0f5..0beb262b 100644 --- a/admin/layouts/preacher/details_above.php +++ b/admin/layouts/preacher/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'alias' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/details_fullwidth.php b/admin/layouts/preacher/details_fullwidth.php index 89384fca..bc0f9a09 100644 --- a/admin/layouts/preacher/details_fullwidth.php +++ b/admin/layouts/preacher/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/details_left.php b/admin/layouts/preacher/details_left.php index 8b81eb10..e578cf3e 100644 --- a/admin/layouts/preacher/details_left.php +++ b/admin/layouts/preacher/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'icon' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/details_right.php b/admin/layouts/preacher/details_right.php index ab2524e5..64a4924e 100644 --- a/admin/layouts/preacher/details_right.php +++ b/admin/layouts/preacher/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'website' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/metadata.php b/admin/layouts/preacher/metadata.php index cf54d36d..8f35000b 100644 --- a/admin/layouts/preacher/metadata.php +++ b/admin/layouts/preacher/metadata.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -33,7 +35,7 @@ $fieldSets = $form->getFieldsets('metadata'); $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/preacher/sermons_fullwidth.php b/admin/layouts/preacher/sermons_fullwidth.php index 63a85b6f..e691d113 100644 --- a/admin/layouts/preacher/sermons_fullwidth.php +++ b/admin/layouts/preacher/sermons_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons_fullwidth.php @@ -25,22 +25,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + // set the defaults $items = $displayData->vvvsermons; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; // set a return value $return = ($id) ? "index.php?option=com_sermondistributor&view=preacher&layout=edit&id=" . $id : ""; // check for a return value -$jinput = JFactory::getApplication()->input; +$jinput = Factory::getApplication()->input; if ($_return = $jinput->get('return', null, 'base64')) { $return .= "&return=" . $_return; } // check if return value was set -if (SermondistributorHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=preacher&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -60,40 +66,40 @@ $can = SermondistributorHelper::getActions('sermon');
get('sermon.create')): ?>
- - + +


- + @@ -101,7 +107,7 @@ $can = SermondistributorHelper::getActions('sermon'); $item): ?> authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('sermon',$item,'sermons'); ?> @@ -109,7 +115,7 @@ $can = SermondistributorHelper::getActions('sermon'); get('sermon.edit')): ?> escape($item->name); ?>checked_out): ?> - name, $item->checked_out_time, 'sermons.', $canCheckin); ?> + name, $item->checked_out_time, 'sermons.', $canCheckin); ?> escape($item->name); ?> @@ -136,33 +142,33 @@ $can = SermondistributorHelper::getActions('sermon'); published == 1): ?> published == 0): ?> published == 2): ?> published == -2): ?> @@ -182,7 +188,7 @@ $can = SermondistributorHelper::getActions('sermon');
- + - + - + - + - + - + - + - + - +
- link_type); ?> + link_type); ?> - source); ?> + source); ?> - - + + - - + + - - + + - - + +
- +
diff --git a/admin/layouts/series/details_above.php b/admin/layouts/series/details_above.php index 5f52f0f5..0beb262b 100644 --- a/admin/layouts/series/details_above.php +++ b/admin/layouts/series/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'alias' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/series/details_fullwidth.php b/admin/layouts/series/details_fullwidth.php index 89384fca..bc0f9a09 100644 --- a/admin/layouts/series/details_fullwidth.php +++ b/admin/layouts/series/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/series/details_left.php b/admin/layouts/series/details_left.php index 8b81eb10..e578cf3e 100644 --- a/admin/layouts/series/details_left.php +++ b/admin/layouts/series/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'icon' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/series/details_right.php b/admin/layouts/series/details_right.php index 549ad60b..c0afdb29 100644 --- a/admin/layouts/series/details_right.php +++ b/admin/layouts/series/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'scripture' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/series/metadata.php b/admin/layouts/series/metadata.php index cf54d36d..8f35000b 100644 --- a/admin/layouts/series/metadata.php +++ b/admin/layouts/series/metadata.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -33,7 +35,7 @@ $fieldSets = $form->getFieldsets('metadata'); $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/series/sermons_fullwidth.php b/admin/layouts/series/sermons_fullwidth.php index 93aa618c..d0d3ddf4 100644 --- a/admin/layouts/series/sermons_fullwidth.php +++ b/admin/layouts/series/sermons_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons_fullwidth.php @@ -25,22 +25,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + // set the defaults $items = $displayData->vwcsermons; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; // set a return value $return = ($id) ? "index.php?option=com_sermondistributor&view=series&layout=edit&id=" . $id : ""; // check for a return value -$jinput = JFactory::getApplication()->input; +$jinput = Factory::getApplication()->input; if ($_return = $jinput->get('return', null, 'base64')) { $return .= "&return=" . $_return; } // check if return value was set -if (SermondistributorHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=series&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -57,38 +63,38 @@ $can = SermondistributorHelper::getActions('sermon'); ?>
get('sermon.create')): ?> -

+

- + @@ -96,7 +102,7 @@ $can = SermondistributorHelper::getActions('sermon'); $item): ?> authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('sermon',$item,'sermons'); ?> @@ -104,7 +110,7 @@ $can = SermondistributorHelper::getActions('sermon'); get('sermon.edit')): ?> escape($item->name); ?>checked_out): ?> - name, $item->checked_out_time, 'sermons.', $canCheckin); ?> + name, $item->checked_out_time, 'sermons.', $canCheckin); ?> escape($item->name); ?> @@ -131,33 +137,33 @@ $can = SermondistributorHelper::getActions('sermon'); published == 1): ?> published == 0): ?> published == 2): ?> published == -2): ?> @@ -177,7 +183,7 @@ $can = SermondistributorHelper::getActions('sermon');
- + - + - + - + - + - + - + - + - +
- link_type); ?> + link_type); ?> - source); ?> + source); ?> - - + + - - + + - - + + - - + +
- +
diff --git a/admin/layouts/sermon/details_above.php b/admin/layouts/sermon/details_above.php index 6218a9d6..de2bbbb3 100644 --- a/admin/layouts/sermon/details_above.php +++ b/admin/layouts/sermon/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'preacher' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/details_fullwidth.php b/admin/layouts/sermon/details_fullwidth.php index 89384fca..bc0f9a09 100644 --- a/admin/layouts/sermon/details_fullwidth.php +++ b/admin/layouts/sermon/details_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_fullwidth.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'description' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/details_left.php b/admin/layouts/sermon/details_left.php index 725eb983..be9fd342 100644 --- a/admin/layouts/sermon/details_left.php +++ b/admin/layouts/sermon/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'icon' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/details_right.php b/admin/layouts/sermon/details_right.php index 7968829d..b0c96d92 100644 --- a/admin/layouts/sermon/details_right.php +++ b/admin/layouts/sermon/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -44,7 +44,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'tags' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/details_under.php b/admin/layouts/sermon/details_under.php index c365dc40..b49afb30 100644 --- a/admin/layouts/sermon/details_under.php +++ b/admin/layouts/sermon/details_under.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_under.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'auto_sermons' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/files_fullwidth.php b/admin/layouts/sermon/files_fullwidth.php index 11e49adb..1b4b4629 100644 --- a/admin/layouts/sermon/files_fullwidth.php +++ b/admin/layouts/sermon/files_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage files_fullwidth.php @@ -51,7 +51,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'url' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/metadata.php b/admin/layouts/sermon/metadata.php index cf54d36d..8f35000b 100644 --- a/admin/layouts/sermon/metadata.php +++ b/admin/layouts/sermon/metadata.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -33,7 +35,7 @@ $fieldSets = $form->getFieldsets('metadata'); $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/sermon/stastics_fullwidth.php b/admin/layouts/sermon/stastics_fullwidth.php index db88f257..73426692 100644 --- a/admin/layouts/sermon/stastics_fullwidth.php +++ b/admin/layouts/sermon/stastics_fullwidth.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage stastics_fullwidth.php @@ -25,22 +25,28 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + // set the defaults $items = $displayData->vwbstastics; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.edit"; // set a return value $return = ($id) ? "index.php?option=com_sermondistributor&view=sermon&layout=edit&id=" . $id : ""; // check for a return value -$jinput = JFactory::getApplication()->input; +$jinput = Factory::getApplication()->input; if ($_return = $jinput->get('return', null, 'base64')) { $return .= "&return=" . $_return; } // check if return value was set -if (SermondistributorHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=sermon&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -52,30 +58,30 @@ else ?>
- + @@ -83,7 +89,7 @@ else $item): ?> authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('statistic',$item,'statistics'); ?> @@ -91,7 +97,7 @@ else get('statistic.edit')): ?> filename; ?>checked_out): ?> - name, $item->checked_out_time, 'statistics.', $canCheckin); ?> + name, $item->checked_out_time, 'statistics.', $canCheckin); ?> filename; ?> @@ -119,26 +125,26 @@ else published == 1): ?> published == 0): ?> published == 2): ?> published == -2): ?> @@ -158,7 +164,7 @@ else
- + - + - + - + - + - + - +
- - + + - - + + - - + + - - + +
- +
diff --git a/admin/layouts/statistic/details_above.php b/admin/layouts/statistic/details_above.php index 942766bd..8409be42 100644 --- a/admin/layouts/statistic/details_above.php +++ b/admin/layouts/statistic/details_above.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_above.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'sermon' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/statistic/details_left.php b/admin/layouts/statistic/details_left.php index e81d61de..2b3b6b4b 100644 --- a/admin/layouts/statistic/details_left.php +++ b/admin/layouts/statistic/details_left.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_left.php @@ -43,7 +43,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'series' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/statistic/details_right.php b/admin/layouts/statistic/details_right.php index 777c011a..622641ee 100644 --- a/admin/layouts/statistic/details_right.php +++ b/admin/layouts/statistic/details_right.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage details_right.php @@ -42,7 +42,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'counter' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/statistic/metadata.php b/admin/layouts/statistic/metadata.php index cf54d36d..8f35000b 100644 --- a/admin/layouts/statistic/metadata.php +++ b/admin/layouts/statistic/metadata.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage metadata.php @@ -25,6 +25,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + $form = $displayData->getForm(); // JLayout for standard handling of metadata fields in the administrator content edit screens. @@ -33,7 +35,7 @@ $fieldSets = $form->getFieldsets('metadata'); $fieldSet) : ?> description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

+

escape(Text::_($fieldSet->description)); ?>

get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/trashhelper.php b/admin/layouts/trashhelper.php index 0f24f745..35259ec5 100644 --- a/admin/layouts/trashhelper.php +++ b/admin/layouts/trashhelper.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage trashhelper.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> @@ -39,7 +44,7 @@ defined('JPATH_BASE') or die('Restricted access'); document.adminForm.elements['checkall-toggle'].checked=1; Joomla.checkAll(document.adminForm.elements['checkall-toggle']); // check to confirm the deletion - if(confirm('')) { + if(confirm('')) { Joomla.submitbutton('get("name") ?>.delete'); } else { document.adminForm.elements['checkall-toggle'].checked=0; @@ -47,7 +52,7 @@ defined('JPATH_BASE') or die('Restricted access'); } } else { // confirm deletion of those selected - if (confirm('')) { + if (confirm('')) { Joomla.submitbutton('get("name") ?>.delete'); }; } @@ -64,23 +69,23 @@ defined('JPATH_BASE') or die('Restricted access'); items)): ?>

- +

-

+

- +

-

+

diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 8210fce0..e35101d4 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Sermondistributor Ajax List Model @@ -34,26 +44,32 @@ use Joomla\Utilities\ArrayHelper; class SermondistributorModelAjax extends ListModel { protected $app_params; - - public function __construct() - { - parent::__construct(); + + public function __construct() + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_sermondistributor'); - + $this->app_params = ComponentHelper::getParams('com_sermondistributor'); + } // Used in sermon /** - * Check and if a vdm notice is new (per/user) - **/ - public function isNew($notice) + * Check and if a notice is new (per/user) + * + * @param string|null $notice The current notice + * + * @return bool true if is new + * @since 2.0.0 + */ + public function isNew(?string $notice): bool { // first get the file path - $path_filename = SermondistributorHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + // check if the file is set - if (($content = @file_get_contents($path_filename)) !== FALSE) + if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) { if ($notice == $content) { @@ -64,33 +80,28 @@ class SermondistributorModelAjax extends ListModel } /** - * set That a notice has been read (per/user) - **/ - public function isRead($notice) + * Check if a notice has been read (per/user) + * + * @param string|null $notice The current notice + * + * @return bool true if is read + * @since 2.0.0 + */ + public function isRead(?string $notice): bool { // first get the file path - $path_filename = SermondistributorHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('path', 'usernotice', 'md', Factory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); + // set as read if not already set - if (($content = @file_get_contents($path_filename)) !== FALSE) + if (($content = FileHelper::getContent($path_filename, FALSE)) !== FALSE) { if ($notice == $content) { return true; } } - return $this->saveFile($notice,$path_filename); - } - protected function saveFile($data,$path_filename) - { - if (SermondistributorHelper::checkString($data)) - { - $fp = fopen($path_filename, 'w'); - fwrite($fp, $data); - fclose($fp); - return true; - } - return false; + return FileHelper::write($path_filename, $notice); } // Used in external_source @@ -113,8 +124,8 @@ class SermondistributorModelAjax extends ListModel { // set the headers $headers = array( - 'tsharedurl' => JText::_('COM_SERMONDISTRIBUTOR_SHAREDURL'), - 'tfolder' => JText::_('COM_SERMONDISTRIBUTOR_TARGETED_FOLDER') + 'tsharedurl' => Text::_('COM_SERMONDISTRIBUTOR_SHAREDURL'), + 'tfolder' => Text::_('COM_SERMONDISTRIBUTOR_TARGETED_FOLDER') ); // loop the array foreach ($headers as $key => $lang) @@ -128,7 +139,7 @@ class SermondistributorModelAjax extends ListModel $functions = range(0,10); foreach ($functions as $function) { - $function = 'setAutoLang'.SermondistributorHelper::safeString($function, 'f'); + $function = 'setAutoLang'.StringHelper::safe($function, 'f'); if (method_exists($this, $function)) { $this->{$function}(); @@ -136,7 +147,7 @@ class SermondistributorModelAjax extends ListModel } foreach ($functions as $function) { - $function = 'setAutoFunc'.SermondistributorHelper::safeString($function, 'f'); + $function = 'setAutoFunc'.StringHelper::safe($function, 'f'); if (method_exists($this, $function)) { $this->{$function}(); @@ -146,10 +157,10 @@ class SermondistributorModelAjax extends ListModel public function getBuildTable($idName,$oject) { - if (SermondistributorHelper::checkJson($oject) && SermondistributorHelper::checkString($idName)) + if (JsonHelper::check($oject) && StringHelper::check($idName)) { $array = json_decode($oject, true); - if (SermondistributorHelper::checkArray($array)) + if (UtilitiesArrayHelper::check($array)) { // make sure we run the autoloader to insure all is set $this->autoLoader(); @@ -160,9 +171,9 @@ class SermondistributorModelAjax extends ListModel $rows = array(); foreach ($array as $header => $values) { - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { - $targetHeader = (isset($targetHeaders[$header])) ? $targetHeaders[$header] : SermondistributorHelper::safeString($header, 'W'); + $targetHeader = (isset($targetHeaders[$header])) ? $targetHeaders[$header] : StringHelper::safe($header, 'W'); $table .= ''.$targetHeader.''; foreach ($values as $nr => $value) { @@ -174,7 +185,7 @@ class SermondistributorModelAjax extends ListModel // close header start body $table .= ''; // add rows to table - if (SermondistributorHelper::checkArray($rows)) + if (UtilitiesArrayHelper::check($rows)) { foreach ($rows as $row) { @@ -198,7 +209,7 @@ class SermondistributorModelAjax extends ListModel $value = $this->{$this->functionArray[$header]}($header,$value); } // if no value are set - if (!SermondistributorHelper::checkString($value)) + if (!StringHelper::check($value)) { $value = '-'; } @@ -228,10 +239,10 @@ class SermondistributorModelAjax extends ListModel **/ public function getCronPath($type) { - $result = array('error' => '' . JText::_('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . ''); + $result = array('error' => '' . Text::_('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED') . ''); if ('externalUpdate' === $type) { - $result['error'] = '' . JText::sprintf('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; + $result['error'] = '' . Text::sprintf('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . ''; if ($this->hasCurl()) { $path = '*/15 * * * * curl -s "' .JURI::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1'; @@ -265,14 +276,14 @@ class SermondistributorModelAjax extends ListModel $type = 'auto'; } // first get the file path - $path_filename = SermondistributorHelper::getFilePath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); // check "die sleutel" and the type - if (isset($type) && SermondistributorHelper::checkString($sleutel)) + if (isset($type) && StringHelper::check($sleutel)) { // get database object - if (!isset($this->db) || !SermondistributorHelper::checkObject($this->db)) + if (!isset($this->db) || !ObjectHelper::check($this->db)) { - $this->db = JFactory::getDBO(); + $this->db = Factory::getDBO(); } // run the update if (SermondistributorHelper::updateExternalSource($id, $target, $type, true, $sleutel)) @@ -292,7 +303,7 @@ class SermondistributorModelAjax extends ListModel return array('error' => $error); } // store the error - $error = JText::_('COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB'); + $error = Text::_('COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB'); SermondistributorHelper::writeFile($path_filename,$error); return array('error' => $error); } @@ -304,12 +315,12 @@ class SermondistributorModelAjax extends ListModel { // check if we should update with auto listing $links_dropbox_auto = SermondistributorHelper::getExternalSourceLink('auto', 2); - if (SermondistributorHelper::checkArray($links_dropbox_auto)) + if (UtilitiesArrayHelper::check($links_dropbox_auto)) { // load system aliases $this->getSermonAliasesUsed(); // set the class var for sermons - $this->sermons = new stdClass(); + $this->sermons = new \stdClass(); // we must first get all the preacher names foreach ($links_dropbox_auto as $placeholder => $link) { @@ -353,7 +364,7 @@ class SermondistributorModelAjax extends ListModel protected function setSermons() { // check if we have values - if (SermondistributorHelper::checkObject($this->sermons)) + if (ObjectHelper::check($this->sermons)) { foreach ($this->sermons as $sermon) { @@ -420,7 +431,7 @@ class SermondistributorModelAjax extends ListModel $fields = array( $this->db->quoteName('published') . ' = 0' ); - if (isset($this->allSermons) && SermondistributorHelper::checkArray($this->allSermons)) + if (isset($this->allSermons) && UtilitiesArrayHelper::check($this->allSermons)) { // unpublish those AUTO sermons not found in this id list $conditions = array( @@ -513,7 +524,7 @@ class SermondistributorModelAjax extends ListModel else { // load the sermon data - $this->sermons->$key = new stdClass(); + $this->sermons->$key = new \stdClass(); } // check if this value has been set if (!isset($this->sermons->$key->alias)) @@ -534,7 +545,7 @@ class SermondistributorModelAjax extends ListModel $this->sermons->$key->name = $name; } // check if this value has been set - if (!isset($this->sermons->$key->short_description) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->short_description) && StringHelper::check($description)) { $this->sermons->$key->short_description = $description; } @@ -557,32 +568,32 @@ class SermondistributorModelAjax extends ListModel if (!isset($this->sermons->$key->created)) { // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); $this->sermons->$key->created = $date->toSql(); } // build the Download File NAme - first add the preacher name if set if ($preacher) { - $downloadName[] = SermondistributorHelper::safeString($preacherName,'U'); + $downloadName[] = StringHelper::safe($preacherName,'U'); } // add the series name if set if ($series) { - $downloadName[] = SermondistributorHelper::safeString($seriesName,'F'); + $downloadName[] = StringHelper::safe($seriesName,'F'); } // add the category name if set if ($category) { - $downloadName[] = SermondistributorHelper::safeString($categoryName, 'F'); + $downloadName[] = StringHelper::safe($categoryName, 'F'); } // add the main file name - $downloadName[] = SermondistributorHelper::safeString($name,'F'); + $downloadName[] = StringHelper::safe($name,'F'); // now build the download file name $downloadName = implode('__', $downloadName).'.'.$fileType; // load the placeholder to the sermon $this->sermons->$key->auto_sermons[$downloadName] = $placeholder; // set default metadate - if (!isset($this->sermons->$key->metadesc) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->metadesc) && StringHelper::check($description)) { // Only process once per/sermon $bad_characters = array("\"", "<", ">"); @@ -613,7 +624,7 @@ class SermondistributorModelAjax extends ListModel protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { $alias = JFilterOutput::stringURLUnicodeSlug($name); } @@ -633,7 +644,7 @@ class SermondistributorModelAjax extends ListModel // sanitize the name to an alias $alias = $this->getAlias($name); // check if there is a recored - if ($id = SermondistributorHelper::getVar($type, $alias, 'alias', 'id')) + if ($id = GetHelper::var($type, $alias, 'alias', 'id')) { return $id; } @@ -646,9 +657,9 @@ class SermondistributorModelAjax extends ListModel $name = ucwords($name); } // create the record - $object = new stdClass(); + $object = new \stdClass(); // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); // build the object $object->name = $name; $object->alias = $alias; diff --git a/admin/models/external_source.php b/admin/models/external_source.php index ed46cdc8..2b5415d3 100644 --- a/admin/models/external_source.php +++ b/admin/models/external_source.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_source.php @@ -25,10 +25,22 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\FOF\Encrypt\AES; /** * Sermondistributor External_source Admin Model @@ -97,16 +109,16 @@ class SermondistributorModelExternal_source extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'external_source', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'external_source', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } public function clearLocalListing($id) @@ -114,7 +126,7 @@ class SermondistributorModelExternal_source extends AdminModel // clear local listings if ($id > 0) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $conditions = array( @@ -146,7 +158,7 @@ class SermondistributorModelExternal_source extends AdminModel // build info file key $targetArray = explode(', ', $target); $targetArray[2] = ($targetArray[2] == 2) ? 'auto' : 'manual'; - $infoFileKey = SermondistributorHelper::safeString(implode('', $targetArray)); + $infoFileKey = UtilitiesStringHelper::safe(implode('', $targetArray)); $infoFileName = md5($infoFileKey.'info').'.json'; // info on update path $infoFilePath = JPATH_COMPONENT_SITE.'/helpers/'.$infoFileName; @@ -155,35 +167,35 @@ class SermondistributorModelExternal_source extends AdminModel { if (!JFile::delete($infoFilePath)) { - $errors[] = JText::sprintf('COM_SERMONDISTRIBUTOR_S_COULD_NOT_BE_REMOVE', $infoFileName); + $errors[] = Text::sprintf('COM_SERMONDISTRIBUTOR_S_COULD_NOT_BE_REMOVE', $infoFileName); } } // remove any notice on update errors $key = preg_replace('/[ ,]+/', '', trim($target)); - $noticeFilePath = SermondistributorHelper::getFilePath('update', 'error', $key, '.txt', JPATH_COMPONENT_ADMINISTRATOR); + $noticeFilePath = FileHelper::getPath('update', 'error', $key, '.txt', JPATH_COMPONENT_ADMINISTRATOR); // now remove file if found if (JFile::exists($noticeFilePath)) { if (!JFile::delete($noticeFilePath)) { $noticeFileName = basename($noticeFilePath); - $errors[] = JText::sprintf('COM_SERMONDISTRIBUTOR_S_COULD_NOT_BE_REMOVE', $noticeFileName); + $errors[] = Text::sprintf('COM_SERMONDISTRIBUTOR_S_COULD_NOT_BE_REMOVE', $noticeFileName); } } } // check if there was an error - if (SermondistributorHelper::checkArray($errors)) + if (UtilitiesArrayHelper::check($errors)) { return array('error' => '
  • '.implode('
  • ', $errors).'
'); } return true; } - return array('error' => JText::_('COM_SERMONDISTRIBUTOR_THERE_IS_NO_TARGETS_SET_FOR_THIS_SOURCE_CAN_NOT_RESET_THE_UPDATE_STATUS')); + return array('error' => Text::_('COM_SERMONDISTRIBUTOR_THERE_IS_NO_TARGETS_SET_FOR_THIS_SOURCE_CAN_NOT_RESET_THE_UPDATE_STATUS')); } - return array('error' => JText::_('COM_SERMONDISTRIBUTOR_NO_ID_FOUND_CAN_NOT_RESET_THE_UPDATE_STATUS')); + return array('error' => Text::_('COM_SERMONDISTRIBUTOR_NO_ID_FOUND_CAN_NOT_RESET_THE_UPDATE_STATUS')); } - + /** * Method to get a single record. * @@ -216,7 +228,7 @@ class SermondistributorModelExternal_source extends AdminModel // Get the basic encryption. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); if (!empty($item->oauthtoken) && $basickey && !is_numeric($item->oauthtoken) && $item->oauthtoken === base64_encode(base64_decode($item->oauthtoken, true))) { @@ -245,7 +257,7 @@ class SermondistributorModelExternal_source extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -272,7 +284,7 @@ class SermondistributorModelExternal_source extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -285,7 +297,7 @@ class SermondistributorModelExternal_source extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -348,13 +360,13 @@ class SermondistributorModelExternal_source extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/external_source.js'; } - + /** * Method to test whether a record can be deleted. * @@ -373,7 +385,7 @@ class SermondistributorModelExternal_source extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('external_source.delete', 'com_sermondistributor.external_source.' . (int) $record->id); } @@ -391,8 +403,8 @@ class SermondistributorModelExternal_source extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -403,31 +415,31 @@ class SermondistributorModelExternal_source extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('external_source.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('external_source.edit', 'com_sermondistributor.external_source.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('external_source.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -435,19 +447,19 @@ class SermondistributorModelExternal_source extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -459,7 +471,7 @@ class SermondistributorModelExternal_source extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_external_source')); @@ -474,7 +486,7 @@ class SermondistributorModelExternal_source extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -489,10 +501,10 @@ class SermondistributorModelExternal_source extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.external_source.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.external_source.data', []); if (empty($data)) { @@ -520,7 +532,7 @@ class SermondistributorModelExternal_source extends AdminModel public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -528,7 +540,7 @@ class SermondistributorModelExternal_source extends AdminModel foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (SermondistributorHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -551,7 +563,7 @@ class SermondistributorModelExternal_source extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -567,7 +579,7 @@ class SermondistributorModelExternal_source extends AdminModel { return false; } - + return true; } @@ -587,10 +599,10 @@ class SermondistributorModelExternal_source extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -616,30 +628,30 @@ class SermondistributorModelExternal_source extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('external_source'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('external_source'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -676,8 +688,7 @@ class SermondistributorModelExternal_source extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -703,7 +714,7 @@ class SermondistributorModelExternal_source extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('external_source'); @@ -729,7 +740,7 @@ class SermondistributorModelExternal_source extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -742,7 +753,7 @@ class SermondistributorModelExternal_source extends AdminModel if (!$this->user->authorise('external_source.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -758,19 +769,19 @@ class SermondistributorModelExternal_source extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (SermondistributorHelper::checkString($this->table->description) && !is_numeric($this->table->description)) + if (UtilitiesStringHelper::check($this->table->description) && !is_numeric($this->table->description)) { $this->table->description = $this->generateUnique('description',$this->table->description); } // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -782,7 +793,7 @@ class SermondistributorModelExternal_source extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -846,7 +857,7 @@ class SermondistributorModelExternal_source extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('external_source'); @@ -854,7 +865,7 @@ class SermondistributorModelExternal_source extends AdminModel if (!$this->canDo->get('external_source.edit') && !$this->canDo->get('external_source.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -871,7 +882,7 @@ class SermondistributorModelExternal_source extends AdminModel { if (!$this->user->authorise('external_source.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -887,13 +898,13 @@ class SermondistributorModelExternal_source extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -937,7 +948,7 @@ class SermondistributorModelExternal_source extends AdminModel return true; } - + /** * Method to save the form data. * @@ -949,15 +960,15 @@ class SermondistributorModelExternal_source extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -971,18 +982,18 @@ class SermondistributorModelExternal_source extends AdminModel // Get the basic encryption key. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Encrypt data oauthtoken. if (isset($data['oauthtoken']) && $basickey) { $data['oauthtoken'] = $basic->encryptString($data['oauthtoken']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -992,7 +1003,7 @@ class SermondistributorModelExternal_source extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1000,14 +1011,14 @@ class SermondistributorModelExternal_source extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1020,7 +1031,6 @@ class SermondistributorModelExternal_source extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1046,7 +1056,7 @@ class SermondistributorModelExternal_source extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/external_sources.php b/admin/models/external_sources.php index db5719f4..355ad06c 100644 --- a/admin/models/external_sources.php +++ b/admin/models/external_sources.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_sources.php @@ -25,18 +25,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\FOF\Encrypt\AES; /** * External_sources List Model */ class SermondistributorModelExternal_sources extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -66,7 +75,7 @@ class SermondistributorModelExternal_sources extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -130,7 +139,7 @@ class SermondistributorModelExternal_sources extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -145,12 +154,12 @@ class SermondistributorModelExternal_sources extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -164,12 +173,12 @@ class SermondistributorModelExternal_sources extends ListModel // decode filetypes $filetypesArray = json_decode($item->filetypes, true); - if (SermondistributorHelper::checkArray($filetypesArray)) + if (UtilitiesArrayHelper::check($filetypesArray)) { - $filetypesNames = array(); + $filetypesNames = []; foreach ($filetypesArray as $filetypes) { - $filetypesNames[] = JText::_($this->selectionTranslation($filetypes, 'filetypes')); + $filetypesNames[] = Text::_($this->selectionTranslation($filetypes, 'filetypes')); } $item->filetypes = implode(', ', $filetypesNames); } @@ -177,7 +186,7 @@ class SermondistributorModelExternal_sources extends ListModel } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -192,7 +201,7 @@ class SermondistributorModelExternal_sources extends ListModel } } - + // return items return $items; } @@ -200,7 +209,7 @@ class SermondistributorModelExternal_sources extends ListModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -212,7 +221,7 @@ class SermondistributorModelExternal_sources extends ListModel 1 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DROPBOX' ); // Now check if value is found in this array - if (isset($externalsourcesArray[$value]) && SermondistributorHelper::checkString($externalsourcesArray[$value])) + if (isset($externalsourcesArray[$value]) && StringHelper::check($externalsourcesArray[$value])) { return $externalsourcesArray[$value]; } @@ -225,7 +234,7 @@ class SermondistributorModelExternal_sources extends ListModel 2 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_AUTOMATIC' ); // Now check if value is found in this array - if (isset($update_methodArray[$value]) && SermondistributorHelper::checkString($update_methodArray[$value])) + if (isset($update_methodArray[$value]) && StringHelper::check($update_methodArray[$value])) { return $update_methodArray[$value]; } @@ -264,7 +273,7 @@ class SermondistributorModelExternal_sources extends ListModel '.gif' => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_GIF' ); // Now check if value is found in this array - if (isset($filetypesArray[$value]) && SermondistributorHelper::checkString($filetypesArray[$value])) + if (isset($filetypesArray[$value]) && StringHelper::check($filetypesArray[$value])) { return $filetypesArray[$value]; } @@ -278,25 +287,25 @@ class SermondistributorModelExternal_sources extends ListModel 2 => 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DYNAMIC_AUTOMATIC_BUILD' ); // Now check if value is found in this array - if (isset($buildArray[$value]) && SermondistributorHelper::checkString($buildArray[$value])) + if (isset($buildArray[$value]) && StringHelper::check($buildArray[$value])) { return $buildArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -343,7 +352,7 @@ class SermondistributorModelExternal_sources extends ListModel $query->where('a.externalsources = ' . (int) $_externalsources); } } - elseif (SermondistributorHelper::checkString($_externalsources)) + elseif (StringHelper::check($_externalsources)) { $query->where('a.externalsources = ' . $db->quote($db->escape($_externalsources))); } @@ -360,7 +369,7 @@ class SermondistributorModelExternal_sources extends ListModel $query->where('a.update_method = ' . (int) $_update_method); } } - elseif (SermondistributorHelper::checkString($_update_method)) + elseif (StringHelper::check($_update_method)) { $query->where('a.update_method = ' . $db->quote($db->escape($_update_method))); } @@ -377,16 +386,18 @@ class SermondistributorModelExternal_sources extends ListModel $query->where('a.build = ' . (int) $_build); } } - elseif (SermondistributorHelper::checkString($_build)) + elseif (StringHelper::check($_build)) { $query->where('a.build = ' . $db->quote($db->escape($_build))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -404,17 +415,17 @@ class SermondistributorModelExternal_sources extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -454,10 +465,10 @@ class SermondistributorModelExternal_sources extends ListModel // Get the basic encryption key. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -482,7 +493,7 @@ class SermondistributorModelExternal_sources extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -500,16 +511,16 @@ class SermondistributorModelExternal_sources extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_external_source"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -518,7 +529,7 @@ class SermondistributorModelExternal_sources extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -545,19 +556,18 @@ class SermondistributorModelExternal_sources extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -569,7 +579,7 @@ class SermondistributorModelExternal_sources extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -590,7 +600,7 @@ class SermondistributorModelExternal_sources extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index 3cdb37c8..6badca3e 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage adminviewfolderlist.php @@ -25,6 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,33 +42,36 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList /** * The adminviewfolderlist field type. * - * @var string + * @var string */ public $type = 'adminviewfolderlist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder files - $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views'; + $localfolders = []; + $localfolders[] = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/views'; + $localfolders[] = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/src/View'; // set the default - $options = array(); - // import all needed classes - jimport('joomla.filesystem.folder'); + $options = []; // now check if there are files in the folder - if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) + foreach ($localfolders as $localfolder) { - if ($this->multiple === false) + if (is_dir($localfolder) && $folders = \Joomla\Filesystem\Folder::folders($localfolder)) { - $options[] = JHtml::_('select.option', '', JText::_('COM_SERMONDISTRIBUTOR_SELECT_AN_ADMIN_VIEW')); - } - foreach ($folders as $folder) - { - $options[] = JHtml::_('select.option', $folder, SermondistributorHelper::safeString($folder, 'W')); + if ($this->multiple === false) + { + $options[] = Html::_('select.option', '', Text::_('COM_SERMONDISTRIBUTOR_SELECT_AN_ADMIN_VIEW')); + } + foreach ($folders as $folder) + { + $options[] = Html::_('select.option', $folder, StringHelper::safe($folder, 'W')); + } } } return $options; diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index a412ae81..3b6fb2a8 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage articles.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,14 +41,14 @@ class JFormFieldArticles extends JFormFieldList /** * The articles field type. * - * @var string + * @var string */ public $type = 'articles'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/externalsource.php b/admin/models/fields/externalsource.php index b1d1922f..edeb39cb 100644 --- a/admin/models/fields/externalsource.php +++ b/admin/models/fields/externalsource.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage externalsource.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,7 +41,7 @@ class JFormFieldExternalsource extends JFormFieldList /** * The externalsource field type. * - * @var string + * @var string */ public $type = 'externalsource'; @@ -61,7 +65,7 @@ class JFormFieldExternalsource extends JFormFieldList $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -77,7 +81,7 @@ class JFormFieldExternalsource extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -90,20 +94,20 @@ class JFormFieldExternalsource extends JFormFieldList $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create external_source - if ($user->authorise('external_source.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('external_source.create', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit external_source - if ($user->authorise('external_source.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('external_source.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -136,7 +140,7 @@ class JFormFieldExternalsource extends JFormFieldList if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
' .$html . implode('',$button).'
'; @@ -148,7 +152,7 @@ class JFormFieldExternalsource extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/externalsourcefiles.php b/admin/models/fields/externalsourcefiles.php index 7aa93ebd..5afe7438 100644 --- a/admin/models/fields/externalsourcefiles.php +++ b/admin/models/fields/externalsourcefiles.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage externalsourcefiles.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,26 +41,26 @@ class JFormFieldExternalsourcefiles extends JFormFieldList /** * The externalsourcefiles field type. * - * @var string + * @var string */ public $type = 'externalsourcefiles'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // set the default - $options[] = JHtml::_('select.option', '', JText::_('COM_SERMONDISTRIBUTOR_THE_LOCAL_LISTING_OF_THE_MANUAL_EXTERNAL_SOURCE_FOLDERS_IS_EMPTY')); + $options[] = Html::_('select.option', '', Text::_('COM_SERMONDISTRIBUTOR_THE_LOCAL_LISTING_OF_THE_MANUAL_EXTERNAL_SOURCE_FOLDERS_IS_EMPTY')); $selection = SermondistributorHelper::getExternalSourceLink('manual', 2, false, 'select'); if (SermondistributorHelper::checkArray($selection)) { $options = array(); foreach ($selection as $key => $name) { - $options[] = JHtml::_('select.option', $key, $name); + $options[] = Html::_('select.option', $key, $name); } } return $options; diff --git a/admin/models/fields/externalsourcesfilterbuild.php b/admin/models/fields/externalsourcesfilterbuild.php index 8fbc1a54..e81a3f84 100644 --- a/admin/models/fields/externalsourcesfilterbuild.php +++ b/admin/models/fields/externalsourcesfilterbuild.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage externalsourcesfilterbuild.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldExternalsourcesfilterbuild extends JFormFieldList /** * The externalsourcesfilterbuild field type. * - * @var string + * @var string */ public $type = 'externalsourcesfilterbuild'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldExternalsourcesfilterbuild extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD_OPTION') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD_OPTION') . ' -'); - if ($results) + if ($_results) { // get external_sourcesmodel - $model = SermondistributorHelper::getModel('external_sources'); - $results = array_unique($results); - foreach ($results as $build) + $_model = SermondistributorHelper::getModel('external_sources'); + $_results = array_unique($_results); + foreach ($_results as $build) { // Translate the build selection - $text = $model->selectionTranslation($build,'build'); + $_text = $_model->selectionTranslation($build,'build'); // Now add the build and its text to the options array - $_filter[] = JHtml::_('select.option', $build, JText::_($text)); + $_filter[] = Html::_('select.option', $build, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/externalsourcesfilterexternalsources.php b/admin/models/fields/externalsourcesfilterexternalsources.php index 4579ce75..2807e51e 100644 --- a/admin/models/fields/externalsourcesfilterexternalsources.php +++ b/admin/models/fields/externalsourcesfilterexternalsources.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage externalsourcesfilterexternalsources.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldExternalsourcesfilterexternalsources extends JFormFieldList /** * The externalsourcesfilterexternalsources field type. * - * @var string + * @var string */ public $type = 'externalsourcesfilterexternalsources'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldExternalsourcesfilterexternalsources extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNAL_SOURCES') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNAL_SOURCES') . ' -'); - if ($results) + if ($_results) { // get external_sourcesmodel - $model = SermondistributorHelper::getModel('external_sources'); - $results = array_unique($results); - foreach ($results as $externalsources) + $_model = SermondistributorHelper::getModel('external_sources'); + $_results = array_unique($_results); + foreach ($_results as $externalsources) { // Translate the externalsources selection - $text = $model->selectionTranslation($externalsources,'externalsources'); + $_text = $_model->selectionTranslation($externalsources,'externalsources'); // Now add the externalsources and its text to the options array - $_filter[] = JHtml::_('select.option', $externalsources, JText::_($text)); + $_filter[] = Html::_('select.option', $externalsources, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/externalsourcesfilterupdatemethod.php b/admin/models/fields/externalsourcesfilterupdatemethod.php index 05947981..e69bcd32 100644 --- a/admin/models/fields/externalsourcesfilterupdatemethod.php +++ b/admin/models/fields/externalsourcesfilterupdatemethod.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage externalsourcesfilterupdatemethod.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldExternalsourcesfilterupdatemethod extends JFormFieldList /** * The externalsourcesfilterupdatemethod field type. * - * @var string + * @var string */ public $type = 'externalsourcesfilterupdatemethod'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldExternalsourcesfilterupdatemethod extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_UPDATE_METHOD') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_UPDATE_METHOD') . ' -'); - if ($results) + if ($_results) { // get external_sourcesmodel - $model = SermondistributorHelper::getModel('external_sources'); - $results = array_unique($results); - foreach ($results as $update_method) + $_model = SermondistributorHelper::getModel('external_sources'); + $_results = array_unique($_results); + foreach ($_results as $update_method) { // Translate the update_method selection - $text = $model->selectionTranslation($update_method,'update_method'); + $_text = $_model->selectionTranslation($update_method,'update_method'); // Now add the update_method and its text to the options array - $_filter[] = JHtml::_('select.option', $update_method, JText::_($text)); + $_filter[] = Html::_('select.option', $update_method, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/helpdocumentsfilterlocation.php b/admin/models/fields/helpdocumentsfilterlocation.php index ef6a8811..18f57ab1 100644 --- a/admin/models/fields/helpdocumentsfilterlocation.php +++ b/admin/models/fields/helpdocumentsfilterlocation.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage helpdocumentsfilterlocation.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList /** * The helpdocumentsfilterlocation field type. * - * @var string + * @var string */ public $type = 'helpdocumentsfilterlocation'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_LOCATION') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_LOCATION') . ' -'); - if ($results) + if ($_results) { // get help_documentsmodel - $model = SermondistributorHelper::getModel('help_documents'); - $results = array_unique($results); - foreach ($results as $location) + $_model = SermondistributorHelper::getModel('help_documents'); + $_results = array_unique($_results); + foreach ($_results as $location) { // Translate the location selection - $text = $model->selectionTranslation($location,'location'); + $_text = $_model->selectionTranslation($location,'location'); // Now add the location and its text to the options array - $_filter[] = JHtml::_('select.option', $location, JText::_($text)); + $_filter[] = Html::_('select.option', $location, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/helpdocumentsfiltertype.php b/admin/models/fields/helpdocumentsfiltertype.php index c753f8ce..6494b10e 100644 --- a/admin/models/fields/helpdocumentsfiltertype.php +++ b/admin/models/fields/helpdocumentsfiltertype.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage helpdocumentsfiltertype.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldHelpdocumentsfiltertype extends JFormFieldList /** * The helpdocumentsfiltertype field type. * - * @var string + * @var string */ public $type = 'helpdocumentsfiltertype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldHelpdocumentsfiltertype extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_TYPE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_TYPE') . ' -'); - if ($results) + if ($_results) { // get help_documentsmodel - $model = SermondistributorHelper::getModel('help_documents'); - $results = array_unique($results); - foreach ($results as $type) + $_model = SermondistributorHelper::getModel('help_documents'); + $_results = array_unique($_results); + foreach ($_results as $type) { // Translate the type selection - $text = $model->selectionTranslation($type,'type'); + $_text = $_model->selectionTranslation($type,'type'); // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + $_filter[] = Html::_('select.option', $type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/localfiles.php b/admin/models/fields/localfiles.php index 63fa4aa0..ba2f2a1d 100644 --- a/admin/models/fields/localfiles.php +++ b/admin/models/fields/localfiles.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage localfiles.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,36 +41,33 @@ class JFormFieldLocalfiles extends JFormFieldList /** * The localfiles field type. * - * @var string + * @var string */ public $type = 'localfiles'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get local folder - $localfolder = JComponentHelper::getParams('com_sermondistributor')->get('localfolder', JPATH_ROOT.'/images'); + $localfolder = ComponentHelper::getParams('com_sermondistributor')->get('localfolder', JPATH_ROOT.'/images'); // set the default - $options[] = JHtml::_('select.option', '', JText::sprintf('COM_SERMONDISTRIBUTOR_PLEASE_ADD_FILES_TO_S',$localfolder)); - // inport all needed classes - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); + $options[] = Html::_('select.option', '', Text::sprintf('COM_SERMONDISTRIBUTOR_PLEASE_ADD_FILES_TO_S', $localfolder)); // setup the folder if it does not exist - if (!JFolder::exists($localfolder)) + if (!\Joomla\CMS\Filesystem\Folder::exists($localfolder)) { - JFolder::create($localfolder); + \Joomla\CMS\Filesystem\Folder::create($localfolder); } // now check if there are files in the folder - if ($files = JFolder::files($localfolder)) + if ($files = \Joomla\CMS\Filesystem\Folder::files($localfolder)) { $options = array(); foreach ($files as $file) { - $options[] = JHtml::_('select.option', $file, $file); + $options[] = Html::_('select.option', $file, $file); } } return $options; diff --git a/admin/models/fields/locallistingsfilterbuild.php b/admin/models/fields/locallistingsfilterbuild.php index 3b02ab34..139af5f2 100644 --- a/admin/models/fields/locallistingsfilterbuild.php +++ b/admin/models/fields/locallistingsfilterbuild.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage locallistingsfilterbuild.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldLocallistingsfilterbuild extends JFormFieldList /** * The locallistingsfilterbuild field type. * - * @var string + * @var string */ public $type = 'locallistingsfilterbuild'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldLocallistingsfilterbuild extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD_OPTION') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD_OPTION') . ' -'); - if ($results) + if ($_results) { // get local_listingsmodel - $model = SermondistributorHelper::getModel('local_listings'); - $results = array_unique($results); - foreach ($results as $build) + $_model = SermondistributorHelper::getModel('local_listings'); + $_results = array_unique($_results); + foreach ($_results as $build) { // Translate the build selection - $text = $model->selectionTranslation($build,'build'); + $_text = $_model->selectionTranslation($build,'build'); // Now add the build and its text to the options array - $_filter[] = JHtml::_('select.option', $build, JText::_($text)); + $_filter[] = Html::_('select.option', $build, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/preachers.php b/admin/models/fields/preachers.php index 5efa15b7..30f11d9c 100644 --- a/admin/models/fields/preachers.php +++ b/admin/models/fields/preachers.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,7 +41,7 @@ class JFormFieldPreachers extends JFormFieldList /** * The preachers field type. * - * @var string + * @var string */ public $type = 'preachers'; @@ -61,7 +65,7 @@ class JFormFieldPreachers extends JFormFieldList $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -77,7 +81,7 @@ class JFormFieldPreachers extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -90,20 +94,20 @@ class JFormFieldPreachers extends JFormFieldList $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create preacher - if ($user->authorise('preacher.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('preacher.create', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit preacher - if ($user->authorise('preacher.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('preacher.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -136,7 +140,7 @@ class JFormFieldPreachers extends JFormFieldList if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
' .$html . implode('',$button).'
'; @@ -148,7 +152,7 @@ class JFormFieldPreachers extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/series.php b/admin/models/fields/series.php index 573aea0a..55b63a9c 100644 --- a/admin/models/fields/series.php +++ b/admin/models/fields/series.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,7 +41,7 @@ class JFormFieldSeries extends JFormFieldList /** * The series field type. * - * @var string + * @var string */ public $type = 'series'; @@ -61,7 +65,7 @@ class JFormFieldSeries extends JFormFieldList $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -77,7 +81,7 @@ class JFormFieldSeries extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -90,20 +94,20 @@ class JFormFieldSeries extends JFormFieldList $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create series - if ($user->authorise('series.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('series.create', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit series - if ($user->authorise('series.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('series.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -136,7 +140,7 @@ class JFormFieldSeries extends JFormFieldList if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
' .$html . implode('',$button).'
'; @@ -148,7 +152,7 @@ class JFormFieldSeries extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/sermon.php b/admin/models/fields/sermon.php index 120e3fe1..dbe4d20c 100644 --- a/admin/models/fields/sermon.php +++ b/admin/models/fields/sermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,7 +41,7 @@ class JFormFieldSermon extends JFormFieldList /** * The sermon field type. * - * @var string + * @var string */ public $type = 'sermon'; @@ -61,7 +65,7 @@ class JFormFieldSermon extends JFormFieldList $script = array(); $button_code_name = $this->getAttribute('name'); // get the input from url - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; // get the view name & id $values = $jinput->getArray(array( @@ -77,7 +81,7 @@ class JFormFieldSermon extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -90,20 +94,20 @@ class JFormFieldSermon extends JFormFieldList $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); $button_label = ucfirst(strtolower($button_label)); // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // only add if user allowed to create sermon - if ($user->authorise('sermon.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('sermon.create', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit sermon - if ($user->authorise('sermon.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('sermon.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -136,7 +140,7 @@ class JFormFieldSermon extends JFormFieldList if (is_array($button) && count($button) > 0) { // Load the needed script. - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(implode(' ',$script)); // return the button attached to input field. return '
' .$html . implode('',$button).'
'; @@ -148,7 +152,7 @@ class JFormFieldSermon extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/sermonsfilterlinktype.php b/admin/models/fields/sermonsfilterlinktype.php index 1ca8cae0..8f908a7a 100644 --- a/admin/models/fields/sermonsfilterlinktype.php +++ b/admin/models/fields/sermonsfilterlinktype.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermonsfilterlinktype.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldSermonsfilterlinktype extends JFormFieldList /** * The sermonsfilterlinktype field type. * - * @var string + * @var string */ public $type = 'sermonsfilterlinktype'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldSermonsfilterlinktype extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_DOWNLOAD_LINK_OPTION') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_DOWNLOAD_LINK_OPTION') . ' -'); - if ($results) + if ($_results) { // get sermonsmodel - $model = SermondistributorHelper::getModel('sermons'); - $results = array_unique($results); - foreach ($results as $link_type) + $_model = SermondistributorHelper::getModel('sermons'); + $_results = array_unique($_results); + foreach ($_results as $link_type) { // Translate the link_type selection - $text = $model->selectionTranslation($link_type,'link_type'); + $_text = $_model->selectionTranslation($link_type,'link_type'); // Now add the link_type and its text to the options array - $_filter[] = JHtml::_('select.option', $link_type, JText::_($text)); + $_filter[] = Html::_('select.option', $link_type, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/sermonsfiltersource.php b/admin/models/fields/sermonsfiltersource.php index 93da4c4f..3ce2d9ac 100644 --- a/admin/models/fields/sermonsfiltersource.php +++ b/admin/models/fields/sermonsfiltersource.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermonsfiltersource.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,19 +41,19 @@ class JFormFieldSermonsfiltersource extends JFormFieldList /** * The sermonsfiltersource field type. * - * @var string + * @var string */ public $type = 'sermonsfiltersource'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -62,21 +66,21 @@ class JFormFieldSermonsfiltersource extends JFormFieldList // Reset the query using our newly populated query object. $db->setQuery($query); - $results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_FILE_SOURCE') . ' -'); + $_results = $db->loadColumn(); + $_filter = []; + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_FILE_SOURCE') . ' -'); - if ($results) + if ($_results) { // get sermonsmodel - $model = SermondistributorHelper::getModel('sermons'); - $results = array_unique($results); - foreach ($results as $source) + $_model = SermondistributorHelper::getModel('sermons'); + $_results = array_unique($_results); + foreach ($_results as $source) { // Translate the source selection - $text = $model->selectionTranslation($source,'source'); + $_text = $_model->selectionTranslation($source,'source'); // Now add the source and its text to the options array - $_filter[] = JHtml::_('select.option', $source, JText::_($text)); + $_filter[] = Html::_('select.option', $source, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index a7116df7..042b490f 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage siteviewfolderlist.php @@ -25,6 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // import the list field type jimport('joomla.form.helper'); JFormHelper::loadFieldClass('list'); @@ -37,33 +42,36 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList /** * The siteviewfolderlist field type. * - * @var string + * @var string */ public $type = 'siteviewfolderlist'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // get custom folder files - $localfolder = JPATH_COMPONENT_SITE.'/views'; + $localfolders = []; + $localfolders[] = JPATH_SITE . '/components/com_sermondistributor/views'; + $localfolders[] = JPATH_SITE . '/components/com_sermondistributor/src/View'; // set the default - $options = array(); - // import all needed classes - jimport('joomla.filesystem.folder'); + $options = []; // now check if there are files in the folder - if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) + foreach ($localfolders as $localfolder) { - if ($this->multiple === false) + if (is_dir($localfolder) && $folders = \Joomla\Filesystem\Folder::folders($localfolder)) { - $options[] = JHtml::_('select.option', '', JText::_('COM_SERMONDISTRIBUTOR_SELECT_A_SITE_VIEW')); - } - foreach ($folders as $folder) - { - $options[] = JHtml::_('select.option', $folder, SermondistributorHelper::safeString($folder, 'W')); + if ($this->multiple === false) + { + $options[] = Html::_('select.option', '', Text::_('COM_SERMONDISTRIBUTOR_SELECT_A_SITE_VIEW')); + } + foreach ($folders as $folder) + { + $options[] = Html::_('select.option', $folder, StringHelper::safe($folder, 'W')); + } } } return $options; diff --git a/admin/models/forms/external_source.xml b/admin/models/forms/external_source.xml index 8b4fd726..768f3397 100644 --- a/admin/models/forms/external_source.xml +++ b/admin/models/forms/external_source.xml @@ -73,6 +73,7 @@ label="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -357,7 +358,7 @@ hint="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_OAUTHTOKEN_HINT" /> - +
diff --git a/admin/models/forms/filter_help_documents.xml b/admin/models/forms/filter_help_documents.xml index ac08a878..1a9805bd 100644 --- a/admin/models/forms/filter_help_documents.xml +++ b/admin/models/forms/filter_help_documents.xml @@ -82,10 +82,10 @@ - - - - + + + + diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index 0c309dc7..ab92236e 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -81,6 +81,7 @@ label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -139,9 +140,9 @@ - + @@ -283,7 +283,7 @@ />
- +
diff --git a/admin/models/forms/local_listing.xml b/admin/models/forms/local_listing.xml index 460c341d..e66a2792 100644 --- a/admin/models/forms/local_listing.xml +++ b/admin/models/forms/local_listing.xml @@ -73,6 +73,7 @@ label="COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_LOCAL_LISTING_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -173,7 +174,7 @@ hint="COM_SERMONDISTRIBUTOR_LOCAL_LISTING_URL_HINT" />
- +
diff --git a/admin/models/forms/preacher.xml b/admin/models/forms/preacher.xml index 14881dfe..f4bb4840 100644 --- a/admin/models/forms/preacher.xml +++ b/admin/models/forms/preacher.xml @@ -81,6 +81,7 @@ label="COM_SERMONDISTRIBUTOR_PREACHER_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_PREACHER_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -215,7 +216,7 @@ />
- +
diff --git a/admin/models/forms/series.xml b/admin/models/forms/series.xml index b88debda..01534895 100644 --- a/admin/models/forms/series.xml +++ b/admin/models/forms/series.xml @@ -81,6 +81,7 @@ label="COM_SERMONDISTRIBUTOR_SERIES_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_SERIES_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -203,7 +204,7 @@ />
- +
diff --git a/admin/models/forms/sermon.xml b/admin/models/forms/sermon.xml index 44550ea6..06159487 100644 --- a/admin/models/forms/sermon.xml +++ b/admin/models/forms/sermon.xml @@ -81,6 +81,7 @@ label="COM_SERMONDISTRIBUTOR_SERMON_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_SERMON_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -255,7 +256,6 @@ mode="ajax" label="COM_SERMONDISTRIBUTOR_SERMON_TAGS_LABEL" description="COM_SERMONDISTRIBUTOR_SERMON_TAGS_DESCRIPTION" - class="inputbox small" published="true" multiple="true" /> @@ -375,7 +375,7 @@ />
- +
diff --git a/admin/models/forms/statistic.xml b/admin/models/forms/statistic.xml index 5d6af32d..b42a113e 100644 --- a/admin/models/forms/statistic.xml +++ b/admin/models/forms/statistic.xml @@ -81,6 +81,7 @@ label="COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_LABEL" description="COM_SERMONDISTRIBUTOR_STATISTIC_VERSION_DESC" size="6" + default="1" readonly="true" filter="unset" /> @@ -202,7 +203,7 @@ />
- +
diff --git a/admin/models/help_document.php b/admin/models/help_document.php index 39fa2d8a..0fb0a360 100644 --- a/admin/models/help_document.php +++ b/admin/models/help_document.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.php @@ -25,10 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Sermondistributor Help_document Admin Model @@ -88,18 +98,18 @@ class SermondistributorModelHelp_document extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'help_document', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'help_document', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -150,7 +160,7 @@ class SermondistributorModelHelp_document extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -177,7 +187,7 @@ class SermondistributorModelHelp_document extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -190,7 +200,7 @@ class SermondistributorModelHelp_document extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -251,13 +261,13 @@ class SermondistributorModelHelp_document extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/help_document.js'; } - + /** * Method to test whether a record can be deleted. * @@ -276,7 +286,7 @@ class SermondistributorModelHelp_document extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('help_document.delete', 'com_sermondistributor.help_document.' . (int) $record->id); } @@ -294,8 +304,8 @@ class SermondistributorModelHelp_document extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -306,31 +316,31 @@ class SermondistributorModelHelp_document extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('help_document.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('help_document.edit', 'com_sermondistributor.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -338,19 +348,19 @@ class SermondistributorModelHelp_document extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -362,7 +372,7 @@ class SermondistributorModelHelp_document extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_help_document')); @@ -377,7 +387,7 @@ class SermondistributorModelHelp_document extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -392,10 +402,10 @@ class SermondistributorModelHelp_document extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.help_document.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.help_document.data', []); if (empty($data)) { @@ -423,7 +433,7 @@ class SermondistributorModelHelp_document extends AdminModel public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -431,7 +441,7 @@ class SermondistributorModelHelp_document extends AdminModel foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (SermondistributorHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -454,7 +464,7 @@ class SermondistributorModelHelp_document extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -470,7 +480,7 @@ class SermondistributorModelHelp_document extends AdminModel { return false; } - + return true; } @@ -490,10 +500,10 @@ class SermondistributorModelHelp_document extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -519,30 +529,30 @@ class SermondistributorModelHelp_document extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('help_document'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('help_document'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -579,8 +589,7 @@ class SermondistributorModelHelp_document extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -606,7 +615,7 @@ class SermondistributorModelHelp_document extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('help_document'); @@ -632,7 +641,7 @@ class SermondistributorModelHelp_document extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -645,7 +654,7 @@ class SermondistributorModelHelp_document extends AdminModel if (!$this->user->authorise('help_document.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -661,14 +670,14 @@ class SermondistributorModelHelp_document extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title); // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -680,7 +689,7 @@ class SermondistributorModelHelp_document extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -744,7 +753,7 @@ class SermondistributorModelHelp_document extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('help_document'); @@ -752,7 +761,7 @@ class SermondistributorModelHelp_document extends AdminModel if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -769,7 +778,7 @@ class SermondistributorModelHelp_document extends AdminModel { if (!$this->user->authorise('help_document.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -785,13 +794,13 @@ class SermondistributorModelHelp_document extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -835,7 +844,7 @@ class SermondistributorModelHelp_document extends AdminModel return true; } - + /** * Method to save the form data. * @@ -847,15 +856,15 @@ class SermondistributorModelHelp_document extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -865,11 +874,11 @@ class SermondistributorModelHelp_document extends AdminModel { $data['groups'] = (string) json_encode($data['groups']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -902,27 +911,27 @@ class SermondistributorModelHelp_document extends AdminModel { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['title']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['title']); + $data['alias'] = OutputFilter::stringURLSafe($data['title']); } - $table = JTable::getInstance('help_document', 'sermondistributorTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SAVE_WARNING'); + $msg = Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -932,7 +941,7 @@ class SermondistributorModelHelp_document extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -940,14 +949,14 @@ class SermondistributorModelHelp_document extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -960,7 +969,6 @@ class SermondistributorModelHelp_document extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -987,10 +995,10 @@ class SermondistributorModelHelp_document extends AdminModel // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1005,7 +1013,7 @@ class SermondistributorModelHelp_document extends AdminModel $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php index f0e6dfa3..6865e570 100644 --- a/admin/models/help_documents.php +++ b/admin/models/help_documents.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_documents.php @@ -25,18 +25,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Help_documents List Model */ class SermondistributorModelHelp_documents extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -68,7 +77,7 @@ class SermondistributorModelHelp_documents extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -139,7 +148,7 @@ class SermondistributorModelHelp_documents extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -154,12 +163,12 @@ class SermondistributorModelHelp_documents extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -171,22 +180,13 @@ class SermondistributorModelHelp_documents extends ListModel continue; } - // decode groups - $groupsArray = json_decode($item->groups, true); - if (SermondistributorHelper::checkArray($groupsArray)) - { - $groupsNames = array(); - foreach ($groupsArray as $groups) - { - $groupsNames[] = SermondistributorHelper::getGroupName($groups); - } - $item->groups = implode(', ', $groupsNames); - } + // convert groups + $item->groups = JsonHelper::string($item->groups, ', ', 'groups'); } } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -197,7 +197,7 @@ class SermondistributorModelHelp_documents extends ListModel } } - + // return items return $items; } @@ -205,7 +205,7 @@ class SermondistributorModelHelp_documents extends ListModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -219,7 +219,7 @@ class SermondistributorModelHelp_documents extends ListModel 3 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL' ); // Now check if value is found in this array - if (isset($typeArray[$value]) && SermondistributorHelper::checkString($typeArray[$value])) + if (isset($typeArray[$value]) && StringHelper::check($typeArray[$value])) { return $typeArray[$value]; } @@ -232,25 +232,25 @@ class SermondistributorModelHelp_documents extends ListModel 2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE' ); // Now check if value is found in this array - if (isset($locationArray[$value]) && SermondistributorHelper::checkString($locationArray[$value])) + if (isset($locationArray[$value]) && StringHelper::check($locationArray[$value])) { return $locationArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -279,7 +279,7 @@ class SermondistributorModelHelp_documents extends ListModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -303,7 +303,7 @@ class SermondistributorModelHelp_documents extends ListModel else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR g. LIKE '.$search.' OR a.site_view LIKE '.$search.' OR h. LIKE '.$search.')'); + $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR h. LIKE '.$search.' OR a.site_view LIKE '.$search.' OR i. LIKE '.$search.')'); } } @@ -320,7 +320,7 @@ class SermondistributorModelHelp_documents extends ListModel $query->where('a.type = ' . (int) $_type); } } - elseif (SermondistributorHelper::checkString($_type)) + elseif (StringHelper::check($_type)) { $query->where('a.type = ' . $db->quote($db->escape($_type))); } @@ -337,7 +337,7 @@ class SermondistributorModelHelp_documents extends ListModel $query->where('a.location = ' . (int) $_location); } } - elseif (SermondistributorHelper::checkString($_location)) + elseif (StringHelper::check($_location)) { $query->where('a.location = ' . $db->quote($db->escape($_location))); } @@ -354,7 +354,7 @@ class SermondistributorModelHelp_documents extends ListModel $query->where('a.admin_view = ' . (int) $_admin_view); } } - elseif (SermondistributorHelper::checkString($_admin_view)) + elseif (StringHelper::check($_admin_view)) { $query->where('a.admin_view = ' . $db->quote($db->escape($_admin_view))); } @@ -371,16 +371,18 @@ class SermondistributorModelHelp_documents extends ListModel $query->where('a.site_view = ' . (int) $_site_view); } } - elseif (SermondistributorHelper::checkString($_site_view)) + elseif (StringHelper::check($_site_view)) { $query->where('a.site_view = ' . $db->quote($db->escape($_site_view))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -398,17 +400,17 @@ class SermondistributorModelHelp_documents extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -452,7 +454,7 @@ class SermondistributorModelHelp_documents extends ListModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -472,7 +474,7 @@ class SermondistributorModelHelp_documents extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -490,16 +492,16 @@ class SermondistributorModelHelp_documents extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_help_document"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -508,7 +510,7 @@ class SermondistributorModelHelp_documents extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -523,13 +525,13 @@ class SermondistributorModelHelp_documents extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (SermondistributorHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || SermondistributorHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -548,19 +550,18 @@ class SermondistributorModelHelp_documents extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -572,7 +573,7 @@ class SermondistributorModelHelp_documents extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -593,7 +594,7 @@ class SermondistributorModelHelp_documents extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/import.php b/admin/models/import.php index 8171a98c..9058338d 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage import.php @@ -25,11 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Installer\InstallerHelper; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /*** * Sermondistributor Import Base Database Model @@ -39,8 +46,8 @@ class SermondistributorModelImport extends BaseDatabaseModel // set uploading values protected $use_streams = false; protected $allow_unsafe = false; - protected $safeFileOptions = array(); - + protected $safeFileOptions = []; + /** * @var object JTable object */ @@ -57,13 +64,13 @@ class SermondistributorModelImport extends BaseDatabaseModel * @var string */ protected $_context = 'com_sermondistributor.import'; - + /** * Import Settings */ - protected $getType = NULL; - protected $dataType = NULL; - + protected $getType = NULL; + protected $dataType = NULL; + /** * Method to auto-populate the model state. * @@ -74,7 +81,7 @@ class SermondistributorModelImport extends BaseDatabaseModel */ protected function populateState() { - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_sermondistributor.message')); $app->setUserState('com_sermondistributor.message', ''); @@ -94,14 +101,14 @@ class SermondistributorModelImport extends BaseDatabaseModel public function import() { $this->setState('action', 'import'); - $app = JFactory::getApplication(); - $session = JFactory::getSession(); + $app = Factory::getApplication(); + $session = Factory::getSession(); $package = null; $continue = false; // get import type $this->getType = $app->input->getString('gettype', NULL); // get import type - $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); + $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); if ($package === null) { @@ -122,9 +129,9 @@ class SermondistributorModelImport extends BaseDatabaseModel break; case 'continue': - $continue = true; - $package = $session->get('package', null); - $package = json_decode($package, true); + $continue = true; + $package = $session->get('package', null); + $package = json_decode($package, true); // clear session $session->clear('package'); $session->clear('dataType'); @@ -132,7 +139,7 @@ class SermondistributorModelImport extends BaseDatabaseModel break; default: - $app->setUserState('com_sermondistributor.message', JText::_('COM_SERMONDISTRIBUTOR_IMPORT_NO_IMPORT_TYPE_FOUND')); + $app->setUserState('com_sermondistributor.message', Text::_('COM_SERMONDISTRIBUTOR_IMPORT_NO_IMPORT_TYPE_FOUND')); return false; break; @@ -146,10 +153,10 @@ class SermondistributorModelImport extends BaseDatabaseModel $this->remove($package['packagename']); } - $app->setUserState('com_sermondistributor.message', JText::_('COM_SERMONDISTRIBUTOR_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $app->setUserState('com_sermondistributor.message', Text::_('COM_SERMONDISTRIBUTOR_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } - + // first link data to table headers if(!$continue){ $package = json_encode($package); @@ -158,13 +165,13 @@ class SermondistributorModelImport extends BaseDatabaseModel $session->set('hasPackage', true); return true; } - + // set the data $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true); if (!$this->setData($package,$this->dataType,$headerList)) { // There was an error importing the package - $msg = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_ERROR'); + $msg = Text::_('COM_SERMONDISTRIBUTOR_IMPORT_ERROR'); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { @@ -176,12 +183,12 @@ class SermondistributorModelImport extends BaseDatabaseModel else { // Package imported sucessfully - $msg = JText::sprintf('COM_SERMONDISTRIBUTOR_IMPORT_SUCCESS', $package['packagename']); + $msg = Text::sprintf('COM_SERMONDISTRIBUTOR_IMPORT_SUCCESS', $package['packagename']); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { - $app->setUserState('com_sermondistributor.redirect_url', 'index.php?option=com_sermondistributor&view='.$back); - $session->clear('backto_VDM_IMPORT'); + $app->setUserState('com_sermondistributor.redirect_url', 'index.php?option=com_sermondistributor&view='.$back); + $session->clear('backto_VDM_IMPORT'); } $result = true; } @@ -192,7 +199,7 @@ class SermondistributorModelImport extends BaseDatabaseModel // remove file after import $this->remove($package['packagename']); $session->clear($this->getType.'_VDM_IMPORTHEADERS'); - + return $result; } @@ -202,48 +209,47 @@ class SermondistributorModelImport extends BaseDatabaseModel * @return spreadsheet definition or false on failure */ protected function _getPackageFromUpload() - { + { // Get the uploaded file information - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $userfile = $input->files->get('import_package', null, 'raw'); - + // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } // Build the appropriate paths - $config = JFactory::getConfig(); + $config = Factory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; // Move uploaded file - jimport('joomla.filesystem.file'); $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Was the package downloaded? if (!$p_file) { - $session = JFactory::getSession(); + $session = Factory::getSession(); $session->clear('package'); $session->clear('dataType'); $session->clear('hasPackage'); @@ -265,16 +271,16 @@ class SermondistributorModelImport extends BaseDatabaseModel */ protected function _getPackageFromFolder() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; // Get the path to the package to import $p_dir = $input->getString('import_directory'); - $p_dir = JPath::clean($p_dir); + $p_dir = Path::clean($p_dir); // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -284,17 +290,17 @@ class SermondistributorModelImport extends BaseDatabaseModel // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } - + // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - + $package['packagename'] = null; $package['dir'] = $p_dir; $package['type'] = $type; @@ -310,26 +316,26 @@ class SermondistributorModelImport extends BaseDatabaseModel */ protected function _getPackageFromUrl() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $input = $app->input; - + // Get the URL of the package to import $url = $input->getString('import_url'); // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } // Download the package at the URL given - $p_file = JInstallerHelper::downloadPackage($url); + $p_file = InstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -338,7 +344,7 @@ class SermondistributorModelImport extends BaseDatabaseModel return $package; } - + /** * Check a file and verifies it as a spreadsheet file * Supports .csv .xlsx .xls and .ods @@ -350,29 +356,29 @@ class SermondistributorModelImport extends BaseDatabaseModel */ protected function check($archivename) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Clean the name - $archivename = JPath::clean($archivename); - + $archivename = Path::clean($archivename); + // check the extention if(!$this->checkExtension($archivename)) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); // set Package Name $check['packagename'] = $archivename; - + // set directory $check['dir'] = $config->get('tmp_path'). '/' .$archivename; - + // set type $check['type'] = $this->getType; - + return $check; } @@ -409,8 +415,8 @@ class SermondistributorModelImport extends BaseDatabaseModel protected function remove($package) { jimport('joomla.filesystem.file'); - - $config = JFactory::getConfig(); + + $config = Factory::getConfig(); $package = $config->get('tmp_path'). '/' .$package; // Is the package file a valid file? @@ -418,10 +424,10 @@ class SermondistributorModelImport extends BaseDatabaseModel { File::delete($package); } - elseif (is_file(JPath::clean($package))) + elseif (is_file(Path::clean($package))) { // It might also be just a base filename - File::delete(JPath::clean($package)); + File::delete(Path::clean($package)); } } @@ -435,11 +441,11 @@ class SermondistributorModelImport extends BaseDatabaseModel **/ protected function setData($package,$table,$target_headers) { - if (SermondistributorHelper::checkArray($target_headers)) + if (UtilitiesArrayHelper::check($target_headers)) { // make sure the file is loaded SermondistributorHelper::composerAutoload('phpspreadsheet'); - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; foreach($target_headers as $header) { if (($column = $jinput->getString($header, false)) !== false || @@ -479,10 +485,10 @@ class SermondistributorModelImport extends BaseDatabaseModel protected function save($data,$table) { // import the data if there is any - if(SermondistributorHelper::checkArray($data['array'])) + if(UtilitiesArrayHelper::check($data['array'])) { // get user object - $user = JFactory::getUser(); + $user = Factory::getUser(); // remove header if it has headers $id_key = $data['target_headers']['id']; $published_key = $data['target_headers']['published']; @@ -497,14 +503,14 @@ class SermondistributorModelImport extends BaseDatabaseModel } // make sure there is still values in array and that it was not only headers - if(SermondistributorHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) + if(UtilitiesArrayHelper::check($data['array']) && $user->authorise($table.'.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) { // set target. $target = array_flip($data['target_headers']); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // set some defaults - $todayDate = JFactory::getDate()->toSql(); + $todayDate = Factory::getDate()->toSql(); // get global action permissions $canDo = SermondistributorHelper::getActions($table); $canEdit = $canDo->get('core.edit'); @@ -691,13 +697,13 @@ class SermondistributorModelImport extends BaseDatabaseModel protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $alias = JFilterOutput::stringURLUnicodeSlug($name); + $alias = OutputFilter::stringURLUnicodeSlug($name); } else { - $alias = JFilterOutput::stringURLSafe($name); + $alias = OutputFilter::stringURLSafe($name); } // must be a uniqe alias if ($type) @@ -706,7 +712,7 @@ class SermondistributorModelImport extends BaseDatabaseModel } return $alias; } - + /** * Method to generate a uniqe value. * @@ -721,16 +727,16 @@ class SermondistributorModelImport extends BaseDatabaseModel // insure the filed is always uniqe while (isset($this->uniqeValueArray[$type][$field][$value])) { - $value = JString::increment($value, 'dash'); + $value = StringHelper::increment($value, 'dash'); } $this->uniqeValueArray[$type][$field][$value] = $value; return $value; } - + protected function getAliasesUsed($table) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // first we check if there is a alias column $columns = $db->getTableColumns('#__sermondistributor_'.$table); if(isset($columns['alias'])){ diff --git a/admin/models/local_listing.php b/admin/models/local_listing.php index ead9f874..187d5f67 100644 --- a/admin/models/local_listing.php +++ b/admin/models/local_listing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listing.php @@ -25,10 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Sermondistributor Local_listing Admin Model @@ -80,16 +91,16 @@ class SermondistributorModelLocal_listing extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'local_listing', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'local_listing', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -103,7 +114,7 @@ class SermondistributorModelLocal_listing extends AdminModel public function searchForId($value, $key = 'key') { // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -123,7 +134,7 @@ class SermondistributorModelLocal_listing extends AdminModel } return false; } - + /** * Method to get a single record. * @@ -156,7 +167,7 @@ class SermondistributorModelLocal_listing extends AdminModel // Get the basic encryption. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); if (!empty($item->url) && $basickey && !is_numeric($item->url) && $item->url === base64_encode(base64_decode($item->url, true))) { @@ -179,7 +190,7 @@ class SermondistributorModelLocal_listing extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -206,7 +217,7 @@ class SermondistributorModelLocal_listing extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -219,7 +230,7 @@ class SermondistributorModelLocal_listing extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -384,13 +395,13 @@ class SermondistributorModelLocal_listing extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/local_listing.js'; } - + /** * Method to test whether a record can be deleted. * @@ -409,7 +420,7 @@ class SermondistributorModelLocal_listing extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('local_listing.delete', 'com_sermondistributor.local_listing.' . (int) $record->id); } @@ -427,8 +438,8 @@ class SermondistributorModelLocal_listing extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -439,31 +450,31 @@ class SermondistributorModelLocal_listing extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('local_listing.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('local_listing.edit', 'com_sermondistributor.local_listing.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('local_listing.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -471,19 +482,19 @@ class SermondistributorModelLocal_listing extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -495,7 +506,7 @@ class SermondistributorModelLocal_listing extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_local_listing')); @@ -510,7 +521,7 @@ class SermondistributorModelLocal_listing extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -525,10 +536,10 @@ class SermondistributorModelLocal_listing extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.local_listing.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.local_listing.data', []); if (empty($data)) { @@ -551,7 +562,7 @@ class SermondistributorModelLocal_listing extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -567,7 +578,7 @@ class SermondistributorModelLocal_listing extends AdminModel { return false; } - + return true; } @@ -587,10 +598,10 @@ class SermondistributorModelLocal_listing extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -616,30 +627,30 @@ class SermondistributorModelLocal_listing extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('local_listing'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('local_listing'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -676,8 +687,7 @@ class SermondistributorModelLocal_listing extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -703,7 +713,7 @@ class SermondistributorModelLocal_listing extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('local_listing'); @@ -729,7 +739,7 @@ class SermondistributorModelLocal_listing extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -742,7 +752,7 @@ class SermondistributorModelLocal_listing extends AdminModel if (!$this->user->authorise('local_listing.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -758,19 +768,19 @@ class SermondistributorModelLocal_listing extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (SermondistributorHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -782,7 +792,7 @@ class SermondistributorModelLocal_listing extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -846,7 +856,7 @@ class SermondistributorModelLocal_listing extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('local_listing'); @@ -854,7 +864,7 @@ class SermondistributorModelLocal_listing extends AdminModel if (!$this->canDo->get('local_listing.edit') && !$this->canDo->get('local_listing.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -871,7 +881,7 @@ class SermondistributorModelLocal_listing extends AdminModel { if (!$this->user->authorise('local_listing.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -887,13 +897,13 @@ class SermondistributorModelLocal_listing extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -937,7 +947,7 @@ class SermondistributorModelLocal_listing extends AdminModel return true; } - + /** * Method to save the form data. * @@ -949,15 +959,15 @@ class SermondistributorModelLocal_listing extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -965,18 +975,18 @@ class SermondistributorModelLocal_listing extends AdminModel // Get the basic encryption key. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Encrypt data url. if (isset($data['url']) && $basickey) { $data['url'] = $basic->encryptString($data['url']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -986,7 +996,7 @@ class SermondistributorModelLocal_listing extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -994,14 +1004,14 @@ class SermondistributorModelLocal_listing extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1014,7 +1024,6 @@ class SermondistributorModelLocal_listing extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1040,7 +1049,7 @@ class SermondistributorModelLocal_listing extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/local_listings.php b/admin/models/local_listings.php index 0885ef43..6abdd054 100644 --- a/admin/models/local_listings.php +++ b/admin/models/local_listings.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listings.php @@ -25,18 +25,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\FOF\Encrypt\AES; /** * Local_listings List Model */ class SermondistributorModelLocal_listings extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -67,7 +76,7 @@ class SermondistributorModelLocal_listings extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -138,7 +147,7 @@ class SermondistributorModelLocal_listings extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -153,12 +162,12 @@ class SermondistributorModelLocal_listings extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -174,7 +183,7 @@ class SermondistributorModelLocal_listings extends ListModel } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -183,7 +192,7 @@ class SermondistributorModelLocal_listings extends ListModel } } - + // return items return $items; } @@ -191,7 +200,7 @@ class SermondistributorModelLocal_listings extends ListModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -204,25 +213,25 @@ class SermondistributorModelLocal_listings extends ListModel 2 => 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_DYNAMIC_AUTOMATIC_BUILD' ); // Now check if value is found in this array - if (isset($buildArray[$value]) && SermondistributorHelper::checkString($buildArray[$value])) + if (isset($buildArray[$value]) && StringHelper::check($buildArray[$value])) { return $buildArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -273,7 +282,7 @@ class SermondistributorModelLocal_listings extends ListModel $query->where('a.build = ' . (int) $_build); } } - elseif (SermondistributorHelper::checkString($_build)) + elseif (StringHelper::check($_build)) { $query->where('a.build = ' . $db->quote($db->escape($_build))); } @@ -290,16 +299,18 @@ class SermondistributorModelLocal_listings extends ListModel $query->where('a.external_source = ' . (int) $_external_source); } } - elseif (SermondistributorHelper::checkString($_external_source)) + elseif (StringHelper::check($_external_source)) { $query->where('a.external_source = ' . $db->quote($db->escape($_external_source))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -317,17 +328,17 @@ class SermondistributorModelLocal_listings extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -367,10 +378,10 @@ class SermondistributorModelLocal_listings extends ListModel // Get the basic encryption key. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -395,7 +406,7 @@ class SermondistributorModelLocal_listings extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -413,16 +424,16 @@ class SermondistributorModelLocal_listings extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_local_listing"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -431,7 +442,7 @@ class SermondistributorModelLocal_listings extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -459,19 +470,18 @@ class SermondistributorModelLocal_listings extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -483,7 +493,7 @@ class SermondistributorModelLocal_listings extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -504,7 +514,7 @@ class SermondistributorModelLocal_listings extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/manual_updater.php b/admin/models/manual_updater.php index 7a184def..bd10468a 100644 --- a/admin/models/manual_updater.php +++ b/admin/models/manual_updater.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage manual_updater.php @@ -25,8 +25,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Manual_updater @@ -55,19 +62,19 @@ class SermondistributorModelManual_updater extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); - $this->authorisedGroups = $this->user->getAuthorisedGroups(); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; - $this->initSet = true; + $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -94,12 +101,12 @@ class SermondistributorModelManual_updater extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access items if (!$user->authorise('manual_updater.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('Not authorised!'), 'error'); // redirect away if not a correct (TODO for now we go to default view) $app->redirect('index.php?option=com_sermondistributor'); return false; @@ -108,22 +115,22 @@ class SermondistributorModelManual_updater extends ListModel $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Get the basic encryption. $basickey = SermondistributorHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey); + $basic = new AES($basickey); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if we can decode filetypes - if (SermondistributorHelper::checkJson($item->filetypes)) + if (isset($item->filetypes) && JsonHelper::check($item->filetypes)) { // Decode filetypes $item->filetypes = json_decode($item->filetypes, true); @@ -149,7 +156,7 @@ class SermondistributorModelManual_updater extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/admin/models/preacher.php b/admin/models/preacher.php index 9c8a0c23..da4f0c92 100644 --- a/admin/models/preacher.php +++ b/admin/models/preacher.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php @@ -25,10 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Sermondistributor Preacher Admin Model @@ -80,18 +91,18 @@ class SermondistributorModelPreacher extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'preacher', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'preacher', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -134,9 +145,9 @@ class SermondistributorModelPreacher extends AdminModel public function getVvvsermons() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -179,7 +190,7 @@ class SermondistributorModelPreacher extends AdminModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -205,12 +216,12 @@ class SermondistributorModelPreacher extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -223,7 +234,7 @@ class SermondistributorModelPreacher extends AdminModel } // Add the tags - $item->tags = new JHelperTags; + $item->tags = new TagsHelper; $item->tags->getTagIds( $item->id, 'com_sermondistributor.sermon' ); @@ -243,7 +254,7 @@ class SermondistributorModelPreacher extends AdminModel } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -262,7 +273,7 @@ class SermondistributorModelPreacher extends AdminModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslationVvvsermons($value,$name) { @@ -274,7 +285,7 @@ class SermondistributorModelPreacher extends AdminModel 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' ); // Now check if value is found in this array - if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) + if (isset($link_typeArray[$value]) && UtilitiesStringHelper::check($link_typeArray[$value])) { return $link_typeArray[$value]; } @@ -289,7 +300,7 @@ class SermondistributorModelPreacher extends AdminModel 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array - if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) + if (isset($sourceArray[$value]) && UtilitiesStringHelper::check($sourceArray[$value])) { return $sourceArray[$value]; } @@ -308,7 +319,7 @@ class SermondistributorModelPreacher extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -335,7 +346,7 @@ class SermondistributorModelPreacher extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -348,7 +359,7 @@ class SermondistributorModelPreacher extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -411,13 +422,13 @@ class SermondistributorModelPreacher extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/preacher.js'; } - + /** * Method to test whether a record can be deleted. * @@ -436,7 +447,7 @@ class SermondistributorModelPreacher extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('preacher.delete', 'com_sermondistributor.preacher.' . (int) $record->id); } @@ -454,8 +465,8 @@ class SermondistributorModelPreacher extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -466,31 +477,31 @@ class SermondistributorModelPreacher extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('preacher.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('preacher.edit', 'com_sermondistributor.preacher.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('preacher.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -498,19 +509,19 @@ class SermondistributorModelPreacher extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -522,7 +533,7 @@ class SermondistributorModelPreacher extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_preacher')); @@ -537,7 +548,7 @@ class SermondistributorModelPreacher extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -552,10 +563,10 @@ class SermondistributorModelPreacher extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.preacher.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.preacher.data', []); if (empty($data)) { @@ -578,7 +589,7 @@ class SermondistributorModelPreacher extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -594,7 +605,7 @@ class SermondistributorModelPreacher extends AdminModel { return false; } - + return true; } @@ -614,10 +625,10 @@ class SermondistributorModelPreacher extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -643,30 +654,30 @@ class SermondistributorModelPreacher extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('preacher'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('preacher'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -703,8 +714,7 @@ class SermondistributorModelPreacher extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -730,7 +740,7 @@ class SermondistributorModelPreacher extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('preacher'); @@ -756,7 +766,7 @@ class SermondistributorModelPreacher extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -769,7 +779,7 @@ class SermondistributorModelPreacher extends AdminModel if (!$this->user->authorise('preacher.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -785,14 +795,14 @@ class SermondistributorModelPreacher extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -804,7 +814,7 @@ class SermondistributorModelPreacher extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -868,7 +878,7 @@ class SermondistributorModelPreacher extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('preacher'); @@ -876,7 +886,7 @@ class SermondistributorModelPreacher extends AdminModel if (!$this->canDo->get('preacher.edit') && !$this->canDo->get('preacher.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -893,7 +903,7 @@ class SermondistributorModelPreacher extends AdminModel { if (!$this->user->authorise('preacher.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -909,13 +919,13 @@ class SermondistributorModelPreacher extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -959,7 +969,7 @@ class SermondistributorModelPreacher extends AdminModel return true; } - + /** * Method to save the form data. * @@ -971,23 +981,23 @@ class SermondistributorModelPreacher extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1020,27 +1030,27 @@ class SermondistributorModelPreacher extends AdminModel { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['name']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + $data['alias'] = OutputFilter::stringURLSafe($data['name']); } - $table = JTable::getInstance('preacher', 'sermondistributorTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_SERMONDISTRIBUTOR_PREACHER_SAVE_WARNING'); + $msg = Text::_('COM_SERMONDISTRIBUTOR_PREACHER_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -1050,7 +1060,7 @@ class SermondistributorModelPreacher extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1058,14 +1068,14 @@ class SermondistributorModelPreacher extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1078,7 +1088,6 @@ class SermondistributorModelPreacher extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1105,10 +1114,10 @@ class SermondistributorModelPreacher extends AdminModel // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1123,7 +1132,7 @@ class SermondistributorModelPreacher extends AdminModel $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/preachers.php b/admin/models/preachers.php index b584c48e..911c9769 100644 --- a/admin/models/preachers.php +++ b/admin/models/preachers.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php @@ -25,18 +25,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Preachers List Model */ class SermondistributorModelPreachers extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -65,7 +73,7 @@ class SermondistributorModelPreachers extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -115,7 +123,7 @@ class SermondistributorModelPreachers extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -130,12 +138,12 @@ class SermondistributorModelPreachers extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -149,22 +157,22 @@ class SermondistributorModelPreachers extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -193,7 +201,7 @@ class SermondistributorModelPreachers extends ListModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -223,10 +231,12 @@ class SermondistributorModelPreachers extends ListModel // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -244,17 +254,17 @@ class SermondistributorModelPreachers extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -298,7 +308,7 @@ class SermondistributorModelPreachers extends ListModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -318,7 +328,7 @@ class SermondistributorModelPreachers extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -336,16 +346,16 @@ class SermondistributorModelPreachers extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_preacher"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -354,7 +364,7 @@ class SermondistributorModelPreachers extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -369,13 +379,13 @@ class SermondistributorModelPreachers extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (SermondistributorHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || SermondistributorHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -391,19 +401,18 @@ class SermondistributorModelPreachers extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -415,7 +424,7 @@ class SermondistributorModelPreachers extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -436,7 +445,7 @@ class SermondistributorModelPreachers extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/series.php b/admin/models/series.php index 7fdca8d4..92b80a87 100644 --- a/admin/models/series.php +++ b/admin/models/series.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -25,10 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Sermondistributor Series Admin Model @@ -79,18 +90,18 @@ class SermondistributorModelSeries extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'series', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'series', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -133,9 +144,9 @@ class SermondistributorModelSeries extends AdminModel public function getVwcsermons() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -178,7 +189,7 @@ class SermondistributorModelSeries extends AdminModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -204,12 +215,12 @@ class SermondistributorModelSeries extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -222,7 +233,7 @@ class SermondistributorModelSeries extends AdminModel } // Add the tags - $item->tags = new JHelperTags; + $item->tags = new TagsHelper; $item->tags->getTagIds( $item->id, 'com_sermondistributor.sermon' ); @@ -242,7 +253,7 @@ class SermondistributorModelSeries extends AdminModel } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -261,7 +272,7 @@ class SermondistributorModelSeries extends AdminModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslationVwcsermons($value,$name) { @@ -273,7 +284,7 @@ class SermondistributorModelSeries extends AdminModel 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' ); // Now check if value is found in this array - if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) + if (isset($link_typeArray[$value]) && UtilitiesStringHelper::check($link_typeArray[$value])) { return $link_typeArray[$value]; } @@ -288,7 +299,7 @@ class SermondistributorModelSeries extends AdminModel 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array - if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) + if (isset($sourceArray[$value]) && UtilitiesStringHelper::check($sourceArray[$value])) { return $sourceArray[$value]; } @@ -307,7 +318,7 @@ class SermondistributorModelSeries extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -334,7 +345,7 @@ class SermondistributorModelSeries extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -347,7 +358,7 @@ class SermondistributorModelSeries extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -410,13 +421,13 @@ class SermondistributorModelSeries extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/series.js'; } - + /** * Method to test whether a record can be deleted. * @@ -435,7 +446,7 @@ class SermondistributorModelSeries extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('series.delete', 'com_sermondistributor.series.' . (int) $record->id); } @@ -453,8 +464,8 @@ class SermondistributorModelSeries extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -465,31 +476,31 @@ class SermondistributorModelSeries extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('series.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('series.edit', 'com_sermondistributor.series.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('series.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -497,19 +508,19 @@ class SermondistributorModelSeries extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -521,7 +532,7 @@ class SermondistributorModelSeries extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_series')); @@ -536,7 +547,7 @@ class SermondistributorModelSeries extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -551,10 +562,10 @@ class SermondistributorModelSeries extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.series.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.series.data', []); if (empty($data)) { @@ -577,7 +588,7 @@ class SermondistributorModelSeries extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -593,7 +604,7 @@ class SermondistributorModelSeries extends AdminModel { return false; } - + return true; } @@ -613,10 +624,10 @@ class SermondistributorModelSeries extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -642,30 +653,30 @@ class SermondistributorModelSeries extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('series'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('series'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -702,8 +713,7 @@ class SermondistributorModelSeries extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -729,7 +739,7 @@ class SermondistributorModelSeries extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('series'); @@ -755,7 +765,7 @@ class SermondistributorModelSeries extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -768,7 +778,7 @@ class SermondistributorModelSeries extends AdminModel if (!$this->user->authorise('series.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -784,14 +794,14 @@ class SermondistributorModelSeries extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -803,7 +813,7 @@ class SermondistributorModelSeries extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -867,7 +877,7 @@ class SermondistributorModelSeries extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('series'); @@ -875,7 +885,7 @@ class SermondistributorModelSeries extends AdminModel if (!$this->canDo->get('series.edit') && !$this->canDo->get('series.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -892,7 +902,7 @@ class SermondistributorModelSeries extends AdminModel { if (!$this->user->authorise('series.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -908,13 +918,13 @@ class SermondistributorModelSeries extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -958,7 +968,7 @@ class SermondistributorModelSeries extends AdminModel return true; } - + /** * Method to save the form data. * @@ -970,23 +980,23 @@ class SermondistributorModelSeries extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1019,27 +1029,27 @@ class SermondistributorModelSeries extends AdminModel { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['name']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + $data['alias'] = OutputFilter::stringURLSafe($data['name']); } - $table = JTable::getInstance('series', 'sermondistributorTable'); + $table = clone $this->getTable(); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_SERMONDISTRIBUTOR_SERIES_SAVE_WARNING'); + $msg = Text::_('COM_SERMONDISTRIBUTOR_SERIES_SAVE_WARNING'); } $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -1049,7 +1059,7 @@ class SermondistributorModelSeries extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1057,14 +1067,14 @@ class SermondistributorModelSeries extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1077,7 +1087,6 @@ class SermondistributorModelSeries extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1104,10 +1113,10 @@ class SermondistributorModelSeries extends AdminModel // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1122,7 +1131,7 @@ class SermondistributorModelSeries extends AdminModel $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/series_list.php b/admin/models/series_list.php index 4bc50497..017012f0 100644 --- a/admin/models/series_list.php +++ b/admin/models/series_list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series_list.php @@ -25,18 +25,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Series_list List Model */ class SermondistributorModelSeries_list extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -64,7 +72,7 @@ class SermondistributorModelSeries_list extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -107,7 +115,7 @@ class SermondistributorModelSeries_list extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -122,12 +130,12 @@ class SermondistributorModelSeries_list extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -141,22 +149,22 @@ class SermondistributorModelSeries_list extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -185,7 +193,7 @@ class SermondistributorModelSeries_list extends ListModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -215,10 +223,12 @@ class SermondistributorModelSeries_list extends ListModel // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -236,17 +246,17 @@ class SermondistributorModelSeries_list extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -290,7 +300,7 @@ class SermondistributorModelSeries_list extends ListModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -310,7 +320,7 @@ class SermondistributorModelSeries_list extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -328,16 +338,16 @@ class SermondistributorModelSeries_list extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_series"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -346,7 +356,7 @@ class SermondistributorModelSeries_list extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -361,13 +371,13 @@ class SermondistributorModelSeries_list extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (SermondistributorHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || SermondistributorHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -382,19 +392,18 @@ class SermondistributorModelSeries_list extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -406,7 +415,7 @@ class SermondistributorModelSeries_list extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -427,7 +436,7 @@ class SermondistributorModelSeries_list extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/sermon.php b/admin/models/sermon.php index e65876b5..303822b9 100644 --- a/admin/models/sermon.php +++ b/admin/models/sermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -25,10 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Sermondistributor Sermon Admin Model @@ -102,18 +113,18 @@ class SermondistributorModelSermon extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'sermon', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'sermon', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -158,7 +169,7 @@ class SermondistributorModelSermon extends AdminModel if (!empty($item->id)) { // Get Tag IDs. - $item->tags = new JHelperTags; + $item->tags = new TagsHelper; $item->tags->getTagIds($item->id, 'com_sermondistributor.sermon'); } } @@ -175,9 +186,9 @@ class SermondistributorModelSermon extends AdminModel public function getVwbstastics() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -222,7 +233,7 @@ class SermondistributorModelSermon extends AdminModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -248,12 +259,12 @@ class SermondistributorModelSermon extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -283,7 +294,7 @@ class SermondistributorModelSermon extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -310,7 +321,7 @@ class SermondistributorModelSermon extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -323,7 +334,7 @@ class SermondistributorModelSermon extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -386,13 +397,13 @@ class SermondistributorModelSermon extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/sermon.js'; } - + /** * Method to test whether a record can be deleted. * @@ -411,7 +422,7 @@ class SermondistributorModelSermon extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('sermon.delete', 'com_sermondistributor.sermon.' . (int) $record->id); } @@ -429,8 +440,8 @@ class SermondistributorModelSermon extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -441,31 +452,31 @@ class SermondistributorModelSermon extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('sermon.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('sermon.edit', 'com_sermondistributor.sermon.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('sermon.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -473,19 +484,19 @@ class SermondistributorModelSermon extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -497,7 +508,7 @@ class SermondistributorModelSermon extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_sermon')); @@ -512,7 +523,7 @@ class SermondistributorModelSermon extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -527,10 +538,10 @@ class SermondistributorModelSermon extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.sermon.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.sermon.data', []); if (empty($data)) { @@ -558,7 +569,7 @@ class SermondistributorModelSermon extends AdminModel public function validate($form, $data, $group = null) { // check if the not_required field is set - if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required'])) + if (isset($data['not_required']) && UtilitiesStringHelper::check($data['not_required'])) { $requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = array_unique($requiredFields); @@ -566,7 +577,7 @@ class SermondistributorModelSermon extends AdminModel foreach ($requiredFields as $requiredField) { // make sure there is a string value - if (SermondistributorHelper::checkString($requiredField)) + if (UtilitiesStringHelper::check($requiredField)) { // change to false $form->setFieldAttribute($requiredField, 'required', 'false'); @@ -589,7 +600,7 @@ class SermondistributorModelSermon extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -605,7 +616,7 @@ class SermondistributorModelSermon extends AdminModel { return false; } - + return true; } @@ -625,10 +636,10 @@ class SermondistributorModelSermon extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -654,30 +665,30 @@ class SermondistributorModelSermon extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('sermon'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('sermon'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -714,8 +725,7 @@ class SermondistributorModelSermon extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -741,7 +751,7 @@ class SermondistributorModelSermon extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('sermon'); @@ -782,7 +792,7 @@ class SermondistributorModelSermon extends AdminModel unset($values['category']); } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -795,7 +805,7 @@ class SermondistributorModelSermon extends AdminModel if (!$this->user->authorise('sermon.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -811,7 +821,7 @@ class SermondistributorModelSermon extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } @@ -826,7 +836,7 @@ class SermondistributorModelSermon extends AdminModel } // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -838,7 +848,7 @@ class SermondistributorModelSermon extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -902,7 +912,7 @@ class SermondistributorModelSermon extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('sermon'); @@ -910,7 +920,7 @@ class SermondistributorModelSermon extends AdminModel if (!$this->canDo->get('sermon.edit') && !$this->canDo->get('sermon.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -943,7 +953,7 @@ class SermondistributorModelSermon extends AdminModel { if (!$this->user->authorise('sermon.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -959,13 +969,13 @@ class SermondistributorModelSermon extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -1009,7 +1019,7 @@ class SermondistributorModelSermon extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1021,15 +1031,15 @@ class SermondistributorModelSermon extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } @@ -1045,11 +1055,11 @@ class SermondistributorModelSermon extends AdminModel { $data['manual_files'] = (string) json_encode($data['manual_files']); } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -1082,20 +1092,20 @@ class SermondistributorModelSermon extends AdminModel { if ($data['alias'] == null || empty($data['alias'])) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['name']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + $data['alias'] = OutputFilter::stringURLSafe($data['name']); } - $table = JTable::getInstance('sermon', 'sermondistributorTable'); + $table = clone $this->getTable(); - if ($table->load(array('alias' => $data['alias'], 'catid' => $data['catid'])) && ($table->id != $data['id'] || $data['id'] == 0)) + if ($table->load(['alias' => $data['alias'], 'catid' => $data['catid']]) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_SERMONDISTRIBUTOR_SERMON_SAVE_WARNING'); + $msg = Text::_('COM_SERMONDISTRIBUTOR_SERMON_SAVE_WARNING'); } list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']); @@ -1103,7 +1113,7 @@ class SermondistributorModelSermon extends AdminModel if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } @@ -1113,7 +1123,7 @@ class SermondistributorModelSermon extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1121,14 +1131,14 @@ class SermondistributorModelSermon extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1141,7 +1151,6 @@ class SermondistributorModelSermon extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1168,10 +1177,10 @@ class SermondistributorModelSermon extends AdminModel // Alter the title/s & alias $table = $this->getTable(); - while ($table->load(array('alias' => $alias))) + while ($table->load(['alias' => $alias])) { // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { foreach($title as $nr => &$_title) { @@ -1186,7 +1195,7 @@ class SermondistributorModelSermon extends AdminModel $alias = StringHelper::increment($alias, 'dash'); } // Check if this is an array of titles - if (SermondistributorHelper::checkArray($title)) + if (UtilitiesArrayHelper::check($title)) { $title[] = $alias; return $title; diff --git a/admin/models/sermondistributor.php b/admin/models/sermondistributor.php index 6e1d10fb..5c43e7f2 100644 --- a/admin/models/sermondistributor.php +++ b/admin/models/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,8 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor List Model @@ -36,15 +45,15 @@ class SermondistributorModelSermondistributor extends ListModel public function getIcons() { // load user for access menus - $user = JFactory::getUser(); + $user = Factory::getUser(); // reset icon array - $icons = array(); + $icons = []; // view groups array $viewGroups = array( 'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid_qpo0O0oqp_com_sermondistributor_po0O0oq_sermon', 'png.series.add', 'png.series_list', 'png.statistics', 'png.external_source.add', 'png.external_sources', 'png.manual_updater', 'png.local_listings', 'png.help_documents') ); // view access array - $viewAccess = array( + $viewAccess = [ 'manual_updater.access' => 'manual_updater.access', 'manual_updater.submenu' => 'manual_updater.submenu', 'manual_updater.dashboard_list' => 'manual_updater.dashboard_list', @@ -86,12 +95,13 @@ class SermondistributorModelSermondistributor extends ListModel 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', 'help_documents.submenu' => 'help_document.submenu', - 'help_documents.dashboard_list' => 'help_document.dashboard_list'); + 'help_documents.dashboard_list' => 'help_document.dashboard_list', + ]; // loop over the $views foreach($viewGroups as $group => $views) { $i = 0; - if (SermondistributorHelper::checkArray($views)) + if (UtilitiesArrayHelper::check($views)) { foreach($views as $view) { @@ -103,11 +113,11 @@ class SermondistributorModelSermondistributor extends ListModel if (count($dwd) == 3) { list($type, $name, $url) = $dwd; - $viewName = $name; - $alt = $name; - $url = $url; - $image = $name . '.' . $type; - $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U'); + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . StringHelper::safe($name,'U'); } } // internal views @@ -129,11 +139,11 @@ class SermondistributorModelSermondistributor extends ListModel switch($action) { case 'add': - $url = 'index.php?option=com_sermondistributor&view=' . $name . '&layout=edit'; - $image = $name . '_' . $action. '.' . $type; - $alt = $name . ' ' . $action; - $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U').'_ADD'; - $add = true; + $url = 'index.php?option=com_sermondistributor&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.StringHelper::safe($name,'U').'_ADD'; + $add = true; break; default: // check for new convention (more stable) @@ -146,34 +156,34 @@ class SermondistributorModelSermondistributor extends ListModel { $extension = 'com_sermondistributor.' . $name; } - $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; - $image = $name . '_' . $action . '.' . $type; - $alt = $viewName . ' ' . $action; - $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U') . '_' . SermondistributorHelper::safeString($action,'U'); + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . StringHelper::safe($name,'U') . '_' . StringHelper::safe($action,'U'); break; } } else { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_sermondistributor&view=' . $name; - $image = $name . '.' . $type; - $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U'); - $hover = false; + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_sermondistributor&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . StringHelper::safe($name,'U'); + $hover = false; } } else { - $viewName = $view; - $alt = $view; - $url = 'index.php?option=com_sermondistributor&view=' . $view; - $image = $view . '.png'; - $name = ucwords($view).'

'; - $hover = false; + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_sermondistributor&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; } // first make sure the view access is set - if (SermondistributorHelper::checkArray($viewAccess)) + if (UtilitiesArrayHelper::check($viewAccess)) { // setup some defaults $dashboard_add = false; @@ -181,11 +191,11 @@ class SermondistributorModelSermondistributor extends ListModel $accessTo = ''; $accessAdd = ''; // access checking start - $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.create']):false; - $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.access']):false; + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? StringHelper::check($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? StringHelper::check($viewAccess[$viewName.'.access']):false; // set main controllers - $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; - $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false; + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? StringHelper::check($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? StringHelper::check($viewAccess[$viewName.'.dashboard_list']):false; // check for adding access if ($add && $accessCreate) { @@ -203,64 +213,64 @@ class SermondistributorModelSermondistributor extends ListModel // set main access controllers if ($accessDashboard_add) { - $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_sermondistributor'); + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_sermondistributor'); } if ($accessDashboard_list) { $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_sermondistributor'); } - if (SermondistributorHelper::checkString($accessAdd) && SermondistributorHelper::checkString($accessTo)) + if (StringHelper::check($accessAdd) && StringHelper::check($accessTo)) { // check access if($user->authorise($accessAdd, 'com_sermondistributor') && $user->authorise($accessTo, 'com_sermondistributor') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (SermondistributorHelper::checkString($accessTo)) + elseif (StringHelper::check($accessTo)) { // check access if($user->authorise($accessTo, 'com_sermondistributor') && $dashboard_list) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (SermondistributorHelper::checkString($accessAdd)) + elseif (StringHelper::check($accessAdd)) { // check access if($user->authorise($accessAdd, 'com_sermondistributor') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } $i++; } @@ -277,10 +287,10 @@ class SermondistributorModelSermondistributor extends ListModel public function getGithub() { // load jquery (not sure why... but else the timeago breaks) - JHtml::_('jquery.framework'); + Html::_('jquery.framework'); // get the document to load the scripts - $document = JFactory::getDocument(); - $document->addScript(JURI::root() . "media/com_sermondistributor/js/timeago.js"); + $document = Factory::getDocument(); + Html::_('script', "media/com_sermondistributor/js/timeago.js", ['version' => 'auto']); $document->addScriptDeclaration(' var urlToGetAllOpenIssues = "https://api.github.com/repos/Llewellynvdm/Joomla-Sermon-Distributor/issues?state=open&page=1&per_page=5"; var urlToGetAllClosedIssues = "https://api.github.com/repos/Llewellynvdm/Joomla-Sermon-Distributor/issues?state=closed&page=1&per_page=5"; @@ -294,9 +304,9 @@ class SermondistributorModelSermondistributor extends ListModel jQuery("#openissues") .append("

" + issue.title + "

") .append("\"@" ") - .append("" + issue.user.login + " '.JText::_('COM_SERMONDISTRIBUTOR_OPENED_THIS').' '.JText::_('COM_SERMONDISTRIBUTOR_ISSUE').'-" + issue.number + " (" + timeago + ") ") + .append("" + issue.user.login + " '.Text::_('COM_SERMONDISTRIBUTOR_OPENED_THIS').' '.Text::_('COM_SERMONDISTRIBUTOR_ISSUE').'-" + issue.number + " (" + timeago + ") ") .append(marked.parse(issue.body)) - .append("'.JText::_('COM_SERMONDISTRIBUTOR_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'...
"); + .append("'.Text::_('COM_SERMONDISTRIBUTOR_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'...
"); }); }); jQuery.getJSON(urlToGetAllClosedIssues, function (closedissues) { @@ -307,9 +317,9 @@ class SermondistributorModelSermondistributor extends ListModel jQuery("#closedissues") .append("

" + issue.title + "

") .append("\"@" ") - .append("" + issue.user.login + " '.JText::_('COM_SERMONDISTRIBUTOR_OPENED').' '.JText::_('COM_SERMONDISTRIBUTOR_ISSUE').'-" + issue.number + " (" + timeago + ")") + .append("" + issue.user.login + " '.Text::_('COM_SERMONDISTRIBUTOR_OPENED').' '.Text::_('COM_SERMONDISTRIBUTOR_ISSUE').'-" + issue.number + " (" + timeago + ")") .append(marked.parse(issue.body)) - .append("'.JText::_('COM_SERMONDISTRIBUTOR_REVIEW_THIS_ISSUE_ON_GITHUB').'...
"); + .append("'.Text::_('COM_SERMONDISTRIBUTOR_REVIEW_THIS_ISSUE_ON_GITHUB').'...
"); }); }); jQuery.getJSON(urlToGetAllReleases, function (tagreleases) { @@ -317,7 +327,7 @@ class SermondistributorModelSermondistributor extends ListModel var activeVersion = tagreleases[0].tag_name.substring(1); if (activeVersion === manifest.version) { // local version is in sync with latest release - jQuery(".update-notice").html("'.JText::_('COM_SERMONDISTRIBUTOR_UP_TO_DATE').'"); + jQuery(".update-notice").html("'.Text::_('COM_SERMONDISTRIBUTOR_UP_TO_DATE').'"); } else { // split versions in to array var activeVersionArray = activeVersion.split("."); @@ -326,10 +336,10 @@ class SermondistributorModelSermondistributor extends ListModel (+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] > +activeVersionArray[1]) || (+localVersionArray[0] == +activeVersionArray[0] && +localVersionArray[1] == +activeVersionArray[1] && +localVersionArray[2] > +activeVersionArray[2])) { // local version head latest release - jQuery(".update-notice").html("'.JText::_('COM_SERMONDISTRIBUTOR_BETA_RELEASE').'"); + jQuery(".update-notice").html("'.Text::_('COM_SERMONDISTRIBUTOR_BETA_RELEASE').'"); } else { // local version behind latest release - jQuery(".update-notice").html("'.JText::_('COM_SERMONDISTRIBUTOR_OUT_OF_DATE').'"); + jQuery(".update-notice").html("'.Text::_('COM_SERMONDISTRIBUTOR_OUT_OF_DATE').'"); } } // set the taged releases @@ -338,7 +348,7 @@ class SermondistributorModelSermondistributor extends ListModel // set active release var activeNotice = ""; if (i === 0) { - var activeNotice = " '.JText::_('COM_SERMONDISTRIBUTOR_LATEST_RELEASE').'

"; + var activeNotice = " '.Text::_('COM_SERMONDISTRIBUTOR_LATEST_RELEASE').'

"; } // set time ago var timeago = jQuery.timeago(new Date(tagrelease.published_at)); @@ -346,43 +356,50 @@ class SermondistributorModelSermondistributor extends ListModel .append("

" + tagrelease.name + "

") .append(activeNotice) .append("\"@" ") - .append("" + tagrelease.author.login + " '.JText::_('COM_SERMONDISTRIBUTOR_RELEASED_THIS').' " + tagrelease.tag_name+ " (" + timeago + ")") + .append("" + tagrelease.author.login + " '.Text::_('COM_SERMONDISTRIBUTOR_RELEASED_THIS').' " + tagrelease.tag_name+ " (" + timeago + ")") .append(marked.parse(tagrelease.body)) - .append(" " + tagrelease.assets[0].name + " (" + tagrelease.assets[0].download_count + ") ") - .append("| '.JText::_('COM_SERMONDISTRIBUTOR_OPEN_ON_GITHUB').'...
"); + .append(" " + tagrelease.assets[0].name + " (" + tagrelease.assets[0].download_count + ") ") + .append("| '.Text::_('COM_SERMONDISTRIBUTOR_OPEN_ON_GITHUB').'...
"); }); }); });'); $create = '
'; - $moreopen = ''.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'... '; - $moreclosed = ''.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'... '; - $viewissues = ''.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_RELEASES_ON_GITHUB').'... '; + $moreopen = ''.Text::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'... '; + $moreclosed = ''.Text::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'... '; + $viewissues = ''.Text::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_RELEASES_ON_GITHUB').'... '; return (object) array( - 'openissues' => $create.'
'.JText::_('COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING').'..
'.$moreopen, - 'closedissues' => $create.'
'.JText::_('COM_SERMONDISTRIBUTOR_A_FEW_CLOSED_ISSUES_FROM_GITHUB_IS_LOADING').'..
'.$moreclosed, - 'tagreleases' => '
'.JText::_('COM_SERMONDISTRIBUTOR_LAST_FEW_RELEASES_FROM_GITHUB_IS_LOADING').'..
'.$viewissues + 'openissues' => $create.'
'.Text::_('COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING').'..
'.$moreopen, + 'closedissues' => $create.'
'.Text::_('COM_SERMONDISTRIBUTOR_A_FEW_CLOSED_ISSUES_FROM_GITHUB_IS_LOADING').'..
'.$moreclosed, + 'tagreleases' => '
'.Text::_('COM_SERMONDISTRIBUTOR_LAST_FEW_RELEASES_FROM_GITHUB_IS_LOADING').'..
'.$viewissues ); } public function getWiki() { - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' var gewiki = "https://raw.githubusercontent.com/wiki/Llewellynvdm/Joomla-Sermon-Distributor/Home.md"; - jQuery(document).ready(function () { - jQuery.get(gewiki) - .success(function(wiki) { - jQuery("#wiki-md").html(marked.parse(wiki)); - }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#wiki-md").html("'.JText::_('COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATTER').'"); - }); + document.addEventListener("DOMContentLoaded", function () { + fetch(gewiki) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); + }) + .then(wiki => { + document.getElementById("wiki-md").innerHTML = marked.parse(wiki); + }) + .catch(error => { + console.error("There has been a problem with your fetch operation:", error); + document.getElementById("wiki-md").innerHTML = "'.Text::_('COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATTER').'"; + }); });'); - return '
'.JText::_('COM_SERMONDISTRIBUTOR_THE_WIKI_IS_LOADING').'..
'; + return '
'.Text::_('COM_SERMONDISTRIBUTOR_THE_WIKI_IS_LOADING').'..
'; } @@ -390,27 +407,37 @@ class SermondistributorModelSermondistributor extends ListModel public function getNoticeboard() { // get the document to load the scripts - $document = JFactory::getDocument(); - $document->addScript(JURI::root() . "media/com_sermondistributor/js/marked.js"); + $document = Factory::getDocument(); + Html::_('script', "media/com_sermondistributor/js/marked.js", ['version' => 'auto']); $document->addScriptDeclaration(' - var token = "'.JSession::getFormToken().'"; + var token = "' . Session::getFormToken() . '"; var noticeboard = "https://vdm.bz/sermondistributor-noticeboard-md"; - jQuery(document).ready(function () { - jQuery.get(noticeboard) - .success(function(board) { + document.addEventListener("DOMContentLoaded", function() { + fetch(noticeboard) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); + }) + .then(board => { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked.parse(board)); - getIS(1,board).done(function(result) { - if (result){ - jQuery("#cpanel_tabTabs a").each(function() { - if (this.href.indexOf("#vast_development_method") >= 0 || this.href.indexOf("#notice_board") >= 0) { - var textVDM = jQuery(this).text(); - jQuery(this).html("1 "+textVDM); - jQuery(this).attr("id","vdm-new-notice"); - jQuery("#vdm-new-notice").click(function() { - getIS(2,board).done(function(result) { - if (result) { - jQuery(".vdm-new-notice").fadeOut(500); + document.getElementById("noticeboard-md").innerHTML = marked.parse(board); + getIS(1, board) + .then(result => { + if (result) { + document.querySelectorAll("#cpanel_tabTabs a").forEach(link => { + if (link.href.includes("#vast_development_method") || link.href.includes("#notice_board")) { + var textVDM = link.textContent; + link.innerHTML = "1 " + textVDM; + link.id = "vdm-new-notice"; + document.getElementById("vdm-new-notice").addEventListener("click", () => { + getIS(2, board) + .then(result => { + if (result) { + document.querySelectorAll(".vdm-new-notice").forEach(element => { + element.style.opacity = 0; + }); } }); }); @@ -419,63 +446,77 @@ class SermondistributorModelSermondistributor extends ListModel } }); } else { - jQuery("#noticeboard-md").html("'.JText::_('COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; } }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#noticeboard-md").html("'.JText::_('COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + .catch(error => { + console.error("There was an error!", error); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_SERMONDISTRIBUTOR_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; }); }); + // to check is READ/NEW - function getIS(type,notice){ - if(type == 1){ - var getUrl = "index.php?option=com_sermondistributor&task=ajax.isNew&format=json&raw=true"; - } else if (type == 2) { - var getUrl = "index.php?option=com_sermondistributor&task=ajax.isRead&format=json&raw=true"; - } - if(token.length > 0 && notice.length){ - var request = token+"=1¬ice="+notice; + function getIS(type, notice) { + let getUrl = ""; + if (type === 1) { + getUrl = "index.php?option=com_sermondistributor&task=ajax.isNew&format=json&raw=true"; + } else if (type === 2) { + getUrl = "index.php?option=com_sermondistributor&task=ajax.isRead&format=json&raw=true"; } - return jQuery.ajax({ - type: "POST", - url: getUrl, - dataType: "json", - data: request, - jsonp: false - }); + let request = new URLSearchParams(); + if (token.length > 0 && notice.length) { + request.append(token, "1"); + request.append("notice", notice); + } + return fetch(getUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" + }, + body: request + }).then(response => response.json()); } -// nice little dot trick :) -jQuery(document).ready( function($) { - var x=0; - setInterval(function() { - var dots = ""; - x++; - for (var y=0; y < x%8; y++) { - dots+="."; - } - $(".loading-dots").text(dots); - } , 500); +document.addEventListener("DOMContentLoaded", function() { + document.querySelectorAll(".loading-dots").forEach(function(loading_dots) { + let x = 0; + let intervalId = setInterval(function() { + if (!loading_dots.classList.contains("loading-dots")) { + clearInterval(intervalId); + return; + } + let dots = ".".repeat(x % 8); + loading_dots.textContent = dots; + x++; + }, 500); + }); });'); - return '
'.JText::_('COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING').'..
'; + return '
'.Text::_('COM_SERMONDISTRIBUTOR_THE_NOTICE_BOARD_IS_LOADING').'..
'; } public function getReadme() { - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' - var getreadme = "'. JURI::root() . 'administrator/components/com_sermondistributor/README.txt"; - jQuery(document).ready(function () { - jQuery.get(getreadme) - .success(function(readme) { - jQuery("#readme-md").html(marked.parse(readme)); + var getreadme = "'. Uri::root() . 'administrator/components/com_sermondistributor/README.txt"; + document.addEventListener("DOMContentLoaded", function () { + fetch(getreadme) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#readme-md").html("'.JText::_('COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATTER').'"); + .then(readme => { + document.getElementById("readme-md").innerHTML = marked.parse(readme); + }) + .catch(error => { + console.error("There has been a problem with your fetch operation:", error); + document.getElementById("readme-md").innerHTML = "'.Text::_('COM_SERMONDISTRIBUTOR_PLEASE_CHECK_AGAIN_LATER').'."; }); });'); - return '
'.JText::_('COM_SERMONDISTRIBUTOR_THE_README_IS_LOADING').'..
'; + return '
'.Text::_('COM_SERMONDISTRIBUTOR_THE_README_IS_LOADING').'..
'; } } diff --git a/admin/models/sermons.php b/admin/models/sermons.php index 06b6f70c..cbcffe61 100644 --- a/admin/models/sermons.php +++ b/admin/models/sermons.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermons.php @@ -25,18 +25,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermons List Model */ class SermondistributorModelSermons extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -72,7 +80,7 @@ class SermondistributorModelSermons extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -163,7 +171,7 @@ class SermondistributorModelSermons extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -178,12 +186,12 @@ class SermondistributorModelSermons extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -196,7 +204,7 @@ class SermondistributorModelSermons extends ListModel } // Add the tags - $item->tags = new JHelperTags; + $item->tags = new TagsHelper; $item->tags->getTagIds( $item->id, 'com_sermondistributor.sermon' ); @@ -216,7 +224,7 @@ class SermondistributorModelSermons extends ListModel } // set selection value to a translatable value - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -227,7 +235,7 @@ class SermondistributorModelSermons extends ListModel } } - + // return items return $items; } @@ -235,7 +243,7 @@ class SermondistributorModelSermons extends ListModel /** * Method to convert selection values to translatable string. * - * @return translatable string + * @return string The translatable string. */ public function selectionTranslation($value,$name) { @@ -247,7 +255,7 @@ class SermondistributorModelSermons extends ListModel 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' ); // Now check if value is found in this array - if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) + if (isset($link_typeArray[$value]) && StringHelper::check($link_typeArray[$value])) { return $link_typeArray[$value]; } @@ -262,25 +270,25 @@ class SermondistributorModelSermons extends ListModel 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' ); // Now check if value is found in this array - if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) + if (isset($sourceArray[$value]) && StringHelper::check($sourceArray[$value])) { return $sourceArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -319,7 +327,7 @@ class SermondistributorModelSermons extends ListModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -360,11 +368,11 @@ class SermondistributorModelSermons extends ListModel $query->where('a.preacher = ' . (int) $_preacher); } } - elseif (SermondistributorHelper::checkString($_preacher)) + elseif (StringHelper::check($_preacher)) { $query->where('a.preacher = ' . $db->quote($db->escape($_preacher))); } - elseif (SermondistributorHelper::checkArray($_preacher)) + elseif (UtilitiesArrayHelper::check($_preacher)) { // Secure the array for the query $_preacher = array_map( function ($val) use(&$db) { @@ -379,7 +387,7 @@ class SermondistributorModelSermons extends ListModel return (int) $val; } } - elseif (SermondistributorHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -400,11 +408,11 @@ class SermondistributorModelSermons extends ListModel $query->where('a.series = ' . (int) $_series); } } - elseif (SermondistributorHelper::checkString($_series)) + elseif (StringHelper::check($_series)) { $query->where('a.series = ' . $db->quote($db->escape($_series))); } - elseif (SermondistributorHelper::checkArray($_series)) + elseif (UtilitiesArrayHelper::check($_series)) { // Secure the array for the query $_series = array_map( function ($val) use(&$db) { @@ -419,7 +427,7 @@ class SermondistributorModelSermons extends ListModel return (int) $val; } } - elseif (SermondistributorHelper::checkString($val)) + elseif (StringHelper::check($val)) { return $db->quote($db->escape($val)); } @@ -440,7 +448,7 @@ class SermondistributorModelSermons extends ListModel $query->where('a.link_type = ' . (int) $_link_type); } } - elseif (SermondistributorHelper::checkString($_link_type)) + elseif (StringHelper::check($_link_type)) { $query->where('a.link_type = ' . $db->quote($db->escape($_link_type))); } @@ -457,7 +465,7 @@ class SermondistributorModelSermons extends ListModel $query->where('a.source = ' . (int) $_source); } } - elseif (SermondistributorHelper::checkString($_source)) + elseif (StringHelper::check($_source)) { $query->where('a.source = ' . $db->quote($db->escape($_source))); } @@ -468,7 +476,7 @@ class SermondistributorModelSermons extends ListModel if (is_numeric($categoryId)) { - $cat_tbl = JTable::getInstance('Category', 'JTable'); + $cat_tbl = Table::getInstance('Category', 'JTable'); $cat_tbl->load($categoryId); $rgt = $cat_tbl->rgt; $lft = $cat_tbl->lft; @@ -485,10 +493,12 @@ class SermondistributorModelSermons extends ListModel // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -506,17 +516,17 @@ class SermondistributorModelSermons extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -560,7 +570,7 @@ class SermondistributorModelSermons extends ListModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -573,7 +583,7 @@ class SermondistributorModelSermons extends ListModel } // Add the tags - $item->tags = new JHelperTags; + $item->tags = new TagsHelper; $item->tags->getTagIds( $item->id, 'com_sermondistributor.sermon' ); @@ -597,7 +607,7 @@ class SermondistributorModelSermons extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -615,16 +625,16 @@ class SermondistributorModelSermons extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_sermon"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -633,7 +643,7 @@ class SermondistributorModelSermons extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -648,13 +658,13 @@ class SermondistributorModelSermons extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (SermondistributorHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || SermondistributorHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -663,61 +673,61 @@ class SermondistributorModelSermons extends ListModel $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_preacher = $this->getState('filter.preacher'); - if (SermondistributorHelper::checkArray($_preacher)) + if (UtilitiesArrayHelper::check($_preacher)) { $id .= ':' . implode(':', $_preacher); } // Check if this is only an number or string elseif (is_numeric($_preacher) - || SermondistributorHelper::checkString($_preacher)) + || StringHelper::check($_preacher)) { $id .= ':' . $_preacher; } // Check if the value is an array $_series = $this->getState('filter.series'); - if (SermondistributorHelper::checkArray($_series)) + if (UtilitiesArrayHelper::check($_series)) { $id .= ':' . implode(':', $_series); } // Check if this is only an number or string elseif (is_numeric($_series) - || SermondistributorHelper::checkString($_series)) + || StringHelper::check($_series)) { $id .= ':' . $_series; } // Check if the value is an array $_category = $this->getState('filter.category'); - if (SermondistributorHelper::checkArray($_category)) + if (UtilitiesArrayHelper::check($_category)) { $id .= ':' . implode(':', $_category); } // Check if this is only an number or string elseif (is_numeric($_category) - || SermondistributorHelper::checkString($_category)) + || StringHelper::check($_category)) { $id .= ':' . $_category; } // Check if the value is an array $_category_id = $this->getState('filter.category_id'); - if (SermondistributorHelper::checkArray($_category_id)) + if (UtilitiesArrayHelper::check($_category_id)) { $id .= ':' . implode(':', $_category_id); } // Check if this is only an number or string elseif (is_numeric($_category_id) - || SermondistributorHelper::checkString($_category_id)) + || StringHelper::check($_category_id)) { $id .= ':' . $_category_id; } // Check if the value is an array $_catid = $this->getState('filter.catid'); - if (SermondistributorHelper::checkArray($_catid)) + if (UtilitiesArrayHelper::check($_catid)) { $id .= ':' . implode(':', $_catid); } // Check if this is only an number or string elseif (is_numeric($_catid) - || SermondistributorHelper::checkString($_catid)) + || StringHelper::check($_catid)) { $id .= ':' . $_catid; } @@ -732,19 +742,18 @@ class SermondistributorModelSermons extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -756,7 +765,7 @@ class SermondistributorModelSermons extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -777,7 +786,7 @@ class SermondistributorModelSermons extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/models/statistic.php b/admin/models/statistic.php index 338fc141..72962b6b 100644 --- a/admin/models/statistic.php +++ b/admin/models/statistic.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php @@ -25,10 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Sermondistributor Statistic Admin Model @@ -77,18 +87,18 @@ class SermondistributorModelStatistic extends AdminModel * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ - public function getTable($type = 'statistic', $prefix = 'SermondistributorTable', $config = array()) + public function getTable($type = 'statistic', $prefix = 'SermondistributorTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_sermondistributor/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -133,7 +143,7 @@ class SermondistributorModelStatistic extends AdminModel * * @since 1.6 */ - public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + public function getForm($data = [], $loadData = true, $options = array('control' => 'jform')) { // set load data option $options['load_data'] = $loadData; @@ -160,7 +170,7 @@ class SermondistributorModelStatistic extends AdminModel return false; } - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) @@ -173,7 +183,7 @@ class SermondistributorModelStatistic extends AdminModel $id = $jinput->get('id', 0, 'INT'); } - $user = JFactory::getUser(); + $user = Factory::getUser(); // Check for existing item. // Modify the form based on Edit State access controls. @@ -236,13 +246,13 @@ class SermondistributorModelStatistic extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_sermondistributor/js/statistic.js'; } - + /** * Method to test whether a record can be deleted. * @@ -261,7 +271,7 @@ class SermondistributorModelStatistic extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('statistic.delete', 'com_sermondistributor.statistic.' . (int) $record->id); } @@ -279,8 +289,8 @@ class SermondistributorModelStatistic extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -291,31 +301,31 @@ class SermondistributorModelStatistic extends AdminModel return false; } } - // In the absense of better information, revert to the component permissions. + // In the absence of better information, revert to the component permissions. return $user->authorise('statistic.edit.state', 'com_sermondistributor'); } - + /** * Method override to check if you can edit an existing record. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('statistic.edit', 'com_sermondistributor.statistic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('statistic.edit', 'com_sermondistributor'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -323,19 +333,19 @@ class SermondistributorModelStatistic extends AdminModel */ protected function prepareTable($table) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - + $date = Factory::getDate(); + $user = Factory::getUser(); + if (isset($table->name)) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } - + if (isset($table->alias) && empty($table->alias)) { $table->generateAlias(); } - + if (empty($table->id)) { $table->created = $date->toSql(); @@ -347,7 +357,7 @@ class SermondistributorModelStatistic extends AdminModel // Set ordering to the last item if not set if (empty($table->ordering)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from($db->quoteName('#__sermondistributor_statistic')); @@ -362,7 +372,7 @@ class SermondistributorModelStatistic extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -377,10 +387,10 @@ class SermondistributorModelStatistic extends AdminModel * * @since 1.6 */ - protected function loadFormData() + protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_sermondistributor.edit.statistic.data', array()); + $data = Factory::getApplication()->getUserState('com_sermondistributor.edit.statistic.data', []); if (empty($data)) { @@ -403,7 +413,7 @@ class SermondistributorModelStatistic extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -419,7 +429,7 @@ class SermondistributorModelStatistic extends AdminModel { return false; } - + return true; } @@ -439,10 +449,10 @@ class SermondistributorModelStatistic extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -468,30 +478,30 @@ class SermondistributorModelStatistic extends AdminModel if (empty($pks)) { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + $this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED')); return false; } $done = false; // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = SermondistributorHelper::getActions('statistic'); - $this->batchSet = true; + $this->user = Factory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new UCMType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SermondistributorHelper::getActions('statistic'); + $this->batchSet = true; if (!$this->canDo->get('core.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } - + if ($this->type == false) { - $type = new JUcmType; + $type = new UCMType; $this->type = $type->getTypeByAlias($this->typeAlias); } @@ -528,8 +538,7 @@ class SermondistributorModelStatistic extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -555,7 +564,7 @@ class SermondistributorModelStatistic extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('statistic'); @@ -581,7 +590,7 @@ class SermondistributorModelStatistic extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -594,7 +603,7 @@ class SermondistributorModelStatistic extends AdminModel if (!$this->user->authorise('statistic.edit', $contexts[$pk])) { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -610,19 +619,19 @@ class SermondistributorModelStatistic extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Only for strings - if (SermondistributorHelper::checkString($this->table->filename) && !is_numeric($this->table->filename)) + if (UtilitiesStringHelper::check($this->table->filename) && !is_numeric($this->table->filename)) { $this->table->filename = $this->generateUnique('filename',$this->table->filename); } // insert all set values - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -634,7 +643,7 @@ class SermondistributorModelStatistic extends AdminModel } // update all unique fields - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -698,7 +707,7 @@ class SermondistributorModelStatistic extends AdminModel if (empty($this->batchSet)) { // Set some needed variables. - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->canDo = SermondistributorHelper::getActions('statistic'); @@ -706,7 +715,7 @@ class SermondistributorModelStatistic extends AdminModel if (!$this->canDo->get('statistic.edit') && !$this->canDo->get('statistic.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -723,7 +732,7 @@ class SermondistributorModelStatistic extends AdminModel { if (!$this->user->authorise('statistic.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -739,13 +748,13 @@ class SermondistributorModelStatistic extends AdminModel else { // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. - if (SermondistributorHelper::checkArray($values)) + if (UtilitiesArrayHelper::check($values)) { foreach ($values as $key => $value) { @@ -789,7 +798,7 @@ class SermondistributorModelStatistic extends AdminModel return true; } - + /** * Method to save the form data. * @@ -801,23 +810,23 @@ class SermondistributorModelStatistic extends AdminModel */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); + // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; + + $metadata = new Registry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } - + // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { - $params = new JRegistry; + $params = new Registry; $params->loadArray($data['params']); $data['params'] = (string) $params; } @@ -827,7 +836,7 @@ class SermondistributorModelStatistic extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (SermondistributorHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -835,14 +844,14 @@ class SermondistributorModelStatistic extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -855,7 +864,6 @@ class SermondistributorModelStatistic extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -881,7 +889,7 @@ class SermondistributorModelStatistic extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/statistics.php b/admin/models/statistics.php index d92abfbc..d33b7a57 100644 --- a/admin/models/statistics.php +++ b/admin/models/statistics.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistics.php @@ -25,18 +25,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Statistics List Model */ class SermondistributorModelStatistics extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -68,7 +76,7 @@ class SermondistributorModelStatistics extends ListModel */ protected function populateState($ordering = null, $direction = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout')) @@ -139,7 +147,7 @@ class SermondistributorModelStatistics extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -154,12 +162,12 @@ class SermondistributorModelStatistics extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -173,22 +181,22 @@ class SermondistributorModelStatistics extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -229,7 +237,7 @@ class SermondistributorModelStatistics extends ListModel { $query->where('a.access = ' . (int) $_access); } - elseif (SermondistributorHelper::checkArray($_access)) + elseif (UtilitiesArrayHelper::check($_access)) { // Secure the array for the query $_access = ArrayHelper::toInteger($_access); @@ -270,7 +278,7 @@ class SermondistributorModelStatistics extends ListModel $query->where('a.sermon = ' . (int) $_sermon); } } - elseif (SermondistributorHelper::checkString($_sermon)) + elseif (StringHelper::check($_sermon)) { $query->where('a.sermon = ' . $db->quote($db->escape($_sermon))); } @@ -287,7 +295,7 @@ class SermondistributorModelStatistics extends ListModel $query->where('a.preacher = ' . (int) $_preacher); } } - elseif (SermondistributorHelper::checkString($_preacher)) + elseif (StringHelper::check($_preacher)) { $query->where('a.preacher = ' . $db->quote($db->escape($_preacher))); } @@ -304,16 +312,18 @@ class SermondistributorModelStatistics extends ListModel $query->where('a.series = ' . (int) $_series); } } - elseif (SermondistributorHelper::checkString($_series)) + elseif (StringHelper::check($_series)) { $query->where('a.series = ' . $db->quote($db->escape($_series))); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'desc'); + $orderCol = $this->getState('list.ordering', 'a.id'); + $orderDirn = $this->getState('list.direction', 'desc'); if ($orderCol != '') { + // Check that the order direction is valid encase we have a field called direction as part of filers. + $orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc'; $query->order($db->escape($orderCol . ' ' . $orderDirn)); } @@ -331,17 +341,17 @@ class SermondistributorModelStatistics extends ListModel public function getExportData($pks, $user = null) { // setup the query - if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks) + if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks) { // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; // Get the user object if not set. - if (!isset($user) || !SermondistributorHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -385,7 +395,7 @@ class SermondistributorModelStatistics extends ListModel $items = $db->loadObjectList(); // Set values to display correctly. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -405,7 +415,7 @@ class SermondistributorModelStatistics extends ListModel } // Add headers to items array. $headers = $this->getExImPortHeaders(); - if (SermondistributorHelper::checkObject($headers)) + if (ObjectHelper::check($headers)) { array_unshift($items,$headers); } @@ -423,16 +433,16 @@ class SermondistributorModelStatistics extends ListModel public function getExImPortHeaders() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // get the columns $columns = $db->getTableColumns("#__sermondistributor_statistic"); - if (SermondistributorHelper::checkArray($columns)) + if (UtilitiesArrayHelper::check($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); - $headers = new stdClass(); + $headers = new \stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; @@ -441,7 +451,7 @@ class SermondistributorModelStatistics extends ListModel } return false; } - + /** * Method to get a store id based on model configuration state. * @@ -456,13 +466,13 @@ class SermondistributorModelStatistics extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (SermondistributorHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || SermondistributorHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -481,19 +491,18 @@ class SermondistributorModelStatistics extends ListModel /** * Build an SQL query to checkin all items left checked out longer then a set time. * - * @return a bool - * + * @return bool + * @since 3.2.0 */ - protected function checkInNow() + protected function checkInNow(): bool { // Get set check in time - $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); + $time = ComponentHelper::getParams('com_sermondistributor')->get('check_in'); if ($time) { - // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -505,7 +514,7 @@ class SermondistributorModelStatistics extends ListModel if ($db->getNumRows()) { // Get Yesterdays date. - $date = JFactory::getDate()->modify($time)->toSql(); + $date = Factory::getDate()->modify($time)->toSql(); // Reset query. $query = $db->getQuery(true); @@ -526,7 +535,7 @@ class SermondistributorModelStatistics extends ListModel $db->setQuery($query); - $db->execute(); + return $db->execute(); } } diff --git a/admin/sermondistributor.php b/admin/sermondistributor.php index f6824c5c..b09f0806 100644 --- a/admin/sermondistributor.php +++ b/admin/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,28 +25,75 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// register additional namespace +\spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ]; + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // not found so move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Exception\NotAllowed; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\Controller\BaseController; // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_sermondistributor')) +if (!Factory::getUser()->authorise('core.manage', 'com_sermondistributor')) { - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); +} // Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_sermondistributor/assets/css/admin.css'); -$document->addScript('components/com_sermondistributor/assets/js/admin.js'); +Html::_('stylesheet', 'components/com_sermondistributor/assets/css/admin.css', ['version' => 'auto']); +Html::_('script', 'components/com_sermondistributor/assets/js/admin.js', ['version' => 'auto']); // require helper files JLoader::register('SermondistributorHelper', __DIR__ . '/helpers/sermondistributor.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); // Get an instance of the controller prefixed by Sermondistributor -$controller = JControllerLegacy::getInstance('Sermondistributor'); +$controller = BaseController::getInstance('Sermondistributor'); // Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->execute(Factory::getApplication()->input->get('task')); // Redirect if set by the controller $controller->redirect(); diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index f4067122..ef65be46 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -50,7 +50,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` ( `series` INT(11) NOT NULL DEFAULT 0, `short_description` VARCHAR(255) NOT NULL DEFAULT '', `source` TINYINT(1) NOT NULL DEFAULT 0, - `tags` TEXT NOT NULL, + `tags` CHAR(11) NOT NULL DEFAULT 0, `url` VARCHAR(255) NOT NULL DEFAULT '', `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, diff --git a/admin/sql/updates/mysql/2.1.1.sql b/admin/sql/updates/mysql/2.1.1.sql new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/admin/sql/updates/mysql/2.1.1.sql @@ -0,0 +1 @@ + diff --git a/admin/tables/external_source.php b/admin/tables/external_source.php index 648193f7..afcc2573 100644 --- a/admin/tables/external_source.php +++ b/admin/tables/external_source.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_source.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * External_sources Table class @@ -42,63 +49,63 @@ class SermondistributorTableExternal_source extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_external_source', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.external_source')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.external_source')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the External_source table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTableExternal_source extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('external_source', 'SermondistributorTable'); + $table = Table::getInstance('external_source', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTableExternal_source extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('external_source', 'sermondistributorTable'); + + $table = Table::getInstance('external_source', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTableExternal_source extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTableExternal_source extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.external_source.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTableExternal_source extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTableExternal_source extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTableExternal_source extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTableExternal_source extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTableExternal_source extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTableExternal_source extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTableExternal_source extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTableExternal_source extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index 949509a6..927aeeb2 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Help_documents Table class @@ -42,63 +49,63 @@ class SermondistributorTableHelp_document extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_help_document', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.help_document')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.help_document')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Help_document table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTableHelp_document extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('help_document', 'SermondistributorTable'); + $table = Table::getInstance('help_document', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTableHelp_document extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('help_document', 'sermondistributorTable'); + + $table = Table::getInstance('help_document', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTableHelp_document extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTableHelp_document extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.help_document.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTableHelp_document extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTableHelp_document extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTableHelp_document extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTableHelp_document extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTableHelp_document extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTableHelp_document extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTableHelp_document extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTableHelp_document extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; @@ -337,11 +349,11 @@ class SermondistributorTableHelp_document extends Table $this->alias = $this->title; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/local_listing.php b/admin/tables/local_listing.php index f8c731e9..5205a5fa 100644 --- a/admin/tables/local_listing.php +++ b/admin/tables/local_listing.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listing.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Local_listings Table class @@ -42,63 +49,63 @@ class SermondistributorTableLocal_listing extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_local_listing', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.local_listing')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.local_listing')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Local_listing table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTableLocal_listing extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('local_listing', 'SermondistributorTable'); + $table = Table::getInstance('local_listing', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTableLocal_listing extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('local_listing', 'sermondistributorTable'); + + $table = Table::getInstance('local_listing', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTableLocal_listing extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTableLocal_listing extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.local_listing.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTableLocal_listing extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTableLocal_listing extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTableLocal_listing extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTableLocal_listing extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTableLocal_listing extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTableLocal_listing extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTableLocal_listing extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTableLocal_listing extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; diff --git a/admin/tables/preacher.php b/admin/tables/preacher.php index 2dbb4e9d..67ec17ed 100644 --- a/admin/tables/preacher.php +++ b/admin/tables/preacher.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Preachers Table class @@ -42,63 +49,63 @@ class SermondistributorTablePreacher extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_preacher', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.preacher')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.preacher')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Preacher table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTablePreacher extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('preacher', 'SermondistributorTable'); + $table = Table::getInstance('preacher', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_PREACHER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTablePreacher extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('preacher', 'sermondistributorTable'); + + $table = Table::getInstance('preacher', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTablePreacher extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTablePreacher extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.preacher.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTablePreacher extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTablePreacher extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTablePreacher extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTablePreacher extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTablePreacher extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTablePreacher extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTablePreacher extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTablePreacher extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; @@ -337,11 +349,11 @@ class SermondistributorTablePreacher extends Table $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/series.php b/admin/tables/series.php index 1e8ac8a8..56c10ea3 100644 --- a/admin/tables/series.php +++ b/admin/tables/series.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Series_list Table class @@ -42,63 +49,63 @@ class SermondistributorTableSeries extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_series', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.series')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.series')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Series table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTableSeries extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('series', 'SermondistributorTable'); + $table = Table::getInstance('series', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_SERIES_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_SERIES_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_SERIES_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTableSeries extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('series', 'sermondistributorTable'); + + $table = Table::getInstance('series', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTableSeries extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTableSeries extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.series.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTableSeries extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTableSeries extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTableSeries extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTableSeries extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTableSeries extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTableSeries extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTableSeries extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTableSeries extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; @@ -337,11 +349,11 @@ class SermondistributorTableSeries extends Table $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/sermon.php b/admin/tables/sermon.php index e22fcdc2..d99cd641 100644 --- a/admin/tables/sermon.php +++ b/admin/tables/sermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Sermons Table class @@ -42,66 +49,66 @@ class SermondistributorTableSermon extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_sermon', 'id', $db); // Adding Tag Options - JTableObserverTags::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon')); + TableObserverTags::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon')); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Sermon table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -116,33 +123,38 @@ class SermondistributorTableSermon extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('sermon', 'SermondistributorTable'); + $table = Table::getInstance('sermon', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_SERMON_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -154,20 +166,20 @@ class SermondistributorTableSermon extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('sermon', 'sermondistributorTable'); + + $table = Table::getInstance('sermon', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -178,7 +190,7 @@ class SermondistributorTableSermon extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -201,13 +213,13 @@ class SermondistributorTableSermon extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.sermon.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -223,12 +235,12 @@ class SermondistributorTableSermon extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -239,14 +251,14 @@ class SermondistributorTableSermon extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -263,7 +275,7 @@ class SermondistributorTableSermon extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -271,8 +283,8 @@ class SermondistributorTableSermon extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -281,7 +293,7 @@ class SermondistributorTableSermon extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -289,8 +301,8 @@ class SermondistributorTableSermon extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -301,8 +313,8 @@ class SermondistributorTableSermon extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -316,12 +328,12 @@ class SermondistributorTableSermon extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; @@ -340,11 +352,11 @@ class SermondistributorTableSermon extends Table $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = ApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + $this->alias = Factory::getDate()->format('Y-m-d-H-i-s'); } return $this->alias; diff --git a/admin/tables/statistic.php b/admin/tables/statistic.php index 981cbaae..4b6be640 100644 --- a/admin/tables/statistic.php +++ b/admin/tables/statistic.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; +use Joomla\CMS\Access\Access as AccessRules; +use Joomla\CMS\Access\Rules; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Table\Observer\Tags as TableObserverTags; +use Joomla\CMS\Table\Observer\ContentHistory as TableObserverContenthistory; +use Joomla\CMS\Application\ApplicationHelper; /** * Statistics Table class @@ -42,63 +49,63 @@ class SermondistributorTableStatistic extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__sermondistributor_statistic', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.statistic')); - } - + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.statistic')); + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Statistic table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -113,33 +120,38 @@ class SermondistributorTableStatistic extends Table $this->created_by = $user->get('id'); } } - + if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('statistic', 'SermondistributorTable'); + $table = Table::getInstance('statistic', 'SermondistributorTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -151,20 +163,20 @@ class SermondistributorTableStatistic extends Table { // Generate a valid alias $this->generateAlias(); - - $table = JTable::getInstance('statistic', 'sermondistributorTable'); + + $table = Table::getInstance('statistic', 'sermondistributorTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -175,7 +187,7 @@ class SermondistributorTableStatistic extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -198,13 +210,13 @@ class SermondistributorTableStatistic extends Table $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); } - // If we don't have any access rules set at this point just use an empty JAccessRules class + // If we don't have any access rules set at this point just use an empty AccessRules class if (!$this->getRules()) { $rules = $this->getDefaultAssetValues('com_sermondistributor.statistic.'.$this->id); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -220,12 +232,12 @@ class SermondistributorTableStatistic extends Table * * @param $string $component The component asset name to search for * - * @return JAccessRules The JAccessRules object for the asset + * @return AccessRules The AccessRules object for the asset */ protected function getDefaultAssetValues($component, $try = true) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -236,14 +248,14 @@ class SermondistributorTableStatistic extends Table { // asset already set so use saved rules $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -260,7 +272,7 @@ class SermondistributorTableStatistic extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -268,8 +280,8 @@ class SermondistributorTableStatistic extends Table { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules; $rules->mergeCollection($_result); return $rules; @@ -278,7 +290,7 @@ class SermondistributorTableStatistic extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -286,8 +298,8 @@ class SermondistributorTableStatistic extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -298,8 +310,8 @@ class SermondistributorTableStatistic extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -313,12 +325,12 @@ class SermondistributorTableStatistic extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_sermondistributor'); return $asset->id; diff --git a/admin/views/external_source/submitbutton.js b/admin/views/external_source/submitbutton.js index a3607a70..e76a0905 100644 --- a/admin/views/external_source/submitbutton.js +++ b/admin/views/external_source/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/external_source/tmpl/edit.php b/admin/views/external_source/tmpl/edit.php index c44e77f8..df06e006 100644 --- a/admin/views/external_source/tmpl/edit.php +++ b/admin/views/external_source/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,87 +25,86 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/external_source/view.html.php b/admin/views/external_source/view.html.php index 97cadc70..f15c1265 100644 --- a/admin/views/external_source/view.html.php +++ b/admin/views/external_source/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,19 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * External_source Html View class @@ -39,7 +51,7 @@ class SermondistributorViewExternal_source extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_sermondistributor'); + $this->params = ComponentHelper::getParams('com_sermondistributor'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -48,7 +60,7 @@ class SermondistributorViewExternal_source extends HtmlView // get action permissions $this->canDo = SermondistributorHelper::getActions('external_source', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -73,7 +85,7 @@ class SermondistributorViewExternal_source extends HtmlView // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -93,34 +105,34 @@ class SermondistributorViewExternal_source extends HtmlView */ protected function addToolBar() { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + Factory::getApplication()->input->set('hidemainmenu', true); + $user = Factory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; - JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT'), 'pencil-2 article-add'); + ToolbarHelper::title( Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. - if (SermondistributorHelper::checkString($this->referral)) + if (StringHelper::check($this->referral)) { if ($this->canDo->get('external_source.create') && $isNew) { // We can create the record. - JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('external_source.edit')) { // We can save the record. - JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. - JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. - JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); } } else @@ -130,54 +142,54 @@ class SermondistributorViewExternal_source extends HtmlView // For new records, check the create permission. if ($this->canDo->get('external_source.create')) { - JToolBarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); }; - JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('external_source.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('external_source.edit')) { // We can save the new record - JToolBarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('external_source.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('external_source.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('external_source.create')) { - JToolBarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('external_source.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('external_source.version')); if ($this->state->params->get('save_history', 1) && $this->canDo->get('external_source.edit') && $canVersion) { - JToolbarHelper::versions('com_sermondistributor.external_source', $this->item->id); + ToolbarHelper::versions('com_sermondistributor.external_source', $this->item->id); } if ($this->canDo->get('external_source.create')) { - JToolBarHelper::custom('external_source.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + ToolbarHelper::custom('external_source.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if ($this->canDo->get('external_source.clear_local_listing')) { // add Clear Local Listing button. - JToolBarHelper::custom('external_source.clearLocalListing', 'delete custom-button-clearlocallisting', '', 'COM_SERMONDISTRIBUTOR_CLEAR_LOCAL_LISTING', false); + ToolbarHelper::custom('external_source.clearLocalListing', 'delete custom-button-clearlocallisting', '', 'COM_SERMONDISTRIBUTOR_CLEAR_LOCAL_LISTING', false); } if ($this->canDo->get('external_source.reset_update_status')) { // add Reset Update Status button. - JToolBarHelper::custom('external_source.resetUpdateStatus', 'undo-2 custom-button-resetupdatestatus', '', 'COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS', false); + ToolbarHelper::custom('external_source.resetUpdateStatus', 'undo-2 custom-button-resetupdatestatus', '', 'COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS', false); } - JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); } } - JToolbarHelper::divider(); + ToolbarHelper::divider(); // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('external_source'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } } @@ -192,11 +204,11 @@ class SermondistributorViewExternal_source extends HtmlView { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return StringHelper::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** @@ -207,16 +219,22 @@ class SermondistributorViewExternal_source extends HtmlView protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/external_source.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/external_source.css", ['version' => 'auto']); // Add Ajax Token - $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); - $this->document->addScript(JURI::root() . $this->script, (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/external_source/submitbutton.js", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); + $this->document->addScriptDeclaration("var token = '" . Session::getFormToken() . "';"); + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "administrator/components/com_sermondistributor/views/external_source/submitbutton.js", ['version' => 'auto']); + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/views/external_sources/tmpl/default.php b/admin/views/external_sources/tmpl/default.php index 08568268..11b073d9 100644 --- a/admin/views/external_sources/tmpl/default.php +++ b/admin/views/external_sources/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,16 +25,23 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=external_sources.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'external_sourceList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'external_sourceList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
+ sidebar)): ?>
sidebar; ?> @@ -45,13 +52,13 @@ if ($this->saveOrder) $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
- +
@@ -61,11 +68,11 @@ if ($this->saveOrder)
canCreate && $this->canEdit) : ?> - JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS'), + 'title' => Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -75,5 +82,5 @@ if ($this->saveOrder)
- +
diff --git a/admin/views/external_sources/tmpl/default_batch_body.php b/admin/views/external_sources/tmpl/default_batch_body.php index cea27113..45e1ef6f 100644 --- a/admin/views/external_sources/tmpl/default_batch_body.php +++ b/admin/views/external_sources/tmpl/default_batch_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_body.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

+

batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_batch_footer.php b/admin/views/external_sources/tmpl/default_batch_footer.php index a702d428..048dcb06 100644 --- a/admin/views/external_sources/tmpl/default_batch_footer.php +++ b/admin/views/external_sources/tmpl/default_batch_footer.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_footer.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_body.php b/admin/views/external_sources/tmpl/default_body.php index aeaf13e7..35c78c3e 100644 --- a/admin/views/external_sources/tmpl/default_body.php +++ b/admin/views/external_sources/tmpl/default_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_body.php @@ -25,13 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_sermondistributor&view=external_sources&task=external_source.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('external_source',$item,'external_sources'); ?> @@ -41,7 +45,7 @@ $edit = "index.php?option=com_sermondistributor&view=external_sources&task=exter $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -59,12 +63,12 @@ $edit = "index.php?option=com_sermondistributor&view=external_sources&task=exter get('external_source.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -75,7 +79,7 @@ $edit = "index.php?option=com_sermondistributor&view=external_sources&task=exter get('external_source.edit')): ?> escape($item->description); ?> checked_out): ?> - name, $item->checked_out_time, 'external_sources.', $canCheckin); ?> + name, $item->checked_out_time, 'external_sources.', $canCheckin); ?> escape($item->description); ?> @@ -83,30 +87,30 @@ $edit = "index.php?option=com_sermondistributor&view=external_sources&task=exter - externalsources); ?> + externalsources); ?> - update_method); ?> + update_method); ?> - filetypes); ?> + filetypes); ?> - build); ?> + build); ?> get('external_source.edit.state')) : ?> checked_out) : ?> - published, $i, 'external_sources.', true, 'cb'); ?> + published, $i, 'external_sources.', true, 'cb'); ?> - published, $i, 'external_sources.', false, 'cb'); ?> + published, $i, 'external_sources.', false, 'cb'); ?> - published, $i, 'external_sources.', true, 'cb'); ?> + published, $i, 'external_sources.', true, 'cb'); ?> - published, $i, 'external_sources.', false, 'cb'); ?> + published, $i, 'external_sources.', false, 'cb'); ?> diff --git a/admin/views/external_sources/tmpl/default_foot.php b/admin/views/external_sources/tmpl/default_foot.php index d111908e..1756c246 100644 --- a/admin/views/external_sources/tmpl/default_foot.php +++ b/admin/views/external_sources/tmpl/default_foot.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_foot.php diff --git a/admin/views/external_sources/tmpl/default_head.php b/admin/views/external_sources/tmpl/default_head.php index 90e3dc9f..646e52ec 100644 --- a/admin/views/external_sources/tmpl/default_head.php +++ b/admin/views/external_sources/tmpl/default_head.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_head.php @@ -25,14 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -43,30 +46,30 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/external_sources/tmpl/default_toolbar.php b/admin/views/external_sources/tmpl/default_toolbar.php index 257fb6ab..9d5a94df 100644 --- a/admin/views/external_sources/tmpl/default_toolbar.php +++ b/admin/views/external_sources/tmpl/default_toolbar.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_toolbar.php @@ -25,34 +25,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/external_sources/view.html.php b/admin/views/external_sources/view.html.php index fccdf84e..6169bf88 100644 --- a/admin/views/external_sources/view.html.php +++ b/admin/views/external_sources/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the External_sources @@ -48,7 +61,7 @@ class SermondistributorViewExternal_sources extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewExternal_sources extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('external_source'); $this->canEdit = $this->canDo->get('external_source.edit'); $this->canState = $this->canDo->get('external_source.edit.state'); $this->canCreate = $this->canDo->get('external_source.create'); $this->canDelete = $this->canDo->get('external_source.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('external_source.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewExternal_sources extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewExternal_sources extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES'), 'puzzle'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=external_sources'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES'), 'puzzle'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('external_source.add'); + ToolbarHelper::addNew('external_source.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('external_source.edit'); + ToolbarHelper::editList('external_source.edit'); } if ($this->canState) { - JToolBarHelper::publishList('external_sources.publish'); - JToolBarHelper::unpublishList('external_sources.unpublish'); - JToolBarHelper::archiveList('external_sources.archive'); + ToolbarHelper::publishList('external_sources.publish'); + ToolbarHelper::unpublishList('external_sources.unpublish'); + ToolbarHelper::archiveList('external_sources.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('external_sources.checkin'); + ToolbarHelper::checkin('external_sources.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewExternal_sources extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewExternal_sources extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'external_sources.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'external_sources.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('external_sources.trash'); + ToolbarHelper::trash('external_sources.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('external_source.export')) { - JToolBarHelper::custom('external_sources.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('external_sources.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('external_source.import')) { - JToolBarHelper::custom('external_sources.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('external_sources.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('external_sources'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,19 +200,19 @@ class SermondistributorViewExternal_sources extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Externalsources Selection - $this->externalsourcesOptions = JFormHelper::loadFieldType('externalsourcesfilterexternalsources')->options; + $this->externalsourcesOptions = FormHelper::loadFieldType('externalsourcesfilterexternalsources')->options; // We do some sanitation for Externalsources filter - if (SermondistributorHelper::checkArray($this->externalsourcesOptions) && + if (ArrayHelper::check($this->externalsourcesOptions) && isset($this->externalsourcesOptions[0]->value) && - !SermondistributorHelper::checkString($this->externalsourcesOptions[0]->value)) + !StringHelper::check($this->externalsourcesOptions[0]->value)) { unset($this->externalsourcesOptions[0]); } // Externalsources Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -', 'batch[externalsources]', - JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text') + Html::_('select.options', $this->externalsourcesOptions, 'value', 'text') ); } @@ -207,19 +220,19 @@ class SermondistributorViewExternal_sources extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Update Method Selection - $this->update_methodOptions = JFormHelper::loadFieldType('externalsourcesfilterupdatemethod')->options; + $this->update_methodOptions = FormHelper::loadFieldType('externalsourcesfilterupdatemethod')->options; // We do some sanitation for Update Method filter - if (SermondistributorHelper::checkArray($this->update_methodOptions) && + if (ArrayHelper::check($this->update_methodOptions) && isset($this->update_methodOptions[0]->value) && - !SermondistributorHelper::checkString($this->update_methodOptions[0]->value)) + !StringHelper::check($this->update_methodOptions[0]->value)) { unset($this->update_methodOptions[0]); } // Update Method Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -', 'batch[update_method]', - JHtml::_('select.options', $this->update_methodOptions, 'value', 'text') + Html::_('select.options', $this->update_methodOptions, 'value', 'text') ); } @@ -227,19 +240,19 @@ class SermondistributorViewExternal_sources extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Build Selection - $this->buildOptions = JFormHelper::loadFieldType('externalsourcesfilterbuild')->options; + $this->buildOptions = FormHelper::loadFieldType('externalsourcesfilterbuild')->options; // We do some sanitation for Build filter - if (SermondistributorHelper::checkArray($this->buildOptions) && + if (ArrayHelper::check($this->buildOptions) && isset($this->buildOptions[0]->value) && - !SermondistributorHelper::checkString($this->buildOptions[0]->value)) + !StringHelper::check($this->buildOptions[0]->value)) { unset($this->buildOptions[0]); } // Build Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -', 'batch[build]', - JHtml::_('select.options', $this->buildOptions, 'value', 'text') + Html::_('select.options', $this->buildOptions, 'value', 'text') ); } } @@ -253,10 +266,10 @@ class SermondistributorViewExternal_sources extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/external_sources.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/external_sources.css", ['version' => 'auto']); } /** @@ -271,27 +284,37 @@ class SermondistributorViewExternal_sources extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.description' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL'), - 'a.externalsources' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL'), - 'a.update_method' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL'), - 'a.build' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.description' => Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL'), + 'a.externalsources' => Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL'), + 'a.update_method' => Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL'), + 'a.build' => Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js index afbec5bf..37e8f2e6 100644 --- a/admin/views/help_document/submitbutton.js +++ b/admin/views/help_document/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index b32d75af..eb18f53d 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,85 +25,84 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/help_document/view.html.php b/admin/views/help_document/view.html.php index 1d8de090..c38259f9 100644 --- a/admin/views/help_document/view.html.php +++ b/admin/views/help_document/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,19 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Help_document Html View class @@ -39,7 +51,7 @@ class SermondistributorViewHelp_document extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_sermondistributor'); + $this->params = ComponentHelper::getParams('com_sermondistributor'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -48,7 +60,7 @@ class SermondistributorViewHelp_document extends HtmlView // get action permissions $this->canDo = SermondistributorHelper::getActions('help_document', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -73,7 +85,7 @@ class SermondistributorViewHelp_document extends HtmlView // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -93,34 +105,34 @@ class SermondistributorViewHelp_document extends HtmlView */ protected function addToolBar() { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + Factory::getApplication()->input->set('hidemainmenu', true); + $user = Factory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; - JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_NEW' : 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add'); + ToolbarHelper::title( Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_NEW' : 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. - if (SermondistributorHelper::checkString($this->referral)) + if (StringHelper::check($this->referral)) { if ($this->canDo->get('help_document.create') && $isNew) { // We can create the record. - JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('help_document.edit')) { // We can save the record. - JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. - JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. - JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); } } else @@ -130,44 +142,44 @@ class SermondistributorViewHelp_document extends HtmlView // For new records, check the create permission. if ($this->canDo->get('help_document.create')) { - JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); }; - JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('help_document.edit')) { // We can save the new record - JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('help_document.create')) { - JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('help_document.version')); if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit') && $canVersion) { - JToolbarHelper::versions('com_sermondistributor.help_document', $this->item->id); + ToolbarHelper::versions('com_sermondistributor.help_document', $this->item->id); } if ($this->canDo->get('help_document.create')) { - JToolBarHelper::custom('help_document.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + ToolbarHelper::custom('help_document.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } - JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); } } - JToolbarHelper::divider(); + ToolbarHelper::divider(); // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('help_document'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } } @@ -182,11 +194,11 @@ class SermondistributorViewHelp_document extends HtmlView { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return StringHelper::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** @@ -197,14 +209,20 @@ class SermondistributorViewHelp_document extends HtmlView protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_NEW' : 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/help_document.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/help_document/submitbutton.js", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_NEW' : 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/help_document.css", ['version' => 'auto']); + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "administrator/components/com_sermondistributor/views/help_document/submitbutton.js", ['version' => 'auto']); + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/views/help_documents/tmpl/default.php b/admin/views/help_documents/tmpl/default.php index 187adc86..9f02bdc5 100644 --- a/admin/views/help_documents/tmpl/default.php +++ b/admin/views/help_documents/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,17 +25,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); +Html::_('formbehavior.chosen', '.multipleAccessLevels', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -']); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=help_documents.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
+ sidebar)): ?>
sidebar; ?> @@ -46,13 +53,13 @@ if ($this->saveOrder) $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
- +
@@ -62,11 +69,11 @@ if ($this->saveOrder)
canCreate && $this->canEdit) : ?> - JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_OPTIONS'), + 'title' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -76,5 +83,5 @@ if ($this->saveOrder)
- +
diff --git a/admin/views/help_documents/tmpl/default_batch_body.php b/admin/views/help_documents/tmpl/default_batch_body.php index 26ad206f..7e34d295 100644 --- a/admin/views/help_documents/tmpl/default_batch_body.php +++ b/admin/views/help_documents/tmpl/default_batch_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_body.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

+

batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_batch_footer.php b/admin/views/help_documents/tmpl/default_batch_footer.php index 524e7233..7956dfe9 100644 --- a/admin/views/help_documents/tmpl/default_batch_footer.php +++ b/admin/views/help_documents/tmpl/default_batch_footer.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_footer.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_body.php b/admin/views/help_documents/tmpl/default_body.php index b234951a..e9590f02 100644 --- a/admin/views/help_documents/tmpl/default_body.php +++ b/admin/views/help_documents/tmpl/default_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_body.php @@ -25,13 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_document.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('help_document',$item,'help_documents'); ?> @@ -41,7 +45,7 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -59,12 +63,12 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do get('help_document.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -75,7 +79,7 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do get('help_document.edit')): ?> escape($item->title); ?> checked_out): ?> - name, $item->checked_out_time, 'help_documents.', $canCheckin); ?> + name, $item->checked_out_time, 'help_documents.', $canCheckin); ?> escape($item->title); ?> @@ -83,13 +87,13 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do - type); ?> + type); ?> escape($item->groups); ?> - location); ?> + location); ?> escape($item->admin_view); ?> @@ -101,15 +105,15 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do get('help_document.edit.state')) : ?> checked_out) : ?> - published, $i, 'help_documents.', true, 'cb'); ?> + published, $i, 'help_documents.', true, 'cb'); ?> - published, $i, 'help_documents.', false, 'cb'); ?> + published, $i, 'help_documents.', false, 'cb'); ?> - published, $i, 'help_documents.', true, 'cb'); ?> + published, $i, 'help_documents.', true, 'cb'); ?> - published, $i, 'help_documents.', false, 'cb'); ?> + published, $i, 'help_documents.', false, 'cb'); ?> diff --git a/admin/views/help_documents/tmpl/default_foot.php b/admin/views/help_documents/tmpl/default_foot.php index f9f7dd40..f21af2ab 100644 --- a/admin/views/help_documents/tmpl/default_foot.php +++ b/admin/views/help_documents/tmpl/default_foot.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_foot.php diff --git a/admin/views/help_documents/tmpl/default_head.php b/admin/views/help_documents/tmpl/default_head.php index 1e8369f9..9989f73c 100644 --- a/admin/views/help_documents/tmpl/default_head.php +++ b/admin/views/help_documents/tmpl/default_head.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_head.php @@ -25,14 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -43,33 +46,33 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_toolbar.php b/admin/views/help_documents/tmpl/default_toolbar.php index e421dabf..38657575 100644 --- a/admin/views/help_documents/tmpl/default_toolbar.php +++ b/admin/views/help_documents/tmpl/default_toolbar.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_toolbar.php @@ -25,34 +25,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php index 88c207c8..8700ce72 100644 --- a/admin/views/help_documents/view.html.php +++ b/admin/views/help_documents/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Help_documents @@ -48,7 +61,7 @@ class SermondistributorViewHelp_documents extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewHelp_documents extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('help_document'); $this->canEdit = $this->canDo->get('help_document.edit'); $this->canState = $this->canDo->get('help_document.edit.state'); $this->canCreate = $this->canDo->get('help_document.create'); $this->canDelete = $this->canDo->get('help_document.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('help_document.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewHelp_documents extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewHelp_documents extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS'), 'support'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=help_documents'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS'), 'support'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('help_document.add'); + ToolbarHelper::addNew('help_document.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('help_document.edit'); + ToolbarHelper::editList('help_document.edit'); } if ($this->canState) { - JToolBarHelper::publishList('help_documents.publish'); - JToolBarHelper::unpublishList('help_documents.unpublish'); - JToolBarHelper::archiveList('help_documents.archive'); + ToolbarHelper::publishList('help_documents.publish'); + ToolbarHelper::unpublishList('help_documents.unpublish'); + ToolbarHelper::archiveList('help_documents.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('help_documents.checkin'); + ToolbarHelper::checkin('help_documents.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('help_documents.trash'); + ToolbarHelper::trash('help_documents.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export')) { - JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('help_documents.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) { - JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('help_documents.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('help_documents'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,9 +200,9 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -197,19 +210,19 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Type Selection - $this->typeOptions = JFormHelper::loadFieldType('helpdocumentsfiltertype')->options; + $this->typeOptions = FormHelper::loadFieldType('helpdocumentsfiltertype')->options; // We do some sanitation for Type filter - if (SermondistributorHelper::checkArray($this->typeOptions) && + if (ArrayHelper::check($this->typeOptions) && isset($this->typeOptions[0]->value) && - !SermondistributorHelper::checkString($this->typeOptions[0]->value)) + !StringHelper::check($this->typeOptions[0]->value)) { unset($this->typeOptions[0]); } // Type Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL').' -', 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') + Html::_('select.options', $this->typeOptions, 'value', 'text') ); } @@ -217,19 +230,19 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Location Selection - $this->locationOptions = JFormHelper::loadFieldType('helpdocumentsfilterlocation')->options; + $this->locationOptions = FormHelper::loadFieldType('helpdocumentsfilterlocation')->options; // We do some sanitation for Location filter - if (SermondistributorHelper::checkArray($this->locationOptions) && + if (ArrayHelper::check($this->locationOptions) && isset($this->locationOptions[0]->value) && - !SermondistributorHelper::checkString($this->locationOptions[0]->value)) + !StringHelper::check($this->locationOptions[0]->value)) { unset($this->locationOptions[0]); } // Location Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL').' -', 'batch[location]', - JHtml::_('select.options', $this->locationOptions, 'value', 'text') + Html::_('select.options', $this->locationOptions, 'value', 'text') ); } @@ -237,19 +250,19 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Admin View Selection - $this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options; + $this->admin_viewOptions = FormHelper::loadFieldType('Adminviewfolderlist')->options; // We do some sanitation for Admin View filter - if (SermondistributorHelper::checkArray($this->admin_viewOptions) && + if (ArrayHelper::check($this->admin_viewOptions) && isset($this->admin_viewOptions[0]->value) && - !SermondistributorHelper::checkString($this->admin_viewOptions[0]->value)) + !StringHelper::check($this->admin_viewOptions[0]->value)) { unset($this->admin_viewOptions[0]); } // Admin View Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', 'batch[admin_view]', - JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') + Html::_('select.options', $this->admin_viewOptions, 'value', 'text') ); } @@ -257,19 +270,19 @@ class SermondistributorViewHelp_documents extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Site View Selection - $this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options; + $this->site_viewOptions = FormHelper::loadFieldType('Siteviewfolderlist')->options; // We do some sanitation for Site View filter - if (SermondistributorHelper::checkArray($this->site_viewOptions) && + if (ArrayHelper::check($this->site_viewOptions) && isset($this->site_viewOptions[0]->value) && - !SermondistributorHelper::checkString($this->site_viewOptions[0]->value)) + !StringHelper::check($this->site_viewOptions[0]->value)) { unset($this->site_viewOptions[0]); } // Site View Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', 'batch[site_view]', - JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') + Html::_('select.options', $this->site_viewOptions, 'value', 'text') ); } } @@ -283,10 +296,10 @@ class SermondistributorViewHelp_documents extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/help_documents.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/help_documents.css", ['version' => 'auto']); } /** @@ -301,28 +314,38 @@ class SermondistributorViewHelp_documents extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.title' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL'), - 'a.type' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL'), - 'a.location' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL'), - 'g.' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL'), - 'h.' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.title' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL'), + 'a.type' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL'), + 'a.location' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL'), + 'h.' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL'), + 'i.' => Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php index 981e2a45..dede3cce 100644 --- a/admin/views/import/tmpl/default.php +++ b/admin/views/import/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,13 +25,19 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('jquery.framework'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('script', 'system/core.js', false, true); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +Html::_('jquery.framework'); +Html::_('bootstrap.tooltip'); +Html::_('script', 'system/core.js', false, true); +Html::_('behavior.keepalive'); + ?>
-
+ sidebar)) : ?>
@@ -145,13 +151,13 @@ jQuery(document).ready(function($) {
- hasPackage && SermondistributorHelper::checkArray($this->headerList) && SermondistributorHelper::checkArray($this->headers)) : ?> + hasPackage && ArrayHelper::check($this->headerList) && ArrayHelper::check($this->headers)) : ?>
- +
- +
- +
headerList as $name => $title): ?> @@ -159,72 +165,72 @@ jQuery(document).ready(function($) {
- +
- 'upload')); ?> - - + 'upload')); ?> + +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- - - + + +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- + - +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- - + + - + \ No newline at end of file diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index 86ffcad7..e5f238eb 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Import Html View @@ -39,7 +43,7 @@ class SermondistributorViewImport extends HtmlView protected $dataType; public function display($tpl = null) - { + { if ($this->getLayout() !== 'modal') { // Include helper submenu @@ -52,7 +56,7 @@ class SermondistributorViewImport extends HtmlView $this->paths = &$paths; $this->state = &$state; - // get global action permissions + // get global action permissions $this->canDo = SermondistributorHelper::getActions('import'); // We don't need toolbar in the modal window. @@ -63,18 +67,18 @@ class SermondistributorViewImport extends HtmlView } // get the session object - $session = JFactory::getSession(); + $session = Factory::getSession(); // check if it has package - $this->hasPackage = $session->get('hasPackage', false); - $this->dataType = $session->get('dataType', false); + $this->hasPackage = $session->get('hasPackage', false); + $this->dataType = $session->get('dataType', false); if($this->hasPackage && $this->dataType) { - $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); - $this->headers = SermondistributorHelper::getFileHeaders($this->dataType); + $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); + $this->headers = SermondistributorHelper::getFileHeaders($this->dataType); // clear the data type $session->clear('dataType'); } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,19 +94,19 @@ class SermondistributorViewImport extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_IMPORT_TITLE'), 'upload'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_IMPORT_TITLE'), 'upload'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=import'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('import'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/views/local_listing/submitbutton.js b/admin/views/local_listing/submitbutton.js index 2f1d446a..edea012c 100644 --- a/admin/views/local_listing/submitbutton.js +++ b/admin/views/local_listing/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/local_listing/tmpl/edit.php b/admin/views/local_listing/tmpl/edit.php index ebc7f254..22cd2b6f 100644 --- a/admin/views/local_listing/tmpl/edit.php +++ b/admin/views/local_listing/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,77 +25,76 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?> - build); ?> + build); ?> escape($item->size); ?> @@ -104,15 +108,15 @@ $edit = "index.php?option=com_sermondistributor&view=local_listings&task=local_l get('local_listing.edit.state')) : ?> checked_out) : ?> - published, $i, 'local_listings.', true, 'cb'); ?> + published, $i, 'local_listings.', true, 'cb'); ?> - published, $i, 'local_listings.', false, 'cb'); ?> + published, $i, 'local_listings.', false, 'cb'); ?> - published, $i, 'local_listings.', true, 'cb'); ?> + published, $i, 'local_listings.', true, 'cb'); ?> - published, $i, 'local_listings.', false, 'cb'); ?> + published, $i, 'local_listings.', false, 'cb'); ?> diff --git a/admin/views/local_listings/tmpl/default_foot.php b/admin/views/local_listings/tmpl/default_foot.php index d111908e..1756c246 100644 --- a/admin/views/local_listings/tmpl/default_foot.php +++ b/admin/views/local_listings/tmpl/default_foot.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_foot.php diff --git a/admin/views/local_listings/tmpl/default_head.php b/admin/views/local_listings/tmpl/default_head.php index 96c38e55..b0caa870 100644 --- a/admin/views/local_listings/tmpl/default_head.php +++ b/admin/views/local_listings/tmpl/default_head.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_head.php @@ -25,14 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -43,30 +46,30 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/local_listings/tmpl/default_toolbar.php b/admin/views/local_listings/tmpl/default_toolbar.php index 450e292c..9c9da0a5 100644 --- a/admin/views/local_listings/tmpl/default_toolbar.php +++ b/admin/views/local_listings/tmpl/default_toolbar.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_toolbar.php @@ -25,34 +25,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/local_listings/view.html.php b/admin/views/local_listings/view.html.php index 9a12394a..b31ea55e 100644 --- a/admin/views/local_listings/view.html.php +++ b/admin/views/local_listings/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Local_listings @@ -48,7 +61,7 @@ class SermondistributorViewLocal_listings extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewLocal_listings extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('local_listing'); $this->canEdit = $this->canDo->get('local_listing.edit'); $this->canState = $this->canDo->get('local_listing.edit.state'); $this->canCreate = $this->canDo->get('local_listing.create'); $this->canDelete = $this->canDo->get('local_listing.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('local_listing.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewLocal_listings extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewLocal_listings extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS'), 'link'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=local_listings'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS'), 'link'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('local_listing.add'); + ToolbarHelper::addNew('local_listing.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('local_listing.edit'); + ToolbarHelper::editList('local_listing.edit'); } if ($this->canState) { - JToolBarHelper::publishList('local_listings.publish'); - JToolBarHelper::unpublishList('local_listings.unpublish'); - JToolBarHelper::archiveList('local_listings.archive'); + ToolbarHelper::publishList('local_listings.publish'); + ToolbarHelper::unpublishList('local_listings.unpublish'); + ToolbarHelper::archiveList('local_listings.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('local_listings.checkin'); + ToolbarHelper::checkin('local_listings.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewLocal_listings extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewLocal_listings extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'local_listings.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'local_listings.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('local_listings.trash'); + ToolbarHelper::trash('local_listings.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('local_listing.export')) { - JToolBarHelper::custom('local_listings.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('local_listings.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('local_listing.import')) { - JToolBarHelper::custom('local_listings.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('local_listings.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('local_listings'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,19 +200,19 @@ class SermondistributorViewLocal_listings extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Build Selection - $this->buildOptions = JFormHelper::loadFieldType('locallistingsfilterbuild')->options; + $this->buildOptions = FormHelper::loadFieldType('locallistingsfilterbuild')->options; // We do some sanitation for Build filter - if (SermondistributorHelper::checkArray($this->buildOptions) && + if (ArrayHelper::check($this->buildOptions) && isset($this->buildOptions[0]->value) && - !SermondistributorHelper::checkString($this->buildOptions[0]->value)) + !StringHelper::check($this->buildOptions[0]->value)) { unset($this->buildOptions[0]); } // Build Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -', 'batch[build]', - JHtml::_('select.options', $this->buildOptions, 'value', 'text') + Html::_('select.options', $this->buildOptions, 'value', 'text') ); } @@ -207,19 +220,19 @@ class SermondistributorViewLocal_listings extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set External Source Description Selection - $this->external_sourceDescriptionOptions = JFormHelper::loadFieldType('Externalsource')->options; + $this->external_sourceDescriptionOptions = FormHelper::loadFieldType('Externalsource')->options; // We do some sanitation for External Source Description filter - if (SermondistributorHelper::checkArray($this->external_sourceDescriptionOptions) && + if (ArrayHelper::check($this->external_sourceDescriptionOptions) && isset($this->external_sourceDescriptionOptions[0]->value) && - !SermondistributorHelper::checkString($this->external_sourceDescriptionOptions[0]->value)) + !StringHelper::check($this->external_sourceDescriptionOptions[0]->value)) { unset($this->external_sourceDescriptionOptions[0]); } // External Source Description Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -', 'batch[external_source]', - JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text') + Html::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text') ); } } @@ -233,10 +246,10 @@ class SermondistributorViewLocal_listings extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/local_listings.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/local_listings.css", ['version' => 'auto']); } /** @@ -251,28 +264,38 @@ class SermondistributorViewLocal_listings extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL'), - 'a.build' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL'), - 'a.size' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL'), - 'g.description' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL'), - 'a.key' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL'), + 'a.build' => Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL'), + 'a.size' => Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL'), + 'g.description' => Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL'), + 'a.key' => Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/manual_updater/tmpl/default.php b/admin/views/manual_updater/tmpl/default.php index 8d48c389..95debb44 100644 --- a/admin/views/manual_updater/tmpl/default.php +++ b/admin/views/manual_updater/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,10 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); // get the needed module for translation $model = SermondistributorHelper::getModel('external_sources'); @@ -46,9 +53,9 @@ $model = SermondistributorHelper::getModel('external_sources'); } } -
+ -items) && SermondistributorHelper::checkArray($this->items)): ?> +items) && ArrayHelper::check($this->items)): ?>
- + items as $item): ?> - description).$item->id; ?> - '. $item->description . ' (' . JText::_($model->selectionTranslation($item->build, 'build')) . ')
'; ?> - + description).$item->id; ?> + '. $item->description . ' (' . Text::_($model->selectionTranslation($item->build, 'build')) . ')'; ?> +
-

+

id, 1, 2); ?> - + id.$target.$item->build); ?> - - id.$target.$item->build); ?> - - JText::_('COM_SERMONDISTRIBUTOR_THERE_WAS_AN_ERROR_DURING_THE_LAST_UPDATE_ATTEMPT')), $error); ?> + + id.$target.$item->build); ?> + + Text::_('COM_SERMONDISTRIBUTOR_THERE_WAS_AN_ERROR_DURING_THE_LAST_UPDATE_ATTEMPT')), $error); ?> - + - + - +
-

+

- +
-

+

diff --git a/admin/views/manual_updater/view.html.php b/admin/views/manual_updater/view.html.php index 6593614f..703e2b32 100644 --- a/admin/views/manual_updater/view.html.php +++ b/admin/views/manual_updater/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Manual_updater @@ -37,11 +46,11 @@ class SermondistributorViewManual_updater extends HtmlView function display($tpl = null) { // get component params - $this->params = JComponentHelper::getParams('com_sermondistributor'); + $this->params = ComponentHelper::getParams('com_sermondistributor'); // get the application - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // get global action permissions $this->canDo = SermondistributorHelper::getActions('manual_updater'); // Initialise variables. @@ -60,7 +69,7 @@ class SermondistributorViewManual_updater extends HtmlView // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -72,12 +81,15 @@ class SermondistributorViewManual_updater extends HtmlView protected function setDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -96,27 +108,25 @@ class SermondistributorViewManual_updater extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'uk-form'; } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -126,13 +136,13 @@ class SermondistributorViewManual_updater extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -144,17 +154,17 @@ class SermondistributorViewManual_updater extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_sermondistributor/assets/css/manual_updater.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'administrator/components/com_sermondistributor/assets/css/manual_updater.css', ['version' => 'auto']); } /** @@ -165,26 +175,26 @@ class SermondistributorViewManual_updater extends HtmlView // hide the main menu $this->app->input->set('hidemainmenu', true); // add title to the page - JToolbarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_MANUAL_UPDATER'),'cogs'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_MANUAL_UPDATER'),'cogs'); // add cpanel button - JToolBarHelper::custom('manual_updater.dashboard', 'grid-2', '', 'COM_SERMONDISTRIBUTOR_DASH', false); + ToolbarHelper::custom('manual_updater.dashboard', 'grid-2', '', 'COM_SERMONDISTRIBUTOR_DASH', false); if ($this->canDo->get('manual_updater.external_sources')) { // add External Sources button. - JToolBarHelper::custom('manual_updater.gotoExternalSources', 'puzzle custom-button-gotoexternalsources', '', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES', false); + ToolbarHelper::custom('manual_updater.gotoExternalSources', 'puzzle custom-button-gotoexternalsources', '', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('manual_updater'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } } @@ -198,6 +208,16 @@ class SermondistributorViewManual_updater extends HtmlView public function escape($var) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/views/preacher/submitbutton.js b/admin/views/preacher/submitbutton.js index 712543e9..fa9f884c 100644 --- a/admin/views/preacher/submitbutton.js +++ b/admin/views/preacher/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/preacher/tmpl/edit.php b/admin/views/preacher/tmpl/edit.php index ca4892d0..87179bd3 100644 --- a/admin/views/preacher/tmpl/edit.php +++ b/admin/views/preacher/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,89 +25,88 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/preachers/view.html.php b/admin/views/preachers/view.html.php index d9b27863..acc2becc 100644 --- a/admin/views/preachers/view.html.php +++ b/admin/views/preachers/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Preachers @@ -49,7 +62,7 @@ class SermondistributorViewPreachers extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -59,14 +72,14 @@ class SermondistributorViewPreachers extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('preacher'); $this->canEdit = $this->canDo->get('preacher.edit'); $this->canState = $this->canDo->get('preacher.edit.state'); $this->canCreate = $this->canDo->get('preacher.create'); $this->canDelete = $this->canDo->get('preacher.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('preacher.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -79,7 +92,7 @@ class SermondistributorViewPreachers extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -98,32 +111,32 @@ class SermondistributorViewPreachers extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_PREACHERS'), 'user'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=preachers'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_PREACHERS'), 'user'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('preacher.add'); + ToolbarHelper::addNew('preacher.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('preacher.edit'); + ToolbarHelper::editList('preacher.edit'); } if ($this->canState) { - JToolBarHelper::publishList('preachers.publish'); - JToolBarHelper::unpublishList('preachers.unpublish'); - JToolBarHelper::archiveList('preachers.archive'); + ToolbarHelper::publishList('preachers.publish'); + ToolbarHelper::unpublishList('preachers.unpublish'); + ToolbarHelper::archiveList('preachers.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('preachers.checkin'); + ToolbarHelper::checkin('preachers.checkin'); } } @@ -131,11 +144,11 @@ class SermondistributorViewPreachers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -143,44 +156,44 @@ class SermondistributorViewPreachers extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'preachers.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'preachers.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('preachers.trash'); + ToolbarHelper::trash('preachers.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('preacher.export')) { - JToolBarHelper::custom('preachers.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('preachers.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('preacher.import')) { - JToolBarHelper::custom('preachers.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('preachers.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('preachers'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -188,9 +201,9 @@ class SermondistributorViewPreachers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } } @@ -204,10 +217,10 @@ class SermondistributorViewPreachers extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_PREACHERS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/preachers.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_PREACHERS')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/preachers.css", ['version' => 'auto']); } /** @@ -222,25 +235,35 @@ class SermondistributorViewPreachers extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL'), - 'a.description' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_DESCRIPTION_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL'), + 'a.description' => Text::_('COM_SERMONDISTRIBUTOR_PREACHER_DESCRIPTION_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/series/submitbutton.js b/admin/views/series/submitbutton.js index c8a2de86..05ddbdf0 100644 --- a/admin/views/series/submitbutton.js +++ b/admin/views/series/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/series/tmpl/edit.php b/admin/views/series/tmpl/edit.php index 1bd63c85..6a28ab49 100644 --- a/admin/views/series/tmpl/edit.php +++ b/admin/views/series/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,89 +25,88 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/series_list/view.html.php b/admin/views/series_list/view.html.php index d7fbd8bc..8f456831 100644 --- a/admin/views/series_list/view.html.php +++ b/admin/views/series_list/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Series_list @@ -48,7 +61,7 @@ class SermondistributorViewSeries_list extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewSeries_list extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('series'); $this->canEdit = $this->canDo->get('series.edit'); $this->canState = $this->canDo->get('series.edit.state'); $this->canCreate = $this->canDo->get('series.create'); $this->canDelete = $this->canDo->get('series.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('series.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewSeries_list extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewSeries_list extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_SERIES_LIST'), 'folder-open'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=series_list'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_SERIES_LIST'), 'folder-open'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('series.add'); + ToolbarHelper::addNew('series.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('series.edit'); + ToolbarHelper::editList('series.edit'); } if ($this->canState) { - JToolBarHelper::publishList('series_list.publish'); - JToolBarHelper::unpublishList('series_list.unpublish'); - JToolBarHelper::archiveList('series_list.archive'); + ToolbarHelper::publishList('series_list.publish'); + ToolbarHelper::unpublishList('series_list.unpublish'); + ToolbarHelper::archiveList('series_list.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('series_list.checkin'); + ToolbarHelper::checkin('series_list.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewSeries_list extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewSeries_list extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'series_list.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'series_list.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('series_list.trash'); + ToolbarHelper::trash('series_list.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('series.export')) { - JToolBarHelper::custom('series_list.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('series_list.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('series.import')) { - JToolBarHelper::custom('series_list.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('series_list.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('series_list'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,9 +200,9 @@ class SermondistributorViewSeries_list extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } } @@ -203,10 +216,10 @@ class SermondistributorViewSeries_list extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_SERIES_LIST')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/series_list.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_SERIES_LIST')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/series_list.css", ['version' => 'auto']); } /** @@ -221,24 +234,34 @@ class SermondistributorViewSeries_list extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/sermon/submitbutton.js b/admin/views/sermon/submitbutton.js index a9a57c6a..925e1714 100644 --- a/admin/views/sermon/submitbutton.js +++ b/admin/views/sermon/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/sermon/tmpl/edit.php b/admin/views/sermon/tmpl/edit.php index 41e0547e..9b48b4c6 100644 --- a/admin/views/sermon/tmpl/edit.php +++ b/admin/views/sermon/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,99 +25,98 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/sermon/view.html.php b/admin/views/sermon/view.html.php index 27eb87a4..447c83d0 100644 --- a/admin/views/sermon/view.html.php +++ b/admin/views/sermon/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\StringHelper; /** * Sermon Html View class @@ -40,7 +52,7 @@ class SermondistributorViewSermon extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_sermondistributor'); + $this->params = ComponentHelper::getParams('com_sermondistributor'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -49,7 +61,7 @@ class SermondistributorViewSermon extends HtmlView // get action permissions $this->canDo = SermondistributorHelper::getActions('sermon', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -77,7 +89,7 @@ class SermondistributorViewSermon extends HtmlView // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,34 +109,34 @@ class SermondistributorViewSermon extends HtmlView */ protected function addToolBar() { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + Factory::getApplication()->input->set('hidemainmenu', true); + $user = Factory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; - JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERMON_NEW' : 'COM_SERMONDISTRIBUTOR_SERMON_EDIT'), 'pencil-2 article-add'); + ToolbarHelper::title( Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERMON_NEW' : 'COM_SERMONDISTRIBUTOR_SERMON_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. - if (SermondistributorHelper::checkString($this->referral)) + if (StringHelper::check($this->referral)) { if ($this->canDo->get('sermon.create') && $isNew) { // We can create the record. - JToolBarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('sermon.edit')) { // We can save the record. - JToolBarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. - JToolBarHelper::cancel('sermon.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('sermon.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. - JToolBarHelper::cancel('sermon.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('sermon.cancel', 'JTOOLBAR_CLOSE'); } } else @@ -134,44 +146,44 @@ class SermondistributorViewSermon extends HtmlView // For new records, check the create permission. if ($this->canDo->get('sermon.create')) { - JToolBarHelper::apply('sermon.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('sermon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::apply('sermon.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::custom('sermon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); }; - JToolBarHelper::cancel('sermon.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('sermon.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('sermon.edit')) { // We can save the new record - JToolBarHelper::apply('sermon.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('sermon.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('sermon.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('sermon.create')) { - JToolBarHelper::custom('sermon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('sermon.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('sermon.version')); if ($this->state->params->get('save_history', 1) && $this->canDo->get('sermon.edit') && $canVersion) { - JToolbarHelper::versions('com_sermondistributor.sermon', $this->item->id); + ToolbarHelper::versions('com_sermondistributor.sermon', $this->item->id); } if ($this->canDo->get('sermon.create')) { - JToolBarHelper::custom('sermon.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + ToolbarHelper::custom('sermon.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } - JToolBarHelper::cancel('sermon.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('sermon.cancel', 'JTOOLBAR_CLOSE'); } } - JToolbarHelper::divider(); + ToolbarHelper::divider(); // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('sermon'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } } @@ -186,11 +198,11 @@ class SermondistributorViewSermon extends HtmlView { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return StringHelper::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** @@ -201,40 +213,46 @@ class SermondistributorViewSermon extends HtmlView protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERMON_NEW' : 'COM_SERMONDISTRIBUTOR_SERMON_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/sermon.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERMON_NEW' : 'COM_SERMONDISTRIBUTOR_SERMON_EDIT')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/sermon.css", ['version' => 'auto']); // Add Ajax Token - $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScriptDeclaration("var token = '" . Session::getFormToken() . "';"); // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable(); }); jQuery('.nav-tabs').on('click', 'li', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('.footable').trigger('footable_resize'); }"; $this->document->addScriptDeclaration($footable); - $this->document->addScript(JURI::root() . $this->script, (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/sermon/submitbutton.js", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "administrator/components/com_sermondistributor/views/sermon/submitbutton.js", ['version' => 'auto']); + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/views/sermondistributor/tmpl/default.php b/admin/views/sermondistributor/tmpl/default.php index ff89933a..0f239912 100644 --- a/admin/views/sermondistributor/tmpl/default.php +++ b/admin/views/sermondistributor/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,92 +25,94 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; ?>
- 'cpanel')); ?> + 'cpanel')); ?> - +
- 'main')); ?> - + 'main')); ?> + loadTemplate('main');?> - - + +
- 'vdm')); ?> - + 'vdm')); ?> + loadTemplate('vdm');?> - - + +
- + - +
- 'open_issues_one')); ?> - + 'open_issues_one')); ?> + loadTemplate('open_issues_the_open_issues_on_github');?> - - + +
- + - +
- 'closed_issues_one')); ?> - + 'closed_issues_one')); ?> + loadTemplate('closed_issues_the_closed_issues_on_github');?> - - + +
- + - +
- 'releases_one')); ?> - + 'releases_one')); ?> + loadTemplate('releases_information');?> - - + +
- + - +
- 'vast_development_method_one')); ?> - + 'vast_development_method_one')); ?> + loadTemplate('vast_development_method_notice_board');?> - - + +
- + - +
- 'readme_one')); ?> - + 'readme_one')); ?> + loadTemplate('readme_information');?> - - + +
- + - +
\ No newline at end of file diff --git a/admin/views/sermondistributor/tmpl/default_closed_issues_the_closed_issues_on_github.php b/admin/views/sermondistributor/tmpl/default_closed_issues_the_closed_issues_on_github.php index 78a82d96..98f40b0d 100644 --- a/admin/views/sermondistributor/tmpl/default_closed_issues_the_closed_issues_on_github.php +++ b/admin/views/sermondistributor/tmpl/default_closed_issues_the_closed_issues_on_github.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_closed_issues_the_closed_issues_on_github.php @@ -25,5 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> github->closedissues; ?> diff --git a/admin/views/sermondistributor/tmpl/default_main.php b/admin/views/sermondistributor/tmpl/default_main.php index b1433360..af72b354 100644 --- a/admin/views/sermondistributor/tmpl/default_main.php +++ b/admin/views/sermondistributor/tmpl/default_main.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_main.php @@ -25,19 +25,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> icons['main']) && is_array($this->icons['main'])) :?> icons['main'] as $icon): ?>
-
-

+

\ No newline at end of file diff --git a/admin/views/sermondistributor/tmpl/default_open_issues_the_open_issues_on_github.php b/admin/views/sermondistributor/tmpl/default_open_issues_the_open_issues_on_github.php index aca740fb..fba068db 100644 --- a/admin/views/sermondistributor/tmpl/default_open_issues_the_open_issues_on_github.php +++ b/admin/views/sermondistributor/tmpl/default_open_issues_the_open_issues_on_github.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_open_issues_the_open_issues_on_github.php @@ -25,5 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> github->openissues; ?> diff --git a/admin/views/sermondistributor/tmpl/default_readme_information.php b/admin/views/sermondistributor/tmpl/default_readme_information.php index a877c37b..e4162d0f 100644 --- a/admin/views/sermondistributor/tmpl/default_readme_information.php +++ b/admin/views/sermondistributor/tmpl/default_readme_information.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_readme_information.php @@ -25,5 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> readme; ?> diff --git a/admin/views/sermondistributor/tmpl/default_releases_information.php b/admin/views/sermondistributor/tmpl/default_releases_information.php index 62dc3273..a296242d 100644 --- a/admin/views/sermondistributor/tmpl/default_releases_information.php +++ b/admin/views/sermondistributor/tmpl/default_releases_information.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_releases_information.php @@ -25,5 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> github->tagreleases; ?> diff --git a/admin/views/sermondistributor/tmpl/default_vast_development_method_notice_board.php b/admin/views/sermondistributor/tmpl/default_vast_development_method_notice_board.php index 44ef9118..91a86efe 100644 --- a/admin/views/sermondistributor/tmpl/default_vast_development_method_notice_board.php +++ b/admin/views/sermondistributor/tmpl/default_vast_development_method_notice_board.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_vast_development_method_notice_board.php @@ -25,5 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> noticeboard; ?> diff --git a/admin/views/sermondistributor/tmpl/default_vdm.php b/admin/views/sermondistributor/tmpl/default_vdm.php index fded7c0a..9133374c 100644 --- a/admin/views/sermondistributor/tmpl/default_vdm.php +++ b/admin/views/sermondistributor/tmpl/default_vdm.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_vdm.php @@ -25,22 +25,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\ArrayHelper; + ?> -<?php echo JText::_('COM_SERMONDISTRIBUTOR'); ?> +<?php echo Text::_('COM_SERMONDISTRIBUTOR'); ?>
-contributors)): ?> +contributors)): ?> contributors) > 1): ?> -

+

-

+

    contributors as $contributor): ?> diff --git a/admin/views/sermondistributor/view.html.php b/admin/views/sermondistributor/view.html.php index 619d7dd3..1bd699ab 100644 --- a/admin/views/sermondistributor/view.html.php +++ b/admin/views/sermondistributor/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,12 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor View class */ -class SermondistributorViewSermondistributor extends JViewLegacy +class SermondistributorViewSermondistributor extends HtmlView { /** * View display method @@ -39,19 +44,19 @@ class SermondistributorViewSermondistributor extends JViewLegacy function display($tpl = null) { // Assign data to the view - $this->icons = $this->get('Icons'); - $this->contributors = SermondistributorHelper::getContributors(); + $this->icons = $this->get('Icons'); + $this->contributors = SermondistributorHelper::getContributors(); $this->github = $this->get('Github'); $this->wiki = $this->get('Wiki'); $this->noticeboard = $this->get('Noticeboard'); $this->readme = $this->get('Readme'); - + // get the manifest details of the component $this->manifest = SermondistributorHelper::manifest(); - + // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -71,18 +76,18 @@ class SermondistributorViewSermondistributor extends JViewLegacy protected function addToolBar() { $canDo = SermondistributorHelper::getActions('sermondistributor'); - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_DASHBOARD'), 'grid-2'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_DASHBOARD'), 'grid-2'); // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('sermondistributor'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } } @@ -93,15 +98,17 @@ class SermondistributorViewSermondistributor extends JViewLegacy */ protected function setDocument() { - $document = JFactory::getDocument(); - - // add dashboard style sheets - $document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/dashboard.css"); - + if (!isset($this->document)) + { + $this->document = Factory::getDocument(); + } // set page title - $document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_DASHBOARD')); - + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_DASHBOARD')); + // add manifest to page JavaScript - $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + $this->document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + + // add dashboard style sheets + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/dashboard.css", ['version' => 'auto']); } } diff --git a/admin/views/sermons/tmpl/default.php b/admin/views/sermons/tmpl/default.php index b27f2b9e..17daab27 100644 --- a/admin/views/sermons/tmpl/default.php +++ b/admin/views/sermons/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,20 +25,27 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', '.multiplePreachers', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_PREACHER') . ' -')); -JHtml::_('formbehavior.chosen', '.multipleSeries', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERIES') . ' -')); -JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERMONS_CATEGORIES') . ' -')); -JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); +Html::_('formbehavior.chosen', '.multiplePreachers', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_PREACHER') . ' -']); +Html::_('formbehavior.chosen', '.multipleSeries', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERIES') . ' -']); +Html::_('formbehavior.chosen', '.multipleCategories', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERMONS_CATEGORIES') . ' -']); +Html::_('formbehavior.chosen', '.multipleAccessLevels', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -']); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=sermons.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'sermonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'sermonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
    + sidebar)): ?>
    sidebar; ?> @@ -49,13 +56,13 @@ if ($this->saveOrder) $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
    - +
    @@ -65,11 +72,11 @@ if ($this->saveOrder)
    canCreate && $this->canEdit) : ?> - JText::_('COM_SERMONDISTRIBUTOR_SERMONS_BATCH_OPTIONS'), + 'title' => Text::_('COM_SERMONDISTRIBUTOR_SERMONS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -79,5 +86,5 @@ if ($this->saveOrder)
    - +
    diff --git a/admin/views/sermons/tmpl/default_batch_body.php b/admin/views/sermons/tmpl/default_batch_body.php index 1eb22643..1597a57d 100644 --- a/admin/views/sermons/tmpl/default_batch_body.php +++ b/admin/views/sermons/tmpl/default_batch_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_body.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

    +

    batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/sermons/tmpl/default_batch_footer.php b/admin/views/sermons/tmpl/default_batch_footer.php index 2a92a806..be02371a 100644 --- a/admin/views/sermons/tmpl/default_batch_footer.php +++ b/admin/views/sermons/tmpl/default_batch_footer.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_footer.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/sermons/tmpl/default_body.php b/admin/views/sermons/tmpl/default_body.php index 3ce8ae8c..12a1efa9 100644 --- a/admin/views/sermons/tmpl/default_body.php +++ b/admin/views/sermons/tmpl/default_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_body.php @@ -25,13 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('sermon',$item,'sermons'); ?> @@ -41,7 +45,7 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -59,12 +63,12 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; get('sermon.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -75,7 +79,7 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit"; get('sermon.edit')): ?> escape($item->name); ?> checked_out): ?> - name, $item->checked_out_time, 'sermons.', $canCheckin); ?> + name, $item->checked_out_time, 'sermons.', $canCheckin); ?> escape($item->name); ?> @@ -113,24 +117,24 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
- link_type); ?> + link_type); ?> - source); ?> + source); ?> get('sermon.edit.state')) : ?> checked_out) : ?> - published, $i, 'sermons.', true, 'cb'); ?> + published, $i, 'sermons.', true, 'cb'); ?> - published, $i, 'sermons.', false, 'cb'); ?> + published, $i, 'sermons.', false, 'cb'); ?> - published, $i, 'sermons.', true, 'cb'); ?> + published, $i, 'sermons.', true, 'cb'); ?> - published, $i, 'sermons.', false, 'cb'); ?> + published, $i, 'sermons.', false, 'cb'); ?> diff --git a/admin/views/sermons/tmpl/default_foot.php b/admin/views/sermons/tmpl/default_foot.php index 9afbf28b..cde585a3 100644 --- a/admin/views/sermons/tmpl/default_foot.php +++ b/admin/views/sermons/tmpl/default_foot.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_foot.php diff --git a/admin/views/sermons/tmpl/default_head.php b/admin/views/sermons/tmpl/default_head.php index f9c5cc65..d7d2154d 100644 --- a/admin/views/sermons/tmpl/default_head.php +++ b/admin/views/sermons/tmpl/default_head.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_head.php @@ -25,14 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -43,36 +46,36 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/sermons/tmpl/default_toolbar.php b/admin/views/sermons/tmpl/default_toolbar.php index f1cf2010..628aaf25 100644 --- a/admin/views/sermons/tmpl/default_toolbar.php +++ b/admin/views/sermons/tmpl/default_toolbar.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_toolbar.php @@ -25,34 +25,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/sermons/view.html.php b/admin/views/sermons/view.html.php index 68e8e6db..c502c600 100644 --- a/admin/views/sermons/view.html.php +++ b/admin/views/sermons/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Sermons @@ -48,7 +61,7 @@ class SermondistributorViewSermons extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewSermons extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('sermon'); $this->canEdit = $this->canDo->get('sermon.edit'); $this->canState = $this->canDo->get('sermon.edit.state'); $this->canCreate = $this->canDo->get('sermon.create'); $this->canDelete = $this->canDo->get('sermon.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('sermon.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewSermons extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewSermons extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_SERMONS'), 'book'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=sermons'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_SERMONS'), 'book'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('sermon.add'); + ToolbarHelper::addNew('sermon.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('sermon.edit'); + ToolbarHelper::editList('sermon.edit'); } if ($this->canState) { - JToolBarHelper::publishList('sermons.publish'); - JToolBarHelper::unpublishList('sermons.unpublish'); - JToolBarHelper::archiveList('sermons.archive'); + ToolbarHelper::publishList('sermons.publish'); + ToolbarHelper::unpublishList('sermons.unpublish'); + ToolbarHelper::archiveList('sermons.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('sermons.checkin'); + ToolbarHelper::checkin('sermons.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewSermons extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'sermons.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'sermons.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('sermons.trash'); + ToolbarHelper::trash('sermons.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('sermon.export')) { - JToolBarHelper::custom('sermons.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('sermons.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('sermon.import')) { - JToolBarHelper::custom('sermons.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('sermons.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('sermons'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,9 +200,9 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -197,9 +210,9 @@ class SermondistributorViewSermons extends HtmlView { // Category Batch selection. JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_CATEGORY'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_CATEGORY'), 'batch[category]', - JHtml::_('select.options', JHtml::_('category.options', 'com_sermondistributor.sermon'), 'value', 'text') + Html::_('select.options', Html::_('category.options', 'com_sermondistributor.sermon'), 'value', 'text') ); } @@ -207,19 +220,19 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Preacher Name Selection - $this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options; + $this->preacherNameOptions = FormHelper::loadFieldType('Preachers')->options; // We do some sanitation for Preacher Name filter - if (SermondistributorHelper::checkArray($this->preacherNameOptions) && + if (ArrayHelper::check($this->preacherNameOptions) && isset($this->preacherNameOptions[0]->value) && - !SermondistributorHelper::checkString($this->preacherNameOptions[0]->value)) + !StringHelper::check($this->preacherNameOptions[0]->value)) { unset($this->preacherNameOptions[0]); } // Preacher Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL').' -', 'batch[preacher]', - JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text') + Html::_('select.options', $this->preacherNameOptions, 'value', 'text') ); } @@ -227,19 +240,19 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Series Name Selection - $this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options; + $this->seriesNameOptions = FormHelper::loadFieldType('Series')->options; // We do some sanitation for Series Name filter - if (SermondistributorHelper::checkArray($this->seriesNameOptions) && + if (ArrayHelper::check($this->seriesNameOptions) && isset($this->seriesNameOptions[0]->value) && - !SermondistributorHelper::checkString($this->seriesNameOptions[0]->value)) + !StringHelper::check($this->seriesNameOptions[0]->value)) { unset($this->seriesNameOptions[0]); } // Series Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL').' -', 'batch[series]', - JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text') + Html::_('select.options', $this->seriesNameOptions, 'value', 'text') ); } @@ -247,19 +260,19 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Link Type Selection - $this->link_typeOptions = JFormHelper::loadFieldType('sermonsfilterlinktype')->options; + $this->link_typeOptions = FormHelper::loadFieldType('sermonsfilterlinktype')->options; // We do some sanitation for Link Type filter - if (SermondistributorHelper::checkArray($this->link_typeOptions) && + if (ArrayHelper::check($this->link_typeOptions) && isset($this->link_typeOptions[0]->value) && - !SermondistributorHelper::checkString($this->link_typeOptions[0]->value)) + !StringHelper::check($this->link_typeOptions[0]->value)) { unset($this->link_typeOptions[0]); } // Link Type Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL').' -', 'batch[link_type]', - JHtml::_('select.options', $this->link_typeOptions, 'value', 'text') + Html::_('select.options', $this->link_typeOptions, 'value', 'text') ); } @@ -267,19 +280,19 @@ class SermondistributorViewSermons extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Source Selection - $this->sourceOptions = JFormHelper::loadFieldType('sermonsfiltersource')->options; + $this->sourceOptions = FormHelper::loadFieldType('sermonsfiltersource')->options; // We do some sanitation for Source filter - if (SermondistributorHelper::checkArray($this->sourceOptions) && + if (ArrayHelper::check($this->sourceOptions) && isset($this->sourceOptions[0]->value) && - !SermondistributorHelper::checkString($this->sourceOptions[0]->value)) + !StringHelper::check($this->sourceOptions[0]->value)) { unset($this->sourceOptions[0]); } // Source Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL').' -', 'batch[source]', - JHtml::_('select.options', $this->sourceOptions, 'value', 'text') + Html::_('select.options', $this->sourceOptions, 'value', 'text') ); } } @@ -293,10 +306,10 @@ class SermondistributorViewSermons extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_SERMONS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/sermons.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_SERMONS')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/sermons.css", ['version' => 'auto']); } /** @@ -311,30 +324,40 @@ class SermondistributorViewSermons extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL'), - 'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'), - 'h.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL'), - 'a.short_description' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'), - 'category_title' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), - 'a.link_type' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'), - 'a.source' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL'), + 'g.name' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'), + 'h.name' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL'), + 'a.short_description' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL'), + 'category_title' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), + 'a.link_type' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'), + 'a.source' => Text::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/admin/views/statistic/submitbutton.js b/admin/views/statistic/submitbutton.js index 22bf8953..16f8e301 100644 --- a/admin/views/statistic/submitbutton.js +++ b/admin/views/statistic/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/statistic/tmpl/edit.php b/admin/views/statistic/tmpl/edit.php index 15d10386..ada735ab 100644 --- a/admin/views/statistic/tmpl/edit.php +++ b/admin/views/statistic/tmpl/edit.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage edit.php @@ -25,50 +25,56 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
-
+ - +
- 'details')); ?> + 'details')); ?> - +
- +
- +
- + ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?> tab_name = 'statisticTab'; ?> - + canDo->get('statistic.edit.created_by') || $this->canDo->get('statistic.edit.created') || $this->canDo->get('statistic.edit.state') || ($this->canDo->get('statistic.delete') && $this->canDo->get('statistic.edit.state'))) : ?> - +
- +
- +
- + canDo->get('core.admin')) : ?> - +
@@ -83,14 +89,14 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- + - +
- +
diff --git a/admin/views/statistic/view.html.php b/admin/views/statistic/view.html.php index 02971971..7cc76ad9 100644 --- a/admin/views/statistic/view.html.php +++ b/admin/views/statistic/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,19 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Statistic Html View class @@ -39,7 +51,7 @@ class SermondistributorViewStatistic extends HtmlView public function display($tpl = null) { // set params - $this->params = JComponentHelper::getParams('com_sermondistributor'); + $this->params = ComponentHelper::getParams('com_sermondistributor'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); @@ -48,7 +60,7 @@ class SermondistributorViewStatistic extends HtmlView // get action permissions $this->canDo = SermondistributorHelper::getActions('statistic', $this->item); // get input - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $return = $jinput->get('return', null, 'base64'); @@ -73,7 +85,7 @@ class SermondistributorViewStatistic extends HtmlView // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -93,34 +105,34 @@ class SermondistributorViewStatistic extends HtmlView */ protected function addToolBar() { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + Factory::getApplication()->input->set('hidemainmenu', true); + $user = Factory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; - JToolbarHelper::title( JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_STATISTIC_NEW' : 'COM_SERMONDISTRIBUTOR_STATISTIC_EDIT'), 'pencil-2 article-add'); + ToolbarHelper::title( Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_STATISTIC_NEW' : 'COM_SERMONDISTRIBUTOR_STATISTIC_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. - if (SermondistributorHelper::checkString($this->referral)) + if (StringHelper::check($this->referral)) { if ($this->canDo->get('statistic.create') && $isNew) { // We can create the record. - JToolBarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('statistic.edit')) { // We can save the record. - JToolBarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. - JToolBarHelper::cancel('statistic.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('statistic.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. - JToolBarHelper::cancel('statistic.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('statistic.cancel', 'JTOOLBAR_CLOSE'); } } else @@ -130,44 +142,44 @@ class SermondistributorViewStatistic extends HtmlView // For new records, check the create permission. if ($this->canDo->get('statistic.create')) { - JToolBarHelper::apply('statistic.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('statistic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::apply('statistic.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::custom('statistic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); }; - JToolBarHelper::cancel('statistic.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('statistic.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('statistic.edit')) { // We can save the new record - JToolBarHelper::apply('statistic.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('statistic.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('statistic.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('statistic.create')) { - JToolBarHelper::custom('statistic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('statistic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('statistic.version')); if ($this->state->params->get('save_history', 1) && $this->canDo->get('statistic.edit') && $canVersion) { - JToolbarHelper::versions('com_sermondistributor.statistic', $this->item->id); + ToolbarHelper::versions('com_sermondistributor.statistic', $this->item->id); } if ($this->canDo->get('statistic.create')) { - JToolBarHelper::custom('statistic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + ToolbarHelper::custom('statistic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } - JToolBarHelper::cancel('statistic.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('statistic.cancel', 'JTOOLBAR_CLOSE'); } } - JToolbarHelper::divider(); + ToolbarHelper::divider(); // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('statistic'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } } @@ -182,11 +194,11 @@ class SermondistributorViewStatistic extends HtmlView { if(strlen($var) > 30) { - // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true, 30); + // use the helper htmlEscape method instead and shorten the string + return StringHelper::html($var, $this->_charset, true, 30); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** @@ -197,14 +209,20 @@ class SermondistributorViewStatistic extends HtmlView protected function setDocument() { $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_SERMONDISTRIBUTOR_STATISTIC_NEW' : 'COM_SERMONDISTRIBUTOR_STATISTIC_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/statistic.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_sermondistributor/views/statistic/submitbutton.js", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); + $this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_STATISTIC_NEW' : 'COM_SERMONDISTRIBUTOR_STATISTIC_EDIT')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/statistic.css", ['version' => 'auto']); + Html::_('script', $this->script, ['version' => 'auto']); + Html::_('script', "administrator/components/com_sermondistributor/views/statistic/submitbutton.js", ['version' => 'auto']); + Text::script('view not acceptable. Error'); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/admin/views/statistics/tmpl/default.php b/admin/views/statistics/tmpl/default.php index 2e2c0194..c092194d 100644 --- a/admin/views/statistics/tmpl/default.php +++ b/admin/views/statistics/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,17 +25,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::_('behavior.multiselect'); +Html::_('dropdown.init'); +Html::_('formbehavior.chosen', 'select'); +Html::_('formbehavior.chosen', '.multipleAccessLevels', null, ['placeholder_text_multiple' => '- ' . Text::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_ACCESS') . ' -']); + if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=statistics.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'statisticList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); + Html::_('sortablelist.sortable', 'statisticList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } ?> -
+ sidebar)): ?>
sidebar; ?> @@ -46,13 +53,13 @@ if ($this->saveOrder) $this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> items)): ?>
- +
@@ -62,11 +69,11 @@ if ($this->saveOrder)
canCreate && $this->canEdit) : ?> - JText::_('COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_OPTIONS'), + 'title' => Text::_('COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') @@ -76,5 +83,5 @@ if ($this->saveOrder)
- +
diff --git a/admin/views/statistics/tmpl/default_batch_body.php b/admin/views/statistics/tmpl/default_batch_body.php index 00be6d14..59657039 100644 --- a/admin/views/statistics/tmpl/default_batch_body.php +++ b/admin/views/statistics/tmpl/default_batch_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_body.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> -

+

batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/statistics/tmpl/default_batch_footer.php b/admin/views/statistics/tmpl/default_batch_footer.php index 0c53ecf4..f84a74b9 100644 --- a/admin/views/statistics/tmpl/default_batch_footer.php +++ b/admin/views/statistics/tmpl/default_batch_footer.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_batch_footer.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> \ No newline at end of file diff --git a/admin/views/statistics/tmpl/default_body.php b/admin/views/statistics/tmpl/default_body.php index 88f03b23..93b48ba7 100644 --- a/admin/views/statistics/tmpl/default_body.php +++ b/admin/views/statistics/tmpl/default_body.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_body.php @@ -25,13 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.edit"; ?> items as $i => $item): ?> user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); + $userChkOut = Factory::getUser($item->checked_out); $canDo = SermondistributorHelper::getActions('statistic',$item,'statistics'); ?> @@ -41,7 +45,7 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e $iconClass = ''; if (!$this->saveOrder) { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + $iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED'); } ?> @@ -59,12 +63,12 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e get('statistic.edit')): ?> checked_out) : ?> - id); ?> + id); ?> - id); ?> + id); ?> □ @@ -75,7 +79,7 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e get('statistic.edit')): ?> filename; ?> checked_out): ?> - name, $item->checked_out_time, 'statistics.', $canCheckin); ?> + name, $item->checked_out_time, 'statistics.', $canCheckin); ?> filename; ?> @@ -116,15 +120,15 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e get('statistic.edit.state')) : ?> checked_out) : ?> - published, $i, 'statistics.', true, 'cb'); ?> + published, $i, 'statistics.', true, 'cb'); ?> - published, $i, 'statistics.', false, 'cb'); ?> + published, $i, 'statistics.', false, 'cb'); ?> - published, $i, 'statistics.', true, 'cb'); ?> + published, $i, 'statistics.', true, 'cb'); ?> - published, $i, 'statistics.', false, 'cb'); ?> + published, $i, 'statistics.', false, 'cb'); ?> diff --git a/admin/views/statistics/tmpl/default_foot.php b/admin/views/statistics/tmpl/default_foot.php index d111908e..1756c246 100644 --- a/admin/views/statistics/tmpl/default_foot.php +++ b/admin/views/statistics/tmpl/default_foot.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_foot.php diff --git a/admin/views/statistics/tmpl/default_head.php b/admin/views/statistics/tmpl/default_head.php index 5e85d912..7b28d7d0 100644 --- a/admin/views/statistics/tmpl/default_head.php +++ b/admin/views/statistics/tmpl/default_head.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_head.php @@ -25,14 +25,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -43,30 +46,30 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/statistics/tmpl/default_toolbar.php b/admin/views/statistics/tmpl/default_toolbar.php index a71d3ddf..1a0204d6 100644 --- a/admin/views/statistics/tmpl/default_toolbar.php +++ b/admin/views/statistics/tmpl/default_toolbar.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_toolbar.php @@ -25,34 +25,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/statistics/view.html.php b/admin/views/statistics/view.html.php index f43ea95e..9883f8fd 100644 --- a/admin/views/statistics/view.html.php +++ b/admin/views/statistics/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Statistics @@ -48,7 +61,7 @@ class SermondistributorViewStatistics extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -58,14 +71,14 @@ class SermondistributorViewStatistics extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = SermondistributorHelper::getActions('statistic'); $this->canEdit = $this->canDo->get('statistic.edit'); $this->canState = $this->canDo->get('statistic.edit.state'); $this->canCreate = $this->canDo->get('statistic.create'); $this->canDelete = $this->canDo->get('statistic.delete'); - $this->canBatch = $this->canDo->get('core.batch'); + $this->canBatch = ($this->canDo->get('statistic.batch') && $this->canDo->get('core.batch')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -78,7 +91,7 @@ class SermondistributorViewStatistics extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -97,32 +110,32 @@ class SermondistributorViewStatistics extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_STATISTICS'), 'bars'); JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=statistics'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_SERMONDISTRIBUTOR_STATISTICS'), 'bars'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('statistic.add'); + ToolbarHelper::addNew('statistic.add'); } // Only load if there are items - if (SermondistributorHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('statistic.edit'); + ToolbarHelper::editList('statistic.edit'); } if ($this->canState) { - JToolBarHelper::publishList('statistics.publish'); - JToolBarHelper::unpublishList('statistics.unpublish'); - JToolBarHelper::archiveList('statistics.archive'); + ToolbarHelper::publishList('statistics.publish'); + ToolbarHelper::unpublishList('statistics.unpublish'); + ToolbarHelper::archiveList('statistics.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('statistics.checkin'); + ToolbarHelper::checkin('statistics.checkin'); } } @@ -130,11 +143,11 @@ class SermondistributorViewStatistics extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -142,44 +155,44 @@ class SermondistributorViewStatistics extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'statistics.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'statistics.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('statistics.trash'); + ToolbarHelper::trash('statistics.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('statistic.export')) { - JToolBarHelper::custom('statistics.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); + ToolbarHelper::custom('statistics.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('statistic.import')) { - JToolBarHelper::custom('statistics.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); + ToolbarHelper::custom('statistics.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false); } // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('statistics'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_sermondistributor'); + ToolbarHelper::preferences('com_sermondistributor'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -187,9 +200,9 @@ class SermondistributorViewStatistics extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -197,19 +210,19 @@ class SermondistributorViewStatistics extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Sermon Name Selection - $this->sermonNameOptions = JFormHelper::loadFieldType('Sermon')->options; + $this->sermonNameOptions = FormHelper::loadFieldType('Sermon')->options; // We do some sanitation for Sermon Name filter - if (SermondistributorHelper::checkArray($this->sermonNameOptions) && + if (ArrayHelper::check($this->sermonNameOptions) && isset($this->sermonNameOptions[0]->value) && - !SermondistributorHelper::checkString($this->sermonNameOptions[0]->value)) + !StringHelper::check($this->sermonNameOptions[0]->value)) { unset($this->sermonNameOptions[0]); } // Sermon Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL').' -', 'batch[sermon]', - JHtml::_('select.options', $this->sermonNameOptions, 'value', 'text') + Html::_('select.options', $this->sermonNameOptions, 'value', 'text') ); } @@ -217,19 +230,19 @@ class SermondistributorViewStatistics extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Preacher Name Selection - $this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options; + $this->preacherNameOptions = FormHelper::loadFieldType('Preachers')->options; // We do some sanitation for Preacher Name filter - if (SermondistributorHelper::checkArray($this->preacherNameOptions) && + if (ArrayHelper::check($this->preacherNameOptions) && isset($this->preacherNameOptions[0]->value) && - !SermondistributorHelper::checkString($this->preacherNameOptions[0]->value)) + !StringHelper::check($this->preacherNameOptions[0]->value)) { unset($this->preacherNameOptions[0]); } // Preacher Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL').' -', 'batch[preacher]', - JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text') + Html::_('select.options', $this->preacherNameOptions, 'value', 'text') ); } @@ -237,19 +250,19 @@ class SermondistributorViewStatistics extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Series Name Selection - $this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options; + $this->seriesNameOptions = FormHelper::loadFieldType('Series')->options; // We do some sanitation for Series Name filter - if (SermondistributorHelper::checkArray($this->seriesNameOptions) && + if (ArrayHelper::check($this->seriesNameOptions) && isset($this->seriesNameOptions[0]->value) && - !SermondistributorHelper::checkString($this->seriesNameOptions[0]->value)) + !StringHelper::check($this->seriesNameOptions[0]->value)) { unset($this->seriesNameOptions[0]); } // Series Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL').' -', + '- Keep Original '.Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL').' -', 'batch[series]', - JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text') + Html::_('select.options', $this->seriesNameOptions, 'value', 'text') ); } } @@ -263,10 +276,10 @@ class SermondistributorViewStatistics extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_STATISTICS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/statistics.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_SERMONDISTRIBUTOR_STATISTICS')); + Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/statistics.css", ['version' => 'auto']); } /** @@ -281,28 +294,38 @@ class SermondistributorViewStatistics extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return SermondistributorHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.filename' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL'), - 'g.name' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL'), - 'h.name' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL'), - 'i.name' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL'), - 'a.counter' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_COUNTER_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.filename' => Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL'), + 'g.name' => Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL'), + 'h.name' => Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL'), + 'i.name' => Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL'), + 'a.counter' => Text::_('COM_SERMONDISTRIBUTOR_STATISTIC_COUNTER_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; + } } diff --git a/libraries/jcb_powers/.htaccess b/libraries/jcb_powers/.htaccess new file mode 100644 index 00000000..9afb1a1b --- /dev/null +++ b/libraries/jcb_powers/.htaccess @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/index.html b/libraries/jcb_powers/VDM.Joomla.FOF/index.html similarity index 100% rename from index.html rename to libraries/jcb_powers/VDM.Joomla.FOF/index.html diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES.php new file mode 100644 index 00000000..00618f8a --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES.php @@ -0,0 +1,300 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt; + + +use VDM\Joomla\FOF\Encrypt\AES\AesInterface; +use VDM\Joomla\FOF\Encrypt\AES\Mcrypt; +use VDM\Joomla\FOF\Encrypt\AES\Openssl; +use VDM\Joomla\FOF\Utils\Phpfunc; + + +/** + * AES encryption class + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +class AES +{ + /** + * The cipher key. + * + * @var string + */ + protected $key = ''; + + /** + * The AES encryption adapter in use. + * + * @var AesInterface + */ + protected $adapter; + + /** + * Initialise the AES encryption object. + * + * Note: If the key is not 16 bytes this class will do a stupid key expansion for legacy reasons (produce the + * SHA-256 of the key string and throw away half of it). + * + * @param string $key The encryption key (password). It can be a raw key (16 bytes) or a passphrase. + * @param int $strength Bit strength (128, 192 or 256) – ALWAYS USE 128 BITS. THIS PARAMETER IS DEPRECATED. + * @param string $mode Encryption mode. Can be ebc or cbc. We recommend using cbc. + * @param Phpfunc $phpfunc For testing + * @param string $priority Priority which adapter we should try first + */ + public function __construct($key, $strength = 128, $mode = 'cbc', Phpfunc $phpfunc = null, $priority = 'openssl') + { + if ($priority == 'openssl') + { + $this->adapter = new Openssl(); + + if (!$this->adapter->isSupported($phpfunc)) + { + $this->adapter = new Mcrypt(); + } + } + else + { + $this->adapter = new Mcrypt(); + + if (!$this->adapter->isSupported($phpfunc)) + { + $this->adapter = new Openssl(); + } + } + + $this->adapter->setEncryptionMode($mode, $strength); + $this->setPassword($key, true); + } + + /** + * Sets the password for this instance. + * + * WARNING: Do not use the legacy mode, it's insecure + * + * @param string $password The password (either user-provided password or binary encryption key) to use + * @param bool $legacyMode True to use the legacy key expansion. We recommend against using it. + */ + public function setPassword($password, $legacyMode = false) + { + $this->key = $password; + + $passLength = strlen($password); + + if (function_exists('mb_strlen')) + { + $passLength = mb_strlen($password, 'ASCII'); + } + + // Legacy mode was doing something stupid, requiring a key of 32 bytes. DO NOT USE LEGACY MODE! + if ($legacyMode && ($passLength != 32)) + { + // Legacy mode: use the sha256 of the password + $this->key = hash('sha256', $password, true); + // We have to trim or zero pad the password (we end up throwing half of it away in Rijndael-128 / AES...) + $this->key = $this->adapter->resizeKey($this->key, $this->adapter->getBlockSize()); + } + } + + /** + * Encrypts a string using AES + * + * @param string $stringToEncrypt The plaintext to encrypt + * @param bool $base64encoded Should I Base64-encode the result? + * + * @return string The cryptotext. Please note that the first 16 bytes of + * the raw string is the IV (initialisation vector) which + * is necessary for decoding the string. + */ + public function encryptString($stringToEncrypt, $base64encoded = true) + { + $blockSize = $this->adapter->getBlockSize(); + $randVal = new Randval(); + $iv = $randVal->generate($blockSize); + + $key = $this->getExpandedKey($blockSize, $iv); + $cipherText = $this->adapter->encrypt($stringToEncrypt, $key, $iv); + + // Optionally pass the result through Base64 encoding + if ($base64encoded) + { + $cipherText = base64_encode((string) $cipherText); + } + + // Return the result + return $cipherText; + } + + /** + * Decrypts a ciphertext into a plaintext string using AES + * + * @param string $stringToDecrypt The ciphertext to decrypt. The first 16 bytes of the raw string must contain + * the IV (initialisation vector). + * @param bool $base64encoded Should I Base64-decode the data before decryption? + * + * @return string The plain text string + */ + public function decryptString($stringToDecrypt, $base64encoded = true) + { + if ($base64encoded) + { + $stringToDecrypt = base64_decode($stringToDecrypt); + } + + // Extract IV + $iv_size = $this->adapter->getBlockSize(); + $iv = substr($stringToDecrypt, 0, $iv_size); + $key = $this->getExpandedKey($iv_size, $iv); + + // Decrypt the data + $plainText = $this->adapter->decrypt($stringToDecrypt, $key); + + return $plainText; + } + + /** + * Is AES encryption supported by this PHP installation? + * + * @param Phpfunc $phpfunc + * + * @return boolean + */ + public static function isSupported(Phpfunc $phpfunc = null) + { + if (!is_object($phpfunc) || !($phpfunc instanceof $phpfunc)) + { + $phpfunc = new Phpfunc(); + } + + $adapter = new Openssl(); + + if (!$adapter->isSupported($phpfunc)) + { + $adapter = new Mcrypt(); + + if (!$adapter->isSupported($phpfunc)) + { + return false; + } + } + + if (!$phpfunc->function_exists('base64_encode')) + { + return false; + } + + if (!$phpfunc->function_exists('base64_decode')) + { + return false; + } + + if (!$phpfunc->function_exists('hash_algos')) + { + return false; + } + + $algorightms = $phpfunc->hash_algos(); + + if (!in_array('sha256', $algorightms)) + { + return false; + } + + return true; + } + + /** + * @param $blockSize + * @param $iv + * + * @return string + */ + public function getExpandedKey($blockSize, $iv) + { + $key = $this->key; + $passLength = strlen($key); + + if (function_exists('mb_strlen')) + { + $passLength = mb_strlen($key, 'ASCII'); + } + + if ($passLength != $blockSize) + { + $iterations = 1000; + $salt = $this->adapter->resizeKey($iv, 16); + $key = hash_pbkdf2('sha256', $this->key, $salt, $iterations, $blockSize, true); + } + + return $key; + } +} + +if (!function_exists('hash_pbkdf2')) +{ + function hash_pbkdf2($algo, $password, $salt, $count, $length = 0, $raw_output = false) + { + if (!in_array(strtolower((string) $algo), hash_algos())) + { + trigger_error(__FUNCTION__ . '(): Unknown hashing algorithm: ' . $algo, E_USER_WARNING); + } + + if (!is_numeric($count)) + { + trigger_error(__FUNCTION__ . '(): expects parameter 4 to be long, ' . gettype($count) . ' given', E_USER_WARNING); + } + + if (!is_numeric($length)) + { + trigger_error(__FUNCTION__ . '(): expects parameter 5 to be long, ' . gettype($length) . ' given', E_USER_WARNING); + } + + if ($count <= 0) + { + trigger_error(__FUNCTION__ . '(): Iterations must be a positive integer: ' . $count, E_USER_WARNING); + } + + if ($length < 0) + { + trigger_error(__FUNCTION__ . '(): Length must be greater than or equal to 0: ' . $length, E_USER_WARNING); + } + + $output = ''; + $block_count = $length ? ceil($length / strlen(hash((string) $algo, '', $raw_output))) : 1; + + for ($i = 1; $i <= $block_count; $i++) + { + $last = $xorsum = hash_hmac((string) $algo, $salt . pack('N', $i), (string) $password, true); + + for ($j = 1; $j < $count; $j++) + { + $xorsum ^= ($last = hash_hmac((string) $algo, $last, (string) $password, true)); + } + + $output .= $xorsum; + } + + if (!$raw_output) + { + $output = bin2hex($output); + } + + return $length ? substr($output, 0, $length) : $output; + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Abstraction.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Abstraction.php new file mode 100644 index 00000000..4d665118 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Abstraction.php @@ -0,0 +1,100 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt\AES; + + +/** + * Abstract AES encryption class + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +abstract class Abstraction +{ + /** + * Trims or zero-pads a key / IV + * + * @param string $key The key or IV to treat + * @param int $size The block size of the currently used algorithm + * + * @return null|string Null if $key is null, treated string of $size byte length otherwise + */ + public function resizeKey($key, $size) + { + if (empty($key)) + { + return null; + } + + $keyLength = strlen($key); + + if (function_exists('mb_strlen')) + { + $keyLength = mb_strlen($key, 'ASCII'); + } + + if ($keyLength == $size) + { + return $key; + } + + if ($keyLength > $size) + { + if (function_exists('mb_substr')) + { + return mb_substr($key, 0, $size, 'ASCII'); + } + + return substr($key, 0, $size); + } + + return $key . str_repeat("\0", ($size - $keyLength)); + } + + /** + * Returns null bytes to append to the string so that it's zero padded to the specified block size + * + * @param string $string The binary string which will be zero padded + * @param int $blockSize The block size + * + * @return string The zero bytes to append to the string to zero pad it to $blockSize + */ + protected function getZeroPadding($string, $blockSize) + { + $stringSize = strlen($string); + + if (function_exists('mb_strlen')) + { + $stringSize = mb_strlen($string, 'ASCII'); + } + + if ($stringSize == $blockSize) + { + return ''; + } + + if ($stringSize < $blockSize) + { + return str_repeat("\0", $blockSize - $stringSize); + } + + $paddingBytes = $stringSize % $blockSize; + + return str_repeat("\0", $blockSize - $paddingBytes); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/AesInterface.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/AesInterface.php new file mode 100644 index 00000000..a4c193cf --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/AesInterface.php @@ -0,0 +1,98 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt\AES; + + +use VDM\Joomla\FOF\Utils\Phpfunc; + + +/** + * Interface for AES encryption adapters + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +interface AesInterface +{ + /** + * Sets the AES encryption mode. + * + * WARNING: The strength is deprecated as it has a different effect in MCrypt and OpenSSL. MCrypt was abandoned in + * 2003 before the Rijndael-128 algorithm was officially the Advanced Encryption Standard (AES). MCrypt also offered + * Rijndael-192 and Rijndael-256 algorithms with different block sizes. These are NOT used in AES. OpenSSL, however, + * implements AES correctly. It always uses a 128-bit (16 byte) block. The 192 and 256 bit strengths refer to the + * key size, not the block size. Therefore using different strengths in MCrypt and OpenSSL will result in different + * and incompatible ciphertexts. + * + * TL;DR: Always use $strength = 128! + * + * @param string $mode Choose between CBC (recommended) or ECB + * @param int $strength Bit strength of the key (128, 192 or 256 bits). DEPRECATED. READ NOTES ABOVE. + * + * @return mixed + */ + public function setEncryptionMode($mode = 'cbc', $strength = 128); + + /** + * Encrypts a string. Returns the raw binary ciphertext. + * + * WARNING: The plaintext is zero-padded to the algorithm's block size. You are advised to store the size of the + * plaintext and trim the string to that length upon decryption. + * + * @param string $plainText The plaintext to encrypt + * @param string $key The raw binary key (will be zero-padded or chopped if its size is different than the block size) + * @param null|string $iv The initialization vector (for CBC mode algorithms) + * + * @return string The raw encrypted binary string. + */ + public function encrypt($plainText, $key, $iv = null); + + /** + * Decrypts a string. Returns the raw binary plaintext. + * + * $ciphertext MUST start with the IV followed by the ciphertext, even for EBC data (the first block of data is + * dropped in EBC mode since there is no concept of IV in EBC). + * + * WARNING: The returned plaintext is zero-padded to the algorithm's block size during encryption. You are advised + * to trim the string to the original plaintext's length upon decryption. While rtrim($decrypted, "\0") sounds + * appealing it's NOT the correct approach for binary data (zero bytes may actually be part of your plaintext, not + * just padding!). + * + * @param string $cipherText The ciphertext to encrypt + * @param string $key The raw binary key (will be zero-padded or chopped if its size is different than the block size) + * + * @return string The raw unencrypted binary string. + */ + public function decrypt($cipherText, $key); + + /** + * Returns the encryption block size in bytes + * + * @return int + */ + public function getBlockSize(); + + /** + * Is this adapter supported? + * + * @param Phpfunc $phpfunc + * + * @return bool + */ + public function isSupported(Phpfunc $phpfunc = null); +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Mcrypt.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Mcrypt.php new file mode 100644 index 00000000..94900d16 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Mcrypt.php @@ -0,0 +1,178 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt\AES; + + +use VDM\Joomla\FOF\Encrypt\Randval; +use VDM\Joomla\FOF\Utils\Phpfunc; +use VDM\Joomla\FOF\Encrypt\AES\AesInterface; +use VDM\Joomla\FOF\Encrypt\AES\Abstraction; + + +/** + * Mcrypt AES encryption class + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +class Mcrypt extends Abstraction implements AesInterface +{ + protected $cipherType = MCRYPT_RIJNDAEL_128; + + protected $cipherMode = MCRYPT_MODE_CBC; + + public function setEncryptionMode($mode = 'cbc', $strength = 128) + { + switch ((int) $strength) + { + default: + case '128': + $this->cipherType = MCRYPT_RIJNDAEL_128; + break; + + case '192': + $this->cipherType = MCRYPT_RIJNDAEL_192; + break; + + case '256': + $this->cipherType = MCRYPT_RIJNDAEL_256; + break; + } + + switch (strtolower($mode)) + { + case 'ecb': + $this->cipherMode = MCRYPT_MODE_ECB; + break; + + default: + case 'cbc': + $this->cipherMode = MCRYPT_MODE_CBC; + break; + } + + } + + public function encrypt($plainText, $key, $iv = null) + { + $iv_size = $this->getBlockSize(); + $key = $this->resizeKey($key, $iv_size); + $iv = $this->resizeKey($iv, $iv_size); + + if (empty($iv)) + { + $randVal = new Randval(); + $iv = $randVal->generate($iv_size); + } + + $cipherText = mcrypt_encrypt($this->cipherType, $key, $plainText, $this->cipherMode, $iv); + $cipherText = $iv . $cipherText; + + return $cipherText; + } + + public function decrypt($cipherText, $key) + { + $iv_size = $this->getBlockSize(); + $key = $this->resizeKey($key, $iv_size); + $iv = substr($cipherText, 0, $iv_size); + $cipherText = substr($cipherText, $iv_size); + $plainText = mcrypt_decrypt($this->cipherType, $key, $cipherText, $this->cipherMode, $iv); + + return $plainText; + } + + public function isSupported(Phpfunc $phpfunc = null) + { + if (!is_object($phpfunc) || !($phpfunc instanceof $phpfunc)) + { + $phpfunc = new Phpfunc(); + } + + if (!$phpfunc->function_exists('mcrypt_get_key_size')) + { + return false; + } + + if (!$phpfunc->function_exists('mcrypt_get_iv_size')) + { + return false; + } + + if (!$phpfunc->function_exists('mcrypt_create_iv')) + { + return false; + } + + if (!$phpfunc->function_exists('mcrypt_encrypt')) + { + return false; + } + + if (!$phpfunc->function_exists('mcrypt_decrypt')) + { + return false; + } + + if (!$phpfunc->function_exists('mcrypt_list_algorithms')) + { + return false; + } + + if (!$phpfunc->function_exists('hash')) + { + return false; + } + + if (!$phpfunc->function_exists('hash_algos')) + { + return false; + } + + $algorightms = $phpfunc->mcrypt_list_algorithms(); + + if (!in_array('rijndael-128', $algorightms)) + { + return false; + } + + if (!in_array('rijndael-192', $algorightms)) + { + return false; + } + + if (!in_array('rijndael-256', $algorightms)) + { + return false; + } + + $algorightms = $phpfunc->hash_algos(); + + if (!in_array('sha256', $algorightms)) + { + return false; + } + + return true; + } + + public function getBlockSize() + { + return mcrypt_get_iv_size($this->cipherType, $this->cipherMode); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Openssl.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Openssl.php new file mode 100644 index 00000000..4d13d5eb --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/Openssl.php @@ -0,0 +1,193 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt\AES; + + +use VDM\Joomla\FOF\Encrypt\Randval; +use VDM\Joomla\FOF\Utils\Phpfunc; +use VDM\Joomla\FOF\Encrypt\AES\AesInterface; +use VDM\Joomla\FOF\Encrypt\AES\Abstraction; + + +/** + * Openssl AES encryption class + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +class Openssl extends Abstraction implements AesInterface +{ + /** + * The OpenSSL options for encryption / decryption + * + * @var int + */ + protected $openSSLOptions = 0; + + /** + * The encryption method to use + * + * @var string + */ + protected $method = 'aes-128-cbc'; + + public function __construct() + { + $this->openSSLOptions = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING; + } + + public function setEncryptionMode($mode = 'cbc', $strength = 128) + { + static $availableAlgorithms = null; + static $defaultAlgo = 'aes-128-cbc'; + + if (!is_array($availableAlgorithms)) + { + $availableAlgorithms = openssl_get_cipher_methods(); + + foreach (array('aes-256-cbc', 'aes-256-ecb', 'aes-192-cbc', + 'aes-192-ecb', 'aes-128-cbc', 'aes-128-ecb') as $algo) + { + if (in_array($algo, $availableAlgorithms)) + { + $defaultAlgo = $algo; + break; + } + } + } + + $strength = (int) $strength; + $mode = strtolower($mode); + + if (!in_array($strength, array(128, 192, 256))) + { + $strength = 256; + } + + if (!in_array($mode, array('cbc', 'ebc'))) + { + $mode = 'cbc'; + } + + $algo = 'aes-' . $strength . '-' . $mode; + + if (!in_array($algo, $availableAlgorithms)) + { + $algo = $defaultAlgo; + } + + $this->method = $algo; + } + + public function encrypt($plainText, $key, $iv = null) + { + $iv_size = $this->getBlockSize(); + $key = $this->resizeKey($key, $iv_size); + $iv = $this->resizeKey($iv, $iv_size); + + if (empty($iv)) + { + $randVal = new Randval(); + $iv = $randVal->generate($iv_size); + } + + $plainText .= $this->getZeroPadding($plainText, $iv_size); + $cipherText = openssl_encrypt($plainText, $this->method, $key, $this->openSSLOptions, $iv); + $cipherText = $iv . $cipherText; + + return $cipherText; + } + + public function decrypt($cipherText, $key) + { + $iv_size = $this->getBlockSize(); + $key = $this->resizeKey($key, $iv_size); + $iv = substr($cipherText, 0, $iv_size); + $cipherText = substr($cipherText, $iv_size); + $plainText = openssl_decrypt($cipherText, $this->method, $key, $this->openSSLOptions, $iv); + + return $plainText; + } + + public function isSupported(Phpfunc $phpfunc = null) + { + if (!is_object($phpfunc) || !($phpfunc instanceof $phpfunc)) + { + $phpfunc = new Phpfunc(); + } + + if (!$phpfunc->function_exists('openssl_get_cipher_methods')) + { + return false; + } + + if (!$phpfunc->function_exists('openssl_random_pseudo_bytes')) + { + return false; + } + + if (!$phpfunc->function_exists('openssl_cipher_iv_length')) + { + return false; + } + + if (!$phpfunc->function_exists('openssl_encrypt')) + { + return false; + } + + if (!$phpfunc->function_exists('openssl_decrypt')) + { + return false; + } + + if (!$phpfunc->function_exists('hash')) + { + return false; + } + + if (!$phpfunc->function_exists('hash_algos')) + { + return false; + } + + $algorightms = $phpfunc->openssl_get_cipher_methods(); + + if (!in_array('aes-128-cbc', $algorightms)) + { + return false; + } + + $algorightms = $phpfunc->hash_algos(); + + if (!in_array('sha256', $algorightms)) + { + return false; + } + + return true; + } + + /** + * @return int + */ + public function getBlockSize() + { + return openssl_cipher_iv_length($this->method); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/index.html b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/AES/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randval.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randval.php new file mode 100644 index 00000000..8d57ccc9 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randval.php @@ -0,0 +1,69 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt; + + +use VDM\Joomla\FOF\Encrypt\Randvalinterface; + + +/** + * Generates cryptographically-secure random values. + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +class Randval implements Randvalinterface +{ + /** + * Returns a cryptographically secure random value. + * + * Since we only run on PHP 7+ we can use random_bytes(), which internally uses a crypto safe PRNG. If the function + * doesn't exist, Joomla already loads a secure polyfill. + * + * The reason this method exists is backwards compatibility with older versions of FOF. It also allows us to quickly + * address any future issues if Joomla drops the polyfill or otherwise find problems with PHP's random_bytes() on + * some weird host (you can't be too careful when releasing mass-distributed software). + * + * @param integer $bytes How many bytes to return + * + * @return string + */ + public function generate($bytes = 32) + { + return random_bytes($bytes); + } + + /** + * Generate random bytes. Adapted from Joomla! 3.2. + * + * Since we only run on PHP 7+ we can use random_bytes(), which internally uses a crypto safe PRNG. If the function + * doesn't exist, Joomla already loads a secure polyfill. + * + * The reason this method exists is backwards compatibility with older versions of FOF. It also allows us to quickly + * address any future issues if Joomla drops the polyfill or otherwise find problems with PHP's random_bytes() on + * some weird host (you can't be too careful when releasing mass-distributed software). + * + * @param integer $length Length of the random data to generate + * + * @return string Random binary data + */ + public function genRandomBytes($length = 32) + { + return random_bytes($length); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randvalinterface.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randvalinterface.php new file mode 100644 index 00000000..c6642cd3 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/Randvalinterface.php @@ -0,0 +1,37 @@ + + */ +namespace VDM\Joomla\FOF\Encrypt; + + +/** + * Randvalinterface + * + * @package FrameworkOnFramework + * @since 1.0 + * @deprecated Use phpseclib/phpseclib version 3 Instead. + */ +interface Randvalinterface +{ + /** + * + * Returns a cryptographically secure random value. + * + * @return string + * + */ + public function generate(); +} + diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/index.html b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Encrypt/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla.FOF/src/Utils/Phpfunc.php b/libraries/jcb_powers/VDM.Joomla.FOF/src/Utils/Phpfunc.php new file mode 100644 index 00000000..657e695e --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla.FOF/src/Utils/Phpfunc.php @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/index.html b/libraries/jcb_powers/VDM.Joomla/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php new file mode 100644 index 00000000..70cc939c --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php @@ -0,0 +1,107 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Some array tricks helper + * + * @since 3.0.9 + */ +abstract class ArrayHelper +{ + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns int|false number of items in array on success + * + * @since 3.2.0 + */ + public static function check($array, $removeEmptyString = false) + { + if (is_array($array) && ($nr = count((array) $array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + $array = array_filter($array); + + if ($array === []) + { + return false; + } + + return count($array); + } + + return $nr; + } + + return false; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array|null merged array on success + * + * @since 3.0.9 + */ + public static function merge($arrays): ?array + { + if(self::check($arrays)) + { + $merged = []; + foreach ($arrays as $array) + { + if (self::check($array)) + { + $merged = array_merge($merged, $array); + } + } + return $merged; + } + return null; + } + + /** + * Check if arrays intersect + * + * @input array The first array + * @input array The second array + * + * @returns bool true if intersect else false + * + * @since 3.1.1 + */ + public static function intersect($a_array, $b_array): bool + { + // flip the second array + $b_array = array_flip($b_array); + + // loop the first array + foreach ($a_array as $v) + { + if (isset($b_array[$v])) + { + return true; + } + } + return false; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php new file mode 100644 index 00000000..b2ae8246 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php @@ -0,0 +1,296 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities\Component; + + +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\Input\Input; +use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\String\NamespaceHelper; + + +/** + * Some component helper + * + * @since 3.0.11 + */ +abstract class Helper +{ + /** + * The current option + * + * @var string|null + * @since 3.0.11 + */ + public static ?string $option = null; + + /** + * The component manifest list cache + * + * @var array + * @since 3.2.0 + */ + public static array $manifest = []; + + /** + * The component params list cache + * + * @var Registry[] + * @since 3.0.11 + */ + protected static array $params = []; + + /** + * Gets the parameter object for the component + * + * @param string|null $option The option for the component. + * + * @return Registry A Registry object. + * @see Registry + * @since 3.0.11 + */ + public static function getParams(?string $option = null): Registry + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + + // get global value + if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry) + { + self::$params[$option] = ComponentHelper::getParams($option); + } + + return self::$params[$option]; + } + + /** + * Set the component option + * + * @param string $option The option + * + * @return void + * @since 3.2.0 + */ + public static function setOption(string $option): void + { + self::$option = $option; + } + + /** + * Get the component option + * + * @param string|null $default The default return value if none is found + * + * @return string|null A component option + * @since 3.0.11 + */ + public static function getOption(string $default = 'empty'): ?string + { + if (empty(self::$option)) + { + // get the option from the url input + self::$option = (new Input)->getString('option', null); + } + + if (empty(self::$option)) + { + $app = Factory::getApplication(); + + // Check if the getInput method exists in the application object + if (method_exists($app, 'getInput')) + { + // get the option from the application + self::$option = $app->getInput()->getCmd('option', $default); + } + else + { + // Use the default value if getInput method does not exist + self::$option = $default; + } + } + + return self::$option; + } + + /** + * Gets the component code name + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return string|null A component code name + * @since 3.0.11 + */ + public static function getCode(?string $option = null, ?string $default = null): ?string + { + // check that we have an option + if (empty($option)) + { + $option = self::getOption(); + } + // option with com_ + if (is_string($option) && strpos($option, 'com_') === 0) + { + return strtolower(trim(substr($option, 4))); + } + + return $default; + } + + /** + * Gets the component abstract helper class + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return string|null A component helper name + * + * @since 3.0.11 + */ + public static function get(string $option = null, string $default = null): ?string + { + // check that we have an option + // and get the code name from it + if (($code_name = self::getCode($option, null)) !== null) + { + // we build the helper class name + $helper_name = '\\' . \ucfirst($code_name) . 'Helper'; + + // check if class exist + if (class_exists($helper_name)) + { + return $helper_name; + } + + // try loading namespace + if (($namespace = self::getNamespace($option)) !== null) + { + $name = \ucfirst($code_name) . 'Helper'; + $namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin... + if (class_exists($namespace_helper)) + { + return $namespace_helper; + } + } + } + + return $default; + } + + /** + * Gets the component namespace if set + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return string|null A component namespace + * + * @since 3.0.11 + */ + public static function getNamespace(?string $option = null): ?string + { + $manifest = self::getManifest($option); + + return $manifest->namespace ?? null; + } + + /** + * Gets the component abstract helper class + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return object|null A component helper name + * + * @since 3.0.11 + */ + public static function getManifest(?string $option = null): ?object + { + if ($option === null + && ($option = self::getOption($option)) === null) + { + return null; + } + + // get global manifest_cache values + if (!isset(self::$manifest[$option])) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($db->quoteName('manifest_cache')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('component')) + ->where($db->quoteName('element') . ' LIKE ' . $db->quote($option)); + + $db->setQuery($query); + + try { + $manifest = $db->loadResult(); + self::$manifest[$option] = json_decode($manifest); + } catch (\Exception $e) { + // Handle the database error appropriately. + self::$manifest[$option] = null; + } + } + + return self::$manifest[$option]; + } + + /** + * Check if the helper class of this component has a method + * + * @param string $method The method name to search for + * @param string|null $option The option for the component. + * + * @return bool true if method exist + * + * @since 3.0.11 + */ + public static function methodExists(string $method, string $option = null): bool + { + // get the helper class + return ($helper = self::get($option, null)) !== null && + method_exists($helper, $method); + } + + /** + * Check if the helper class of this component has a method, and call it with the arguments + * + * @param string $method The method name to search for + * @param array $arguments The arguments for function. + * @param string|null $option The option for the component. + * + * @return mixed return whatever the method returns or null + * @since 3.2.0 + */ + public static function _(string $method, array $arguments = [], ?string $option = null) + { + // get the helper class + if (($helper = self::get($option, null)) !== null && + method_exists($helper, $method)) + { + // we know this is not ideal... + // so we need to move these + // functions to their own classes + return call_user_func_array([$helper, $method], $arguments); + } + + return null; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php new file mode 100644 index 00000000..7d1dd0a5 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php @@ -0,0 +1,363 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\Archive\Archive; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * File helper + * + * @since 3.0.9 + */ +abstract class FileHelper +{ + /** + * Trigger error notice only once + * + * @var bool + * + * @since 3.0.9 + */ + protected static $curlError = false; + + /** + * The zipper method + * + * @param string $workingDirectory The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + * @since 3.0.9 + */ + public static function zip($workingDirectory, &$filepath): bool + { + // store the current joomla working directory + $joomla = getcwd(); + + // we are changing the working directory to the component temp folder + chdir($workingDirectory); + + // the full file path of the zip file + $filepath = Path::clean($filepath); + + // delete an existing zip file (or use an exclusion parameter in Folder::files() + File::delete($filepath); + + // get a list of files in the current directory tree (also the hidden files) + $files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~')); + + $zipArray = []; + // setup the zip array + foreach ($files as $file) + { + $tmp = []; + $tmp['name'] = str_replace('./', '', (string) $file); + $tmp['data'] = self::getContent($file); + $tmp['time'] = filemtime($file); + $zipArray[] = $tmp; + } + + // change back to joomla working directory + chdir($joomla); + + // get the zip adapter + $zip = (new Archive())->getAdapter('zip'); + + //create the zip file + return (bool) $zip->create($filepath, $zipArray); + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param mixed $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + */ + public static function getContent($path, $none = '') + { + if (StringHelper::check($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = []; + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + + // return if found + if (StringHelper::check($content)) + { + return $content; + } + } + elseif (!self::$curlError) + { + // set the notice + Factory::getApplication()->enqueueMessage('

Curl Not Found!

Please setup curl on your system, or the Joomla Component will not function correctly!

', 'Error'); + // load this notice only once + self::$curlError = true; + } + } + return $none; + } + + /** + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + * @since 3.0.9 + */ + public static function write($path, $data): bool + { + $klaar = false; + if (StringHelper::check($data)) + { + // open the file + $fh = fopen($path, "w"); + if (!is_resource($fh)) + { + return $klaar; + } + // write to the file + if (fwrite($fh, $data)) + { + // has been done + $klaar = true; + } + // close file. + fclose($fh); + } + return $klaar; + } + + /** + * get all the file paths in folder and sub folders + * + * @param string $folder The local path to parse + * @param array $fileTypes The type of files to get + * + * @return array|null + * + * @since 3.0.9 + */ + public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array + { + if (Folder::exists($folder)) + { + // we must first store the current woking directory + $joomla = getcwd(); + // we are changing the working directory to the component path + chdir($folder); + + // make sure we have file type filter + if (ArrayHelper::check($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $type, $recurse, $full); + } + } + elseif (StringHelper::check($fileTypes)) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', '.', $recurse, $full); + } + + // change back to Joomla working directory + chdir($joomla); + + // return array of files + return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files)); + } + return null; + } + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + * @since 3.0.9 + */ + public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true): string + { + // make sure to always have a string/path + if(!StringHelper::check($default)) + { + $default = JPATH_SITE . '/images/'; + } + + // get the global settings + $filePath = Helper::getParams()->get($target, $default); + + // check the file path (revert to default only of not a hidden file path) + if ('hiddenfilepath' !== $target && strpos((string) $filePath, (string) JPATH_SITE) === false) + { + $filePath = $default; + } + + // create the folder if it does not exist + if ($createIfNotSet && !Folder::exists($filePath)) + { + Folder::create($filePath); + } + + // setup the file name + $fileName = ''; + + // Get basic key + $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; + // get the component helper + $helper = Helper::get(); + // check if method exist in helper class + if ($helper && Helper::methodExists('getCryptKey')) + { + $basickey = $helper::getCryptKey('basic', $basickey); + } + + // check the key + if (!StringHelper::check($key)) + { + $key = 'vDm'; + } + + // set the file name + if (StringHelper::check($fileType)) + { + // set the name + $fileName = trim( md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.')); + } + else + { + $fileName = trim( md5($type . $target . $basickey . $key)) . '.txt'; + } + + // return the url + if ('url' === $type) + { + if (\strpos((string) $filePath, (string) JPATH_SITE) !== false) + { + $filePath = trim( str_replace( JPATH_SITE, '', (string) $filePath), '/'); + + return Uri::root() . $filePath . '/' . $fileName; + } + + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return Uri::root(); + } + + // sanitize the path + return '/' . trim((string) $filePath, '/' ) . '/' . $fileName; + } + + /** + * Check if file exist + * + * @param string $path The url/path to check + * + * @return bool If exist true + * + * @since 3.0.9 + */ + public static function exists($path): bool + { + $exists = false; + // if this is a local path + if (strpos($path, 'http:') === false && strpos($path, 'https:') === false) + { + if (file_exists($path)) + { + $exists = true; + } + } + // check if we can use curl + elseif (function_exists('curl_version')) + { + // initiate curl + $ch = curl_init($path); + // CURLOPT_NOBODY (do not return body) + curl_setopt($ch, CURLOPT_NOBODY, true); + // make call + $result = curl_exec($ch); + // check return value + if ($result !== false) + { + // get the http CODE + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if ($statusCode !== 404) + { + $exists = true; + } + } + // close the connection + curl_close($ch); + } + elseif ($headers = @get_headers($path)) + { + if(isset($headers[0]) && is_string($headers[0]) && strpos($headers[0],'404') === false) + { + $exists = true; + } + } + return $exists; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php new file mode 100644 index 00000000..a2f48fd4 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php @@ -0,0 +1,187 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Form\FormHelper as JoomlaFormHelper; +use Joomla\CMS\Form\FormField; + + +/** + * Form Helper + * + * @since 3.2.0 + */ +abstract class FormHelper +{ + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return \SimpleXMLElement|null + * @since 3.2.0 + */ + public static function xml(array $attributes, ?array $options = null): ?\SimpleXMLElement + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes)) + { + // start field xml + $XML = new \SimpleXMLElement(''); + + // load the attributes + self::attributes($XML, $attributes); + + // check if we have options + if (ArrayHelper::check($options)) + { + // load the options + self::options($XML, $options); + } + + // return the field xml + return $XML; + } + + return null; + } + + /** + * xmlAppend + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, + * or a stdClass object containing a comment attribute to be injected + * before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return void + * @since 3.2.0 + */ + public static function append(\SimpleXMLElement &$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::comment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::append($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = \dom_import_simplexml($xml); + $domNode = \dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = \simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return void + * @since 3.2.0 + */ + public static function comment(\SimpleXMLElement &$xml, string $comment) + { + $domXML = \dom_import_simplexml($xml); + $domComment = new \DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = \simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function attributes(\SimpleXMLElement &$xml, array $attributes = []) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * xmlAddOptions + * + * @param \SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * @since 3.2.0 + */ + public static function options(\SimpleXMLElement &$xml, array $options = []) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return FormField|null + * @since 3.2.0 + */ + public static function field(array $attributes, string $default = '', ?array $options = null): ?FormField + { + // make sure we have attributes and a type value + if (ArrayHelper::check($attributes) && isset($attributes['type'])) + { + // get field type + if (($field = JoomlaFormHelper::loadFieldType($attributes['type'], true)) === false) + { + return null; + } + + // get field xml + $XML = self::xml($attributes, $options); + + // setup the field + $field->setup($XML, $default); + + // return the field object + return $field; + } + + return null; + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php new file mode 100644 index 00000000..1f89e7b8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php @@ -0,0 +1,253 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Factory; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Some easy get... + * + * @since 3.0.9 + */ +abstract class GetHelper +{ + /** + * Get a Variable + * + * @param string|null $table The table from which to get the variable + * @param mixed $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mixed string/int/float + * @since 3.0.9 + */ + public static function var(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', + string $operator = '=', ?string $main = null) + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if(empty($main)) + { + $main = Helper::getCode(); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#__' . $main . '_' . $table)); + } + + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . (int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . $db->quote((string)$where)); + } + else + { + return false; + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadResult(); + } + + return false; + } + + /** + * Get array of variables + * + * @param string|null $table The table from which to get the variables + * @param mixed $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array|null + * @since 3.0.9 + */ + public static function vars(?string $table = null, $where = null, + string $whereString = 'user', string $what = 'id', string $operator = 'IN', + ?string $main = null, bool $unique = true): ?array + { + if(empty($where)) + { + $where = Factory::getUser()->id; + } + + if($main === null) + { + $main = Helper::getCode(); + } + + if (!ArrayHelper::check($where) && $where > 0) + { + $where = [$where]; + } + + if (ArrayHelper::check($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (StringHelper::check($main)) + { + $main = '_' . ltrim($main, '_'); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#_' . $main . '_' . $table)); + } + + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","', $where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',', $where) . ')'); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + + return null; + } + + /** + * get all strings between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return array|null On success + * @since 3.0.9 + */ + public static function allBetween(string $content, string $start, string $end): ?array + { + // reset bucket + $bucket = []; + for ($i = 0; ; $i++) + { + // search for string + $found = self::between($content, $start, $end); + + if (StringHelper::check($found)) + { + // add to bucket + $bucket[] = $found; + + // build removal string + $remove = $start . $found . $end; + + // remove from content + $content = str_replace($remove, '', $content); + } + else + { + break; + } + + // safety catch + if ($i == 500) + { + break; + } + } + + // only return unique array of values + if (ArrayHelper::check($bucket)) + { + return array_unique($bucket); + } + + return null; + } + + /** + * get a string between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * @param string $default The default value if none found + * + * @return string On success / empty string on failure + * @since 3.0.9 + */ + public static function between(string $content, string $start, string $end, string $default = ''): string + { + $array = explode($start, $content); + if (isset($array[1]) && strpos($array[1], $end) !== false) + { + $array = explode($end, $array[1]); + + // return string found between + return $array[0]; + } + + return $default; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php new file mode 100644 index 00000000..47fbd243 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php @@ -0,0 +1,101 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +/** + * The json checker + * + * @since 3.0.9 + */ +abstract class JsonHelper +{ + /** + * Check if you have a json string + * + * @input string $string The json string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + if (StringHelper::check($string)) + { + json_decode((string) $string); + return (json_last_error() === JSON_ERROR_NONE); + } + + return false; + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * + * @since 3.0.9 + */ + public static function string($value, $separator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (is_string($table) && strpos((string) $table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', (string) $table); + } + + // check if string is JSON + $result = json_decode((string) $value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (ArrayHelper::check($result)) + { + if (StringHelper::check($table)) + { + $names = []; + foreach ($result as $val) + { + if ($external) + { + if ($_name = GetHelper::var(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = GetHelper::var($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (ArrayHelper::check($names)) + { + return (string) implode($separator, $names); + } + } + return (string) implode($separator, $result); + } + return (string) json_decode((string) $value); + } + return $value; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/MimeHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/MimeHelper.php new file mode 100644 index 00000000..2fc06dff --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/MimeHelper.php @@ -0,0 +1,1113 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Mime Helper + * + * @since 3.0.11 + */ +abstract class MimeHelper +{ + /** + * File Extensions to Mimetypes + * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b + * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + * + * @var array + */ + protected static $fileExtensionToMimeType = array( + '123' => 'application/vnd.lotus-1-2-3', + '3dml' => 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/x-aac', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/pkix-attr-cert', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'apk' => 'application/vnd.android.package-archive', + 'appcache' => 'text/cache-manifest', + 'application' => 'application/x-ms-application', + 'apr' => 'application/vnd.lotus-approach', + 'arc' => 'application/x-freearc', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/basic', + 'avi' => 'video/x-msvideo', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azw' => 'application/vnd.amazon.ebook', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'btif' => 'image/prs.btif', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/java-vm', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'csh' => 'application/x-csh', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/x-msdownload', + 'dmg' => 'application/x-apple-diskimage', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.document.macroenabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dra' => 'audio/vnd.dra', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'application/x-msmetafile', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/x-msdownload', + 'exi' => 'application/exi', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/x-f4v', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'geo' => 'application/vnd.dynageo', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hdf' => 'application/x-hdf', + 'hh' => 'text/x-c', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'java' => 'text/x-java-source', + 'jisp' => 'application/vnd.jisp', + 'jlt' => 'application/vnd.hp-jlyt', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jpm' => 'video/jpm', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'jsonml' => 'application/jsonml+json', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'lha' => 'application/x-lzh-compressed', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/x-lzh-compressed', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm1v' => 'video/mpeg', + 'm21' => 'application/mp21', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'audio/x-mpegurl', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/mp4', + 'm4u' => 'video/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'mar' => 'application/octet-stream', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp21' => 'application/mp21', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msl' => 'application/vnd.mobius.msl', + 'msty' => 'application/vnd.muvee.style', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'ntf' => 'application/vnd.nitf', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obj' => 'application/x-tgif', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'opus' => 'audio/ogg', + 'org' => 'application/vnd.lotus-organizer', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'font/otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p10' => 'application/pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/vnd.palm', + 'pdf' => 'application/pdf', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp-encrypted', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'application/x-mobipocket-ebook', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'image/vnd.adobe.photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-pn-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'application/vnd.rn-realmedia', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsd' => 'application/rsd+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'rtx' => 'text/richtext', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shf' => 'application/shf+xml', + 'sid' => 'image/x-mrsid-image', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil+xml', + 'smil' => 'application/smil+xml', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'application/vnd.ms-pki.stl', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tga' => 'image/x-tga', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tmo' => 'application/vnd.tmobile-livetv', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trm' => 'application/x-msterminal', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'font/collection', + 'ttf' => 'font/ttf', + 'ttl' => 'text/turtle', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u32' => 'application/x-authorware-bin', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webm' => 'video/webm', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgt' => 'application/widget', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'application/x-msmetafile', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x32' => 'application/x-authorware-bin', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+binary', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d+vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/x-xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml' + ); + + + /** + * Get the mime type based on file extension + * + * @param string $file The file name or path + * + * @return string the mime type on success + * + */ + public static function mimeType($file) + { + /** + * **DISCLAIMER** + * This will just match the file extension to the following + * array. It does not guarantee that the file is TRULY that + * of the extension that this function returns. + * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b + */ + + // get the extension form file + $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + // check if we have the extension listed + if (isset(self::$fileExtensionToMimeType[$extension])) + { + return self::$fileExtensionToMimeType[$extension]; + } + elseif (function_exists('mime_content_type')) + { + return mime_content_type($file); + } + elseif (function_exists('finfo_open')) + { + $finfo = finfo_open(FILEINFO_MIME); + $mimetype = finfo_file($finfo, $file); + finfo_close($finfo); + return $mimetype; + } + return 'application/octet-stream'; + } + + + /** + * Get the file extensions + * + * @param string $target The targeted/filter option + * @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used) + * + * @return array All the extensions (targeted & sorted) + * + */ + public static function getFileExtensions($target = null, $sorted = false) + { + // we have some in-house grouping/filters :) + $filters = array( + 'image' => array('image', 'font', 'model'), + 'document' => array('application', 'text', 'chemical', 'message'), + 'media' => array('video', 'audio'), + 'file' => array('image', 'application', 'text', 'video', 'audio'), + 'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference') + ); + // sould we filter + if ($target) + { + // the bucket to get extensions + $fileextensions = array(); + // check if filter exist (if not return empty array) + if (isset($filters[$target])) + { + foreach (self::$fileExtensionToMimeType as $extension => $mimetype) + { + // get the key mime type + $mimearr = explode("/", $mimetype, 2); + // check if this file extension should be added + if (in_array($mimearr[0], $filters[$target])) + { + if ($sorted) + { + if (!isset($fileextensions[$mimearr[0]])) + { + $fileextensions[$mimearr[0]] = array(); + } + $fileextensions[$mimearr[0]][$extension] = $extension; + } + else + { + $fileextensions[$extension] = $extension; + } + } + } + } + return $fileextensions; + } + // we just return all file extensions + return array_keys(self::$fileExtensionToMimeType); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php new file mode 100644 index 00000000..2646f7c3 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php @@ -0,0 +1,78 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Some object tricks + * + * @since 3.0.9 + */ +abstract class ObjectHelper +{ + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($object) + { + if (is_object($object)) + { + return count((array) $object) > 0; + } + + return false; + } + + /** + * Compare two objects for equality based on their property values. + * + * Note that this method works only for simple objects that don't + * contain any nested objects or resource references. If you need + * to compare more complex objects, you may need to use a + * more advanced method such as serialization or reflection. + * + * @param object|null $obj1 The first object to compare. + * @param object|null $obj2 The second object to compare. + * + * @return bool True if the objects have the same key-value pairs and false otherwise. + */ + public static function equal(?object $obj1, ?object $obj2): bool + { + // if any is null we return false as that means there is a none object + // we are not comparing null but objects + // but we allow null as some objects while + // not instantiate are still null + if (is_null($obj1) || is_null($obj2)) + { + return false; + } + + // Convert the objects to arrays of their property values using get_object_vars. + $array1 = get_object_vars($obj1); + $array2 = get_object_vars($obj2); + + // Compare the arrays using array_diff_assoc to detect any differences. + $diff1 = array_diff_assoc($array1, $array2); + $diff2 = array_diff_assoc($array2, $array1); + + // If the arrays have the same key-value pairs, they will have no differences, so return true. + return empty($diff1) && empty($diff2); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php new file mode 100644 index 00000000..55ee2e49 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php @@ -0,0 +1,78 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a namespace helper + * + * @since 3.0.9 + */ +abstract class NamespaceHelper +{ + /** + * Making namespace safe + * + * @param string $string The namespace string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safe(string $string): string + { + // Remove leading and trailing backslashes + $string = trim($string, '\\'); + + // Split the string into namespace segments + $segments = explode('\\', $string); + + // make each segment safe + $segments = array_map([self::class, 'safeSegment'], $segments); + + // Join the namespace segments back together + return implode('\\', $segments); + } + + /** + * Making one namespace segment safe + * + * @param string $string The namespace segment string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safeSegment(string $string): string + { + // Check if segment starts with a number + if (preg_match("/^\d/", $string)) + { + // Extract the starting number(s) + preg_match("/^\d+/", $string, $matches); + + if (isset($matches[0])) + { + $numberWord = StringHelper::numbers($matches[0]); + $string = str_replace($matches[0], $numberWord, $string); + } + } + + // Transliterate string TODO: look again as this makes it lowercase + // $segment = StringHelper::transliterate($segment); + + // Make sure segment only contains valid characters + return preg_replace("/[^A-Za-z0-9]/", '', $string); + } +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php new file mode 100644 index 00000000..fad23356 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php @@ -0,0 +1,416 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Language\Language; +use VDM\Joomla\Utilities\Component\Helper; + + +/** + * Some string tricks + * + * @since 3.0.9 + */ +abstract class StringHelper +{ + /** + * The Main Active Language + * + * @var string + * + * @since 3.0.9 + */ + public static $langTag; + + /** + * Check if we have a string with a length + * + * @input string $string The string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + return is_string($string) && strlen($string) > 0; + } + + /** + * Shorten a string + * + * @input string The sting that you would like to shorten + * + * @returns string on success + * + * @since 3.2.0 + */ + public static function shorten($string, $length = 40, $addTip = true) + { + if (self::check($string)) + { + $initial = strlen((string) $string); + $words = preg_split('/([\s\n\r]+)/', (string) $string, -1, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial !== $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return '' . trim($newString) . '...'; + } + elseif ($initial !== $final && !$addTip) + { + return trim($newString) . '...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with English text version (works well only up to millions) + $string = self::numbers($string); + } + // 0nly continue if we have a string + if (self::check($string)) + { + // create file name without the extension that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', (string) $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', (string) $string); + } + // remove all other characters + $string = trim((string) $string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', (string) $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', (string) $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, (string) $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no underscore) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no underscore) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no underscore) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no underscore) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', (string) $spacer, $string); + // return with first character to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function transliterate($string) + { + // set tag only once + if (!self::check(self::$langTag)) + { + // get global value + self::$langTag = Helper::getParams()->get('language', 'en-GB'); + } + + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + + return $lang->transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true) + { + if (self::check($var)) + { + $filter = new InputFilter(); + $string = $filter->clean( + html_entity_decode( + htmlentities( + (string) $var, + ENT_COMPAT, + $charset + ) + ), + 'HTML' + ); + if ($shorten) + { + return self::shorten($string, $length, $addTip); + } + return $string; + } + else + { + return ''; + } + } + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * + * @since 3.0.9 + */ + public static function numbers($string) + { + // set numbers array + $numbers = []; + $search_replace= []; + + // first get all numbers + preg_match_all('!\d+!', (string) $string, $numbers); + + // check if we have any numbers + if (isset($numbers[0]) && ArrayHelper::check($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $search_replace[$number] = self::number((int)$number); + } + + // now replace numbers in string + $string = str_replace(array_keys($search_replace), array_values($search_replace), (string) $string); + + // check if we missed any, strange if we did. + return self::numbers($string); + } + + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * + * @since 3.0.9 + */ + public static function number($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' ' . $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::number($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::number(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + else // millions + { + $w .= self::number(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @input int $size The size of the random string + * + * @returns a string + * @since 3.0.9 + */ + public static function random(int $size): string + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = []; + $bagsize = strlen($bag) - 1; + + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + + return implode($key); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/htaccess.txt b/libraries/jcb_powers/htaccess.txt new file mode 100644 index 00000000..9afb1a1b --- /dev/null +++ b/libraries/jcb_powers/htaccess.txt @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/libraries/jcb_powers/index.html b/libraries/jcb_powers/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/libraries/jcb_powers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/web.config b/libraries/jcb_powers/web.config new file mode 100644 index 00000000..47b6d6db --- /dev/null +++ b/libraries/jcb_powers/web.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/media/js/external_source.js b/media/js/external_source.js index 877b7f45..4e802bad 100644 --- a/media/js/external_source.js +++ b/media/js/external_source.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage external_source.js @@ -26,7 +26,7 @@ jform_vvvvvwjvwd_required = false; jform_vvvvvwmvwe_required = false; // Initial Script -jQuery(document).ready(function() +document.addEventListener('DOMContentLoaded', function() { var externalsources_vvvvvwe = jQuery("#jform_externalsources").val(); var permissiontype_vvvvvwe = jQuery("#jform_permissiontype input[type='radio']:checked").val(); @@ -1019,7 +1019,7 @@ function vvvvvww(update_method_vvvvvww) // update fields required function updateFieldRequired(name, status) { // check if not_required exist - if (jQuery('#jform_not_required').length > 0) { + if (document.getElementById('jform_not_required')) { var not_required = jQuery('#jform_not_required').val().split(","); if(status == 1) @@ -1135,4 +1135,4 @@ function getBuildTable(string,idName){ function buildTable(result,idName){ jQuery('#table_'+idName).remove(); jQuery('#'+idName).closest('.control-group').append(result); -} +} diff --git a/media/js/help_document.js b/media/js/help_document.js index 7e79fafc..b37d280d 100644 --- a/media/js/help_document.js +++ b/media/js/help_document.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help_document.js @@ -29,7 +29,7 @@ jform_vvvvvxavwi_required = false; jform_vvvvvxcvwj_required = false; // Initial Script -jQuery(document).ready(function() +document.addEventListener('DOMContentLoaded', function() { var location_vvvvvwx = jQuery("#jform_location input[type='radio']:checked").val(); vvvvvwx(location_vvvvvwx); @@ -299,7 +299,7 @@ function vvvvvxc(target_vvvvvxc) // update fields required function updateFieldRequired(name, status) { // check if not_required exist - if (jQuery('#jform_not_required').length > 0) { + if (document.getElementById('jform_not_required')) { var not_required = jQuery('#jform_not_required').val().split(","); if(status == 1) @@ -345,4 +345,4 @@ function isSet(val) return true; } return false; -} +} diff --git a/media/js/local_listing.js b/media/js/local_listing.js index cb9579e1..26465429 100644 --- a/media/js/local_listing.js +++ b/media/js/local_listing.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage local_listing.js @@ -61,4 +61,4 @@ function getBuildTable(string,idName){ function buildTable(result,idName){ jQuery('#table_'+idName).remove(); jQuery('#'+idName).closest('.control-group').append(result); -} +} diff --git a/media/js/preacher.js b/media/js/preacher.js index 9cc67f27..e58fcbea 100644 --- a/media/js/preacher.js +++ b/media/js/preacher.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.js @@ -21,4 +21,4 @@ /----------------------------------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/series.js b/media/js/series.js index 84fb103b..51d298e5 100644 --- a/media/js/series.js +++ b/media/js/series.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.js @@ -21,4 +21,4 @@ /----------------------------------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/sermon.js b/media/js/sermon.js index 498cf85b..eaea5ff5 100644 --- a/media/js/sermon.js +++ b/media/js/sermon.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.js @@ -29,7 +29,7 @@ jform_vvvvvwavvz_required = false; jform_vvvvvwbvwa_required = false; // Initial Script -jQuery(document).ready(function() +document.addEventListener('DOMContentLoaded', function() { var source_vvvvvvv = jQuery("#jform_source").val(); vvvvvvv(source_vvvvvvv); @@ -481,7 +481,7 @@ function vvvvvwd(link_type_vvvvvwd) // update fields required function updateFieldRequired(name, status) { // check if not_required exist - if (jQuery('#jform_not_required').length > 0) { + if (document.getElementById('jform_not_required')) { var not_required = jQuery('#jform_not_required').val().split(","); if(status == 1) @@ -527,4 +527,4 @@ function isSet(val) return true; } return false; -} +} diff --git a/media/js/statistic.js b/media/js/statistic.js index d73fb926..c966e7f7 100644 --- a/media/js/statistic.js +++ b/media/js/statistic.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage statistic.js @@ -21,4 +21,4 @@ /----------------------------------------------------------------------------------------------------------------------------------*/ - + diff --git a/script.php b/script.php index 6dca53eb..f988c3d0 100644 --- a/script.php +++ b/script.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage script.php @@ -25,20 +25,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Adapter\ComponentAdapter; -JHTML::_('bootstrap.renderModal'); +use Joomla\CMS\Version; +use Joomla\CMS\HTML\HTMLHelper as Html; +HTML::_('bootstrap.renderModal'); /** * Script File of Sermondistributor Component */ -class com_sermondistributorInstallerScript +class Com_SermondistributorInstallerScript { /** * Constructor * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script */ public function __construct(ComponentAdapter $parent) {} @@ -59,10 +63,10 @@ class com_sermondistributorInstallerScript public function uninstall(ComponentAdapter $parent) { // Get Application object - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -92,7 +96,7 @@ class com_sermondistributorInstallerScript if ($preacher_done) { // If successfully remove Preacher add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.preacher) type alias was removed from the #__content_type table')); } // Remove Preacher items from the contentitem tag map table @@ -107,7 +111,7 @@ class com_sermondistributorInstallerScript if ($preacher_done) { // If successfully remove Preacher add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.preacher) type alias was removed from the #__contentitem_tag_map table')); } // Remove Preacher items from the ucm content table @@ -122,7 +126,7 @@ class com_sermondistributorInstallerScript if ($preacher_done) { // If successfully removed Preacher add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.preacher) type alias was removed from the #__ucm_content table')); } // Make sure that all the Preacher items are cleared from DB @@ -178,7 +182,7 @@ class com_sermondistributorInstallerScript if ($sermon_done) { // If successfully remove Sermon add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon) type alias was removed from the #__content_type table')); } // Remove Sermon items from the contentitem tag map table @@ -193,7 +197,7 @@ class com_sermondistributorInstallerScript if ($sermon_done) { // If successfully remove Sermon add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon) type alias was removed from the #__contentitem_tag_map table')); } // Remove Sermon items from the ucm content table @@ -208,7 +212,7 @@ class com_sermondistributorInstallerScript if ($sermon_done) { // If successfully removed Sermon add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon) type alias was removed from the #__ucm_content table')); } // Make sure that all the Sermon items are cleared from DB @@ -264,7 +268,7 @@ class com_sermondistributorInstallerScript if ($sermon_catid_done) { // If successfully remove Sermon catid add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__content_type table')); } // Remove Sermon catid items from the contentitem tag map table @@ -279,7 +283,7 @@ class com_sermondistributorInstallerScript if ($sermon_catid_done) { // If successfully remove Sermon catid add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__contentitem_tag_map table')); } // Remove Sermon catid items from the ucm content table @@ -294,7 +298,7 @@ class com_sermondistributorInstallerScript if ($sermon_catid_done) { // If successfully removed Sermon catid add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.sermon.category) type alias was removed from the #__ucm_content table')); } // Make sure that all the Sermon catid items are cleared from DB @@ -350,7 +354,7 @@ class com_sermondistributorInstallerScript if ($series_done) { // If successfully remove Series add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.series) type alias was removed from the #__content_type table')); } // Remove Series items from the contentitem tag map table @@ -365,7 +369,7 @@ class com_sermondistributorInstallerScript if ($series_done) { // If successfully remove Series add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.series) type alias was removed from the #__contentitem_tag_map table')); } // Remove Series items from the ucm content table @@ -380,7 +384,7 @@ class com_sermondistributorInstallerScript if ($series_done) { // If successfully removed Series add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.series) type alias was removed from the #__ucm_content table')); } // Make sure that all the Series items are cleared from DB @@ -436,7 +440,7 @@ class com_sermondistributorInstallerScript if ($statistic_done) { // If successfully remove Statistic add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.statistic) type alias was removed from the #__content_type table')); } // Remove Statistic items from the contentitem tag map table @@ -451,7 +455,7 @@ class com_sermondistributorInstallerScript if ($statistic_done) { // If successfully remove Statistic add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.statistic) type alias was removed from the #__contentitem_tag_map table')); } // Remove Statistic items from the ucm content table @@ -466,7 +470,7 @@ class com_sermondistributorInstallerScript if ($statistic_done) { // If successfully removed Statistic add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.statistic) type alias was removed from the #__ucm_content table')); } // Make sure that all the Statistic items are cleared from DB @@ -522,7 +526,7 @@ class com_sermondistributorInstallerScript if ($external_source_done) { // If successfully remove External_source add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.external_source) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.external_source) type alias was removed from the #__content_type table')); } // Remove External_source items from the contentitem tag map table @@ -537,7 +541,7 @@ class com_sermondistributorInstallerScript if ($external_source_done) { // If successfully remove External_source add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.external_source) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.external_source) type alias was removed from the #__contentitem_tag_map table')); } // Remove External_source items from the ucm content table @@ -552,7 +556,7 @@ class com_sermondistributorInstallerScript if ($external_source_done) { // If successfully removed External_source add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.external_source) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.external_source) type alias was removed from the #__ucm_content table')); } // Make sure that all the External_source items are cleared from DB @@ -608,7 +612,7 @@ class com_sermondistributorInstallerScript if ($local_listing_done) { // If successfully remove Local_listing add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.local_listing) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.local_listing) type alias was removed from the #__content_type table')); } // Remove Local_listing items from the contentitem tag map table @@ -623,7 +627,7 @@ class com_sermondistributorInstallerScript if ($local_listing_done) { // If successfully remove Local_listing add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.local_listing) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.local_listing) type alias was removed from the #__contentitem_tag_map table')); } // Remove Local_listing items from the ucm content table @@ -638,7 +642,7 @@ class com_sermondistributorInstallerScript if ($local_listing_done) { // If successfully removed Local_listing add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.local_listing) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.local_listing) type alias was removed from the #__ucm_content table')); } // Make sure that all the Local_listing items are cleared from DB @@ -694,7 +698,7 @@ class com_sermondistributorInstallerScript if ($help_document_done) { // If successfully remove Help_document add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.help_document) type alias was removed from the #__content_type table')); } // Remove Help_document items from the contentitem tag map table @@ -709,7 +713,7 @@ class com_sermondistributorInstallerScript if ($help_document_done) { // If successfully remove Help_document add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.help_document) type alias was removed from the #__contentitem_tag_map table')); } // Remove Help_document items from the ucm content table @@ -724,7 +728,7 @@ class com_sermondistributorInstallerScript if ($help_document_done) { // If successfully removed Help_document add queued success message. - $app->enqueueMessage(JText::_('The (com_sermondistributor.help_document) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_sermondistributor.help_document) type alias was removed from the #__ucm_content table')); } // Make sure that all the Help_document items are cleared from DB @@ -753,8 +757,8 @@ class com_sermondistributorInstallerScript } // If All related items was removed queued success message. - $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table')); - $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__ucm_base table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__ucm_history table')); // Remove sermondistributor assets from the assets table $sermondistributor_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_sermondistributor%') ); @@ -768,7 +772,7 @@ class com_sermondistributorInstallerScript if ($help_document_done) { // If successfully removed sermondistributor add queued success message. - $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__assets table')); } // Get the biggest rule column in the assets table at this point. @@ -784,24 +788,24 @@ class com_sermondistributorInstallerScript $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; $db->setQuery($revert_rule); $db->execute(); - $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); + $app->enqueueMessage(Text::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); } else { - $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); + $app->enqueueMessage(Text::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); } } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor from the action_logs_extensions table $sermondistributor_action_logs_extensions = array( $db->quoteName('extension') . ' = ' . $db->quote('com_sermondistributor') ); @@ -815,18 +819,18 @@ class com_sermondistributorInstallerScript if ($sermondistributor_removed_done) { // If successfully remove Sermondistributor add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor extension was removed from the #__action_logs_extensions table')); + $app->enqueueMessage(Text::_('The com_sermondistributor extension was removed from the #__action_logs_extensions table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Preacher from the action_log_config table $preacher_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.preacher') ); @@ -840,18 +844,18 @@ class com_sermondistributorInstallerScript if ($preacher_action_log_config_done) { // If successfully removed Sermondistributor Preacher add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.preacher type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.preacher type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Sermon from the action_log_config table $sermon_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.sermon') ); @@ -865,18 +869,18 @@ class com_sermondistributorInstallerScript if ($sermon_action_log_config_done) { // If successfully removed Sermondistributor Sermon add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.sermon type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.sermon type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Series from the action_log_config table $series_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.series') ); @@ -890,18 +894,18 @@ class com_sermondistributorInstallerScript if ($series_action_log_config_done) { // If successfully removed Sermondistributor Series add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.series type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.series type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Statistic from the action_log_config table $statistic_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.statistic') ); @@ -915,18 +919,18 @@ class com_sermondistributorInstallerScript if ($statistic_action_log_config_done) { // If successfully removed Sermondistributor Statistic add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.statistic type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.statistic type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor External_source from the action_log_config table $external_source_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.external_source') ); @@ -940,18 +944,18 @@ class com_sermondistributorInstallerScript if ($external_source_action_log_config_done) { // If successfully removed Sermondistributor External_source add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.external_source type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.external_source type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Local_listing from the action_log_config table $local_listing_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.local_listing') ); @@ -965,18 +969,18 @@ class com_sermondistributorInstallerScript if ($local_listing_action_log_config_done) { // If successfully removed Sermondistributor Local_listing add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.local_listing type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.local_listing type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Sermondistributor Help_document from the action_log_config table $help_document_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_sermondistributor.help_document') ); @@ -990,7 +994,7 @@ class com_sermondistributorInstallerScript if ($help_document_action_log_config_done) { // If successfully removed Sermondistributor Help_document add queued success message. - $app->enqueueMessage(JText::_('The com_sermondistributor.help_document type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_sermondistributor.help_document type alias was removed from the #__action_log_config table')); } // little notice as after service, in case of bad experience with component. echo '

Did something go wrong? Are you disappointed?

@@ -1020,14 +1024,14 @@ class com_sermondistributorInstallerScript public function preflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // is redundant or so it seems ...hmmm let me know if it works again if ($type === 'uninstall') { return true; } // the default for both install and update - $jversion = new JVersion(); + $jversion = new Version(); if (!$jversion->isCompatible('3.8.0')) { $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); @@ -1078,7 +1082,7 @@ class com_sermondistributorInstallerScript // only update if it was fixed if (SermondistributorHelper::checkArray($files)) { - $object = new stdClass(); + $object = new \stdClass(); // make sure the files are set to json $object->manual_files = json_encode($files); $object->id = $id; @@ -1224,7 +1228,7 @@ class com_sermondistributorInstallerScript public function postflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // We check if we have dynamic folders to copy $this->setDynamicF0ld3rs($app, $parent); // set the default component settings @@ -1232,34 +1236,34 @@ class com_sermondistributorInstallerScript { // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create the preacher content type object. - $preacher = new stdClass(); + $preacher = new \stdClass(); $preacher->type_title = 'Sermondistributor Preacher'; $preacher->type_alias = 'com_sermondistributor.preacher'; $preacher->table = '{"special": {"dbtable": "#__sermondistributor_preacher","key": "id","type": "Preacher","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $preacher->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","email":"email","icon":"icon","alias":"alias"}}'; $preacher->router = 'SermondistributorHelperRoute::getPreacherRoute'; - $preacher->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/preacher.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $preacher->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/preacher.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $preacher_Inserted = $db->insertObject('#__content_types', $preacher); // Create the sermon content type object. - $sermon = new stdClass(); + $sermon = new \stdClass(); $sermon->type_title = 'Sermondistributor Sermon'; $sermon->type_alias = 'com_sermondistributor.sermon'; $sermon->table = '{"special": {"dbtable": "#__sermondistributor_sermon","key": "id","type": "Sermon","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $sermon->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","preacher":"preacher","series":"series","short_description":"short_description","link_type":"link_type","source":"source","local_files":"local_files","alias":"alias","description":"description","tags":"tags","icon":"icon","build":"build","manual_files":"manual_files","auto_sermons":"auto_sermons","url":"url","scripture":"scripture"}}'; $sermon->router = 'SermondistributorHelperRoute::getSermonRoute'; - $sermon->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/sermon.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","auto_sermons"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","preacher","series","catid","link_type","source","build"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; + $sermon->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/sermon.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","auto_sermons"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","preacher","series","catid","link_type","source","build"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $sermon_Inserted = $db->insertObject('#__content_types', $sermon); // Create the sermon category content type object. - $sermon_category = new stdClass(); + $sermon_category = new \stdClass(); $sermon_category->type_title = 'Sermondistributor Sermon Catid'; $sermon_category->type_alias = 'com_sermondistributor.sermon.category'; $sermon_category->table = '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'; @@ -1271,67 +1275,84 @@ class com_sermondistributorInstallerScript $sermon_category_Inserted = $db->insertObject('#__content_types', $sermon_category); // Create the series content type object. - $series = new stdClass(); + $series = new \stdClass(); $series->type_title = 'Sermondistributor Series'; $series->type_alias = 'com_sermondistributor.series'; $series->table = '{"special": {"dbtable": "#__sermondistributor_series","key": "id","type": "Series","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $series->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","scripture":"scripture","icon":"icon","alias":"alias"}}'; $series->router = 'SermondistributorHelperRoute::getSeriesRoute'; - $series->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/series.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $series->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/series.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $series_Inserted = $db->insertObject('#__content_types', $series); // Create the statistic content type object. - $statistic = new stdClass(); + $statistic = new \stdClass(); $statistic->type_title = 'Sermondistributor Statistic'; $statistic->type_alias = 'com_sermondistributor.statistic'; $statistic->table = '{"special": {"dbtable": "#__sermondistributor_statistic","key": "id","type": "Statistic","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $statistic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "filename","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"filename":"filename","sermon":"sermon","preacher":"preacher","series":"series","counter":"counter"}}'; $statistic->router = 'SermondistributorHelperRoute::getStatisticRoute'; - $statistic->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/statistic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","sermon","preacher","series","counter"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sermon","targetTable": "#__sermondistributor_sermon","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; + $statistic->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/statistic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","sermon","preacher","series","counter"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sermon","targetTable": "#__sermondistributor_sermon","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $statistic_Inserted = $db->insertObject('#__content_types', $statistic); // Create the external_source content type object. - $external_source = new stdClass(); + $external_source = new \stdClass(); $external_source->type_title = 'Sermondistributor External_source'; $external_source->type_alias = 'com_sermondistributor.external_source'; $external_source->table = '{"special": {"dbtable": "#__sermondistributor_external_source","key": "id","type": "External_source","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $external_source->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "description","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"description":"description","externalsources":"externalsources","update_method":"update_method","filetypes":"filetypes","build":"build","not_required":"not_required","update_timer":"update_timer","dropboxoptions":"dropboxoptions","permissiontype":"permissiontype","oauthtoken":"oauthtoken"}}'; $external_source->router = 'SermondistributorHelperRoute::getExternal_sourceRoute'; - $external_source->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/external_source.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","externalsources","update_method","build","not_required","update_timer","dropboxoptions"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $external_source->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/external_source.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","externalsources","update_method","build","not_required","update_timer","dropboxoptions"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $external_source_Inserted = $db->insertObject('#__content_types', $external_source); // Create the local_listing content type object. - $local_listing = new stdClass(); + $local_listing = new \stdClass(); $local_listing->type_title = 'Sermondistributor Local_listing'; $local_listing->type_alias = 'com_sermondistributor.local_listing'; $local_listing->table = '{"special": {"dbtable": "#__sermondistributor_local_listing","key": "id","type": "Local_listing","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $local_listing->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","build":"build","size":"size","external_source":"external_source","key":"key","url":"url"}}'; $local_listing->router = 'SermondistributorHelperRoute::getLocal_listingRoute'; - $local_listing->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/local_listing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","build","size","external_source"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "external_source","targetTable": "#__sermondistributor_external_source","targetColumn": "id","displayColumn": "description"}]}'; + $local_listing->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/local_listing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","build","size","external_source"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "external_source","targetTable": "#__sermondistributor_external_source","targetColumn": "id","displayColumn": "description"}]}'; // Set the object into the content types table. $local_listing_Inserted = $db->insertObject('#__content_types', $local_listing); // Create the help_document content type object. - $help_document = new stdClass(); + $help_document = new \stdClass(); $help_document->type_title = 'Sermondistributor Help_document'; $help_document->type_alias = 'com_sermondistributor.help_document'; $help_document->table = '{"special": {"dbtable": "#__sermondistributor_help_document","key": "id","type": "Help_document","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; $help_document->router = 'SermondistributorHelperRoute::getHelp_documentRoute'; - $help_document->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; // Set the object into the content types table. $help_document_Inserted = $db->insertObject('#__content_types', $help_document); - // Install the global extenstion assets permission. + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length <= 22240) + { + // Fix the assets table rules column size + $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; + $db->setQuery($fix_rules_size); + $db->execute(); + $app->enqueueMessage(Text::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); + } + } + // Install the global extension assets permission. + $db = Factory::getDbo(); $query = $db->getQuery(true); // Field to update. $fields = array( @@ -1349,7 +1370,7 @@ class com_sermondistributorInstallerScript $query = $db->getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","player":"1","add_to_button":"0","preachers_display":"2","preachers_list_style":"2","preachers_table_color":"0","preachers_icon":"1","preachers_desc":"1","preachers_sermon_count":"1","preachers_hits":"1","preachers_website":"1","preachers_email":"1","preacher_request_id":"0","preacher_display":"3","preacher_box_contrast":"1","preacher_list_style":"3","preacher_icon":"1","preacher_desc":"1","preacher_sermon_count":"1","preacher_hits":"1","preacher_email":"1","preacher_website":"1","preacher_sermons_display":"2","preacher_sermons_list_style":"2","preacher_sermons_table_color":"0","preacher_sermons_icon":"1","preacher_sermons_desc":"1","preacher_sermons_series":"1","preacher_sermons_category":"1","preacher_sermons_download_counter":"1","preacher_sermons_hits":"1","preacher_sermons_downloads":"1","preacher_sermons_open":"1","categories_display":"2","categories_list_style":"2","categories_table_color":"0","categories_icon":"1","categories_desc":"1","categories_sermon_count":"1","categories_hits":"1","category_display":"3","category_box_contrast":"1","category_list_style":"3","category_icon":"1","category_desc":"1","category_sermon_count":"1","category_hits":"1","category_sermons_display":"2","category_sermons_list_style":"1","category_sermons_table_color":"1","category_sermons_icon":"1","category_sermons_desc":"1","category_sermons_preacher":"1","category_sermons_series":"1","category_sermons_download_counter":"1","category_sermons_hits":"1","category_sermons_downloads":"1","category_sermons_open":"1","list_series_display":"2","list_series_list_style":"2","list_series_table_color":"0","list_series_icon":"1","list_series_desc":"1","list_series_sermon_count":"1","list_series_hits":"1","series_request_id":"0","series_display":"3","series_box_contrast":"1","series_list_style":"3","series_icon":"1","series_desc":"1","series_sermon_count":"1","series_hits":"1","series_sermons_display":"2","series_sermons_list_style":"1","series_sermons_table_color":"1","series_sermons_icon":"1","series_sermons_desc":"1","series_sermons_preacher":"1","series_sermons_category":"1","series_sermons_download_counter":"1","series_sermons_hits":"1","series_sermons_downloads":"1","series_sermons_open":"1","sermon_display":"1","sermon_box_contrast":"1","sermon_list_style":"1","sermon_icon":"1","sermon_desc":"1","sermon_preacher":"1","sermon_series":"1","sermon_category":"1","sermon_download_counter":"1","sermon_hits":"1","sermon_downloads":"1","max_execution_time":"500","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_version":"2","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","player":"1","add_to_button":"0","preachers_display":"2","preachers_list_style":"2","preachers_table_color":"0","preachers_icon":"1","preachers_desc":"1","preachers_sermon_count":"1","preachers_hits":"1","preachers_website":"1","preachers_email":"1","preacher_request_id":"0","preacher_display":"3","preacher_box_contrast":"1","preacher_list_style":"3","preacher_icon":"1","preacher_desc":"1","preacher_sermon_count":"1","preacher_hits":"1","preacher_email":"1","preacher_website":"1","preacher_sermons_display":"2","preacher_sermons_list_style":"2","preacher_sermons_table_color":"0","preacher_sermons_icon":"1","preacher_sermons_desc":"1","preacher_sermons_series":"1","preacher_sermons_category":"1","preacher_sermons_download_counter":"1","preacher_sermons_hits":"1","preacher_sermons_downloads":"1","preacher_sermons_open":"1","categories_display":"2","categories_list_style":"2","categories_table_color":"0","categories_icon":"1","categories_desc":"1","categories_sermon_count":"1","categories_hits":"1","category_display":"3","category_box_contrast":"1","category_list_style":"3","category_icon":"1","category_desc":"1","category_sermon_count":"1","category_hits":"1","category_sermons_display":"2","category_sermons_list_style":"1","category_sermons_table_color":"1","category_sermons_icon":"1","category_sermons_desc":"1","category_sermons_preacher":"1","category_sermons_series":"1","category_sermons_download_counter":"1","category_sermons_hits":"1","category_sermons_downloads":"1","category_sermons_open":"1","list_series_display":"2","list_series_list_style":"2","list_series_table_color":"0","list_series_icon":"1","list_series_desc":"1","list_series_sermon_count":"1","list_series_hits":"1","series_request_id":"0","series_display":"3","series_box_contrast":"1","series_list_style":"3","series_icon":"1","series_desc":"1","series_sermon_count":"1","series_hits":"1","series_sermons_display":"2","series_sermons_list_style":"1","series_sermons_table_color":"1","series_sermons_icon":"1","series_sermons_desc":"1","series_sermons_preacher":"1","series_sermons_category":"1","series_sermons_download_counter":"1","series_sermons_hits":"1","series_sermons_downloads":"1","series_sermons_open":"1","sermon_display":"1","sermon_box_contrast":"1","sermon_list_style":"1","sermon_icon":"1","sermon_desc":"1","sermon_preacher":"1","sermon_series":"1","sermon_category":"1","sermon_download_counter":"1","sermon_hits":"1","sermon_downloads":"1","max_execution_time":"500","check_in":"-1 day","save_history":"1","history_limit":"10","add_jquery_framework":"1","uikit_version":"2","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array( @@ -1359,33 +1380,18 @@ class com_sermondistributorInstallerScript $db->setQuery($query); $allDone = $db->execute(); - // Get the biggest rule column in the assets table at this point. - $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; - $db->setQuery($get_rule_length); - if ($db->execute()) - { - $rule_length = $db->loadResult(); - // Check the size of the rules column - if ($rule_length <= 22240) - { - // Fix the assets table rules column size - $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; - $db->setQuery($fix_rules_size); - $db->execute(); - $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); - } - } - echo ' + + echo '
- '; +
'; // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the sermondistributor action logs extensions object. - $sermondistributor_action_logs_extensions = new stdClass(); + $sermondistributor_action_logs_extensions = new \stdClass(); $sermondistributor_action_logs_extensions->extension = 'com_sermondistributor'; // Set the object into the action logs extensions table. @@ -1394,10 +1400,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the preacher action log config object. - $preacher_action_log_config = new stdClass(); + $preacher_action_log_config = new \stdClass(); $preacher_action_log_config->type_title = 'PREACHER'; $preacher_action_log_config->type_alias = 'com_sermondistributor.preacher'; $preacher_action_log_config->id_holder = 'id'; @@ -1411,10 +1417,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the sermon action log config object. - $sermon_action_log_config = new stdClass(); + $sermon_action_log_config = new \stdClass(); $sermon_action_log_config->type_title = 'SERMON'; $sermon_action_log_config->type_alias = 'com_sermondistributor.sermon'; $sermon_action_log_config->id_holder = 'id'; @@ -1428,10 +1434,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the series action log config object. - $series_action_log_config = new stdClass(); + $series_action_log_config = new \stdClass(); $series_action_log_config->type_title = 'SERIES'; $series_action_log_config->type_alias = 'com_sermondistributor.series'; $series_action_log_config->id_holder = 'id'; @@ -1445,10 +1451,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the statistic action log config object. - $statistic_action_log_config = new stdClass(); + $statistic_action_log_config = new \stdClass(); $statistic_action_log_config->type_title = 'STATISTIC'; $statistic_action_log_config->type_alias = 'com_sermondistributor.statistic'; $statistic_action_log_config->id_holder = 'id'; @@ -1462,10 +1468,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the external_source action log config object. - $external_source_action_log_config = new stdClass(); + $external_source_action_log_config = new \stdClass(); $external_source_action_log_config->type_title = 'EXTERNAL_SOURCE'; $external_source_action_log_config->type_alias = 'com_sermondistributor.external_source'; $external_source_action_log_config->id_holder = 'id'; @@ -1479,10 +1485,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the local_listing action log config object. - $local_listing_action_log_config = new stdClass(); + $local_listing_action_log_config = new \stdClass(); $local_listing_action_log_config->type_title = 'LOCAL_LISTING'; $local_listing_action_log_config->type_alias = 'com_sermondistributor.local_listing'; $local_listing_action_log_config->id_holder = 'id'; @@ -1496,10 +1502,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the help_document action log config object. - $help_document_action_log_config = new stdClass(); + $help_document_action_log_config = new \stdClass(); $help_document_action_log_config->type_title = 'HELP_DOCUMENT'; $help_document_action_log_config->type_alias = 'com_sermondistributor.help_document'; $help_document_action_log_config->id_holder = 'id'; @@ -1515,16 +1521,16 @@ class com_sermondistributorInstallerScript { // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create the preacher content type object. - $preacher = new stdClass(); + $preacher = new \stdClass(); $preacher->type_title = 'Sermondistributor Preacher'; $preacher->type_alias = 'com_sermondistributor.preacher'; $preacher->table = '{"special": {"dbtable": "#__sermondistributor_preacher","key": "id","type": "Preacher","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $preacher->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","email":"email","icon":"icon","alias":"alias"}}'; $preacher->router = 'SermondistributorHelperRoute::getPreacherRoute'; - $preacher->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/preacher.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $preacher->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/preacher.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Check if preacher type is already in content_type DB. $preacher_id = null; @@ -1547,13 +1553,13 @@ class com_sermondistributorInstallerScript } // Create the sermon content type object. - $sermon = new stdClass(); + $sermon = new \stdClass(); $sermon->type_title = 'Sermondistributor Sermon'; $sermon->type_alias = 'com_sermondistributor.sermon'; $sermon->table = '{"special": {"dbtable": "#__sermondistributor_sermon","key": "id","type": "Sermon","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $sermon->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","preacher":"preacher","series":"series","short_description":"short_description","link_type":"link_type","source":"source","local_files":"local_files","alias":"alias","description":"description","tags":"tags","icon":"icon","build":"build","manual_files":"manual_files","auto_sermons":"auto_sermons","url":"url","scripture":"scripture"}}'; $sermon->router = 'SermondistributorHelperRoute::getSermonRoute'; - $sermon->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/sermon.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","auto_sermons"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","preacher","series","catid","link_type","source","build"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; + $sermon->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/sermon.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","auto_sermons"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","preacher","series","catid","link_type","source","build"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; // Check if sermon type is already in content_type DB. $sermon_id = null; @@ -1576,7 +1582,7 @@ class com_sermondistributorInstallerScript } // Create the sermon category content type object. - $sermon_category = new stdClass(); + $sermon_category = new \stdClass(); $sermon_category->type_title = 'Sermondistributor Sermon Catid'; $sermon_category->type_alias = 'com_sermondistributor.sermon.category'; $sermon_category->table = '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'; @@ -1605,13 +1611,13 @@ class com_sermondistributorInstallerScript } // Create the series content type object. - $series = new stdClass(); + $series = new \stdClass(); $series->type_title = 'Sermondistributor Series'; $series->type_alias = 'com_sermondistributor.series'; $series->table = '{"special": {"dbtable": "#__sermondistributor_series","key": "id","type": "Series","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $series->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "description","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","scripture":"scripture","icon":"icon","alias":"alias"}}'; $series->router = 'SermondistributorHelperRoute::getSeriesRoute'; - $series->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/series.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $series->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/series.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Check if series type is already in content_type DB. $series_id = null; @@ -1634,13 +1640,13 @@ class com_sermondistributorInstallerScript } // Create the statistic content type object. - $statistic = new stdClass(); + $statistic = new \stdClass(); $statistic->type_title = 'Sermondistributor Statistic'; $statistic->type_alias = 'com_sermondistributor.statistic'; $statistic->table = '{"special": {"dbtable": "#__sermondistributor_statistic","key": "id","type": "Statistic","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $statistic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "filename","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"filename":"filename","sermon":"sermon","preacher":"preacher","series":"series","counter":"counter"}}'; $statistic->router = 'SermondistributorHelperRoute::getStatisticRoute'; - $statistic->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/statistic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","sermon","preacher","series","counter"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sermon","targetTable": "#__sermondistributor_sermon","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; + $statistic->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/statistic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","sermon","preacher","series","counter"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sermon","targetTable": "#__sermondistributor_sermon","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "preacher","targetTable": "#__sermondistributor_preacher","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "series","targetTable": "#__sermondistributor_series","targetColumn": "id","displayColumn": "name"}]}'; // Check if statistic type is already in content_type DB. $statistic_id = null; @@ -1663,13 +1669,13 @@ class com_sermondistributorInstallerScript } // Create the external_source content type object. - $external_source = new stdClass(); + $external_source = new \stdClass(); $external_source->type_title = 'Sermondistributor External_source'; $external_source->type_alias = 'com_sermondistributor.external_source'; $external_source->table = '{"special": {"dbtable": "#__sermondistributor_external_source","key": "id","type": "External_source","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $external_source->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "description","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"description":"description","externalsources":"externalsources","update_method":"update_method","filetypes":"filetypes","build":"build","not_required":"not_required","update_timer":"update_timer","dropboxoptions":"dropboxoptions","permissiontype":"permissiontype","oauthtoken":"oauthtoken"}}'; $external_source->router = 'SermondistributorHelperRoute::getExternal_sourceRoute'; - $external_source->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/external_source.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","externalsources","update_method","build","not_required","update_timer","dropboxoptions"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $external_source->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/external_source.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","externalsources","update_method","build","not_required","update_timer","dropboxoptions"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Check if external_source type is already in content_type DB. $external_source_id = null; @@ -1692,13 +1698,13 @@ class com_sermondistributorInstallerScript } // Create the local_listing content type object. - $local_listing = new stdClass(); + $local_listing = new \stdClass(); $local_listing->type_title = 'Sermondistributor Local_listing'; $local_listing->type_alias = 'com_sermondistributor.local_listing'; $local_listing->table = '{"special": {"dbtable": "#__sermondistributor_local_listing","key": "id","type": "Local_listing","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $local_listing->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","build":"build","size":"size","external_source":"external_source","key":"key","url":"url"}}'; $local_listing->router = 'SermondistributorHelperRoute::getLocal_listingRoute'; - $local_listing->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/local_listing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","build","size","external_source"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "external_source","targetTable": "#__sermondistributor_external_source","targetColumn": "id","displayColumn": "description"}]}'; + $local_listing->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/local_listing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","build","size","external_source"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "external_source","targetTable": "#__sermondistributor_external_source","targetColumn": "id","displayColumn": "description"}]}'; // Check if local_listing type is already in content_type DB. $local_listing_id = null; @@ -1721,13 +1727,13 @@ class com_sermondistributorInstallerScript } // Create the help_document content type object. - $help_document = new stdClass(); + $help_document = new \stdClass(); $help_document->type_title = 'Sermondistributor Help_document'; $help_document->type_alias = 'com_sermondistributor.help_document'; $help_document->table = '{"special": {"dbtable": "#__sermondistributor_help_document","key": "id","type": "Help_document","prefix": "sermondistributorTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","alias":"alias","content":"content","article":"article","url":"url","target":"target"}}'; $help_document->router = 'SermondistributorHelperRoute::getHelp_documentRoute'; - $help_document->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_sermondistributor/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","type","location","article","target"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; // Check if help_document type is already in content_type DB. $help_document_id = null; @@ -1776,7 +1782,7 @@ class com_sermondistributorInstallerScript $buildOption = 2; } $urls = '"'.implode('", "', $urls).'"'; - $data = new stdClass(); + $data = new \stdClass(); if (SermondistributorHelper::checkArray($dropbox_filetypes)) { $data->filetypes = json_encode($dropbox_filetypes); @@ -1810,7 +1816,7 @@ class com_sermondistributorInstallerScript $buildOption = 2; } $folder = '"'.implode('", "', $folder).'"'; - $data = new stdClass(); + $data = new \stdClass(); if (SermondistributorHelper::checkArray($dropbox_filetypes)) { $data->filetypes = json_encode($dropbox_filetypes); @@ -1837,18 +1843,19 @@ class com_sermondistributorInstallerScript $app = JFactory::getApplication(); $app->enqueueMessage('Your Dropbox integration has been moved, and can now be viewed at the new external source view. You will now need an APP token to update your local listing of the Dropbox files. Please review the Wiki tab when creating/editing the external source, or open an issue on github if you experience any more difficulties.', 'Info'); } - echo ' + + echo '
-

Upgrade to Version 2.1.1 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 3.0.0 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the sermondistributor action logs extensions object. - $sermondistributor_action_logs_extensions = new stdClass(); + $sermondistributor_action_logs_extensions = new \stdClass(); $sermondistributor_action_logs_extensions->extension = 'com_sermondistributor'; // Check if sermondistributor action log extension is already in action logs extensions DB. @@ -1868,10 +1875,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the preacher action log config object. - $preacher_action_log_config = new stdClass(); + $preacher_action_log_config = new \stdClass(); $preacher_action_log_config->id = null; $preacher_action_log_config->type_title = 'PREACHER'; $preacher_action_log_config->type_alias = 'com_sermondistributor.preacher'; @@ -1902,10 +1909,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the sermon action log config object. - $sermon_action_log_config = new stdClass(); + $sermon_action_log_config = new \stdClass(); $sermon_action_log_config->id = null; $sermon_action_log_config->type_title = 'SERMON'; $sermon_action_log_config->type_alias = 'com_sermondistributor.sermon'; @@ -1936,10 +1943,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the series action log config object. - $series_action_log_config = new stdClass(); + $series_action_log_config = new \stdClass(); $series_action_log_config->id = null; $series_action_log_config->type_title = 'SERIES'; $series_action_log_config->type_alias = 'com_sermondistributor.series'; @@ -1970,10 +1977,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the statistic action log config object. - $statistic_action_log_config = new stdClass(); + $statistic_action_log_config = new \stdClass(); $statistic_action_log_config->id = null; $statistic_action_log_config->type_title = 'STATISTIC'; $statistic_action_log_config->type_alias = 'com_sermondistributor.statistic'; @@ -2004,10 +2011,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the external_source action log config object. - $external_source_action_log_config = new stdClass(); + $external_source_action_log_config = new \stdClass(); $external_source_action_log_config->id = null; $external_source_action_log_config->type_title = 'EXTERNAL_SOURCE'; $external_source_action_log_config->type_alias = 'com_sermondistributor.external_source'; @@ -2038,10 +2045,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the local_listing action log config object. - $local_listing_action_log_config = new stdClass(); + $local_listing_action_log_config = new \stdClass(); $local_listing_action_log_config->id = null; $local_listing_action_log_config->type_title = 'LOCAL_LISTING'; $local_listing_action_log_config->type_alias = 'com_sermondistributor.local_listing'; @@ -2072,10 +2079,10 @@ class com_sermondistributorInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the help_document action log config object. - $help_document_action_log_config = new stdClass(); + $help_document_action_log_config = new \stdClass(); $help_document_action_log_config->id = null; $help_document_action_log_config->type_title = 'HELP_DOCUMENT'; $help_document_action_log_config->type_alias = 'com_sermondistributor.help_document'; @@ -2108,12 +2115,12 @@ class com_sermondistributorInstallerScript /** * Remove folders with files - * + * * @param string $dir The path to folder to remove * @param boolean $ignore The folders and files to ignore and not remove * * @return boolean True in all is removed - * + * */ protected function removeFolder($dir, $ignore = false) { @@ -2182,7 +2189,7 @@ class com_sermondistributorInstallerScript /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success */ @@ -2214,13 +2221,13 @@ class com_sermondistributorInstallerScript */ protected function setDynamicF0ld3rs($app, $parent) { - // get the instalation path + // get the installation path $installer = $parent->getParent(); $installPath = $installer->getPath('source'); // get all the folders $folders = Folder::folders($installPath); // check if we have folders we may want to copy - $doNotCopy = array('media','admin','site'); // Joomla already deals with these + $doNotCopy = ['media','admin','site']; // Joomla already deals with these if (count((array) $folders) > 1) { foreach ($folders as $folder) diff --git a/sermondistributor.xml b/sermondistributor.xml index 60be0034..551ed30d 100644 --- a/sermondistributor.xml +++ b/sermondistributor.xml @@ -1,15 +1,15 @@ - + COM_SERMONDISTRIBUTOR - 29th May, 2023 + 10th February, 2024 Llewellyn van der Merwe joomla@vdm.io https://www.vdm.io/ Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.1.1 + 3.0.0 Sermon Distributor (v.2.1.1) +

Sermon Distributor (v.3.0.0)

Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.

Created by Llewellyn van der Merwe
Development started 22nd October, 2015

@@ -102,6 +102,6 @@ - https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/master/sermondistributor_update_server.xml + https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/3.10/sermondistributor_update_server.xml
\ No newline at end of file diff --git a/sermondistributor_update_server.xml b/sermondistributor_update_server.xml index 4aae9439..c88a2512 100644 --- a/sermondistributor_update_server.xml +++ b/sermondistributor_update_server.xml @@ -85,4 +85,22 @@ https://www.vdm.io/ + + Sermon Distributor + A sermon distributor that links to Dropbox. + pkg_sermondistributor + package + site + 3.0.0 + https://www.vdm.io/ + + https://git.vdm.dev/api/v1/repos/christian/pkg-sermondistributor/archive/v3.0.0.zip + + + stable + + Llewellyn van der Merwe + https://www.vdm.io/ + + \ No newline at end of file diff --git a/site/assets/css/api.css b/site/assets/css/api.css index 876de334..04c0811b 100644 --- a/site/assets/css/api.css +++ b/site/assets/css/api.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage api.css diff --git a/site/assets/css/categories.css b/site/assets/css/categories.css index 1a941d61..f6e1adcf 100644 --- a/site/assets/css/categories.css +++ b/site/assets/css/categories.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categories.css diff --git a/site/assets/css/category.css b/site/assets/css/category.css index 0ad67227..72304ef6 100644 --- a/site/assets/css/category.css +++ b/site/assets/css/category.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage category.css diff --git a/site/assets/css/preacher.css b/site/assets/css/preacher.css index 99d15e58..b13eddb3 100644 --- a/site/assets/css/preacher.css +++ b/site/assets/css/preacher.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.css diff --git a/site/assets/css/preachers.css b/site/assets/css/preachers.css index 5f209cd8..82117a22 100644 --- a/site/assets/css/preachers.css +++ b/site/assets/css/preachers.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.css diff --git a/site/assets/css/series.css b/site/assets/css/series.css index 7bcfec11..0d4455cc 100644 --- a/site/assets/css/series.css +++ b/site/assets/css/series.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.css diff --git a/site/assets/css/serieslist.css b/site/assets/css/serieslist.css index 22719d6c..f628600c 100644 --- a/site/assets/css/serieslist.css +++ b/site/assets/css/serieslist.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage serieslist.css diff --git a/site/assets/css/sermon.css b/site/assets/css/sermon.css index f4192d9c..befe041d 100644 --- a/site/assets/css/sermon.css +++ b/site/assets/css/sermon.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.css diff --git a/site/assets/css/site.css b/site/assets/css/site.css index eea731c5..5108a3d6 100644 --- a/site/assets/css/site.css +++ b/site/assets/css/site.css @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage site.css diff --git a/site/assets/js/site.js b/site/assets/js/site.js index b24e99b1..f5f1ca45 100644 --- a/site/assets/js/site.js +++ b/site/assets/js/site.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage site.js diff --git a/site/controller.php b/site/controller.php index 5bb16d89..bcea99a7 100644 --- a/site/controller.php +++ b/site/controller.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage controller.php @@ -25,8 +25,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Sermondistributor Component Base Controller @@ -45,51 +50,51 @@ class SermondistributorController extends BaseController function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', 'preachers'); + $view = $this->input->getCmd('view', 'preachers'); $this->input->set('view', $view); - $isEdit = $this->checkEditView($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); - // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) - + $isEdit = $this->checkEditView($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) + // insure that the view is not cashable if edit view or if user is logged in - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($user->get('id') || $isEdit) { $cachable = false; } - + // Check for edit form. if($isEdit) { if ($layout == 'edit' && !$this->checkEditId('com_sermondistributor.edit.'.$view, $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && SermondistributorHelper::checkString($ref)) + if ($refid > 0 && StringHelper::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (SermondistributorHelper::checkString($ref)) + elseif (StringHelper::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view='.(string)$ref, false)); } else { // normal redirect back to the list default site view - $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false)); + $this->setRedirect(Route::_('index.php?option=com_sermondistributor&view=preachers', false)); } return false; } } - + // we may need to make this more dynamic in the future. (TODO) $safeurlparams = array( 'catid' => 'INT', @@ -110,9 +115,9 @@ class SermondistributorController extends BaseController 'Itemid' => 'INT'); // should these not merge? - if (SermondistributorHelper::checkArray($urlparams)) + if (UtilitiesArrayHelper::check($urlparams)) { - $safeurlparams = SermondistributorHelper::mergeArrays(array($urlparams, $safeurlparams)); + $safeurlparams = UtilitiesArrayHelper::merge(array($urlparams, $safeurlparams)); } return parent::display($cachable, $safeurlparams); @@ -120,7 +125,7 @@ class SermondistributorController extends BaseController protected function checkEditView($view) { - if (SermondistributorHelper::checkString($view)) + if (StringHelper::check($view)) { $views = array( diff --git a/site/controllers/ajax.json.php b/site/controllers/ajax.json.php index 91d2cda3..cf180222 100644 --- a/site/controllers/ajax.json.php +++ b/site/controllers/ajax.json.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.json.php @@ -25,7 +25,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -37,9 +39,9 @@ class SermondistributorControllerAjax extends BaseController { parent::__construct($config); // make sure all json stuff are set - JFactory::getDocument()->setMimeEncoding( 'application/json' ); + Factory::getDocument()->setMimeEncoding( 'application/json' ); // get the application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks @@ -50,16 +52,16 @@ class SermondistributorControllerAjax extends BaseController public function ajax() { // get the user for later use - $user = JFactory::getUser(); + $user = Factory::getUser(); // get the input values - $jinput = JFactory::getApplication()->input; + $jinput = Factory::getApplication()->input; // check if we should return raw - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task @@ -74,7 +76,15 @@ class SermondistributorControllerAjax extends BaseController $typeValue = $jinput->get('type', NULL, 'INT'); if($listValue && $tarValue && $typeValue) { - $result = $this->getModel('ajax')->theQueue($listValue, $tarValue, $typeValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->theQueue($listValue, $tarValue, $typeValue); + } + else + { + $result = false; + } } else { @@ -93,7 +103,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -116,7 +126,15 @@ class SermondistributorControllerAjax extends BaseController $filenameValue = $jinput->get('filename', NULL, 'CMD'); if($keyValue && $filenameValue) { - $result = $this->getModel('ajax')->countDownload($keyValue, $filenameValue); + $ajaxModule = $this->getModel('ajax'); + if ($ajaxModule) + { + $result = $ajaxModule->countDownload($keyValue, $filenameValue); + } + else + { + $result = false; + } } else { @@ -135,7 +153,7 @@ class SermondistributorControllerAjax extends BaseController echo "(".json_encode($result).");"; } } - catch(Exception $e) + catch(\Exception $e) { if($callback) { @@ -166,7 +184,7 @@ class SermondistributorControllerAjax extends BaseController echo json_encode(false); } else - { + { echo "(".json_encode(false).");"; } } diff --git a/site/controllers/api.php b/site/controllers/api.php index 246d91fa..a4fcfcfa 100644 --- a/site/controllers/api.php +++ b/site/controllers/api.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage api.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; /** * Sermondistributor Api Form Controller @@ -41,7 +44,7 @@ class SermondistributorControllerApi extends FormController */ protected $task; - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'preachers'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); @@ -50,20 +53,20 @@ class SermondistributorControllerApi extends FormController public function worker() { // get input values - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; // get DATA $DATA = $input->post->get('VDM_DATA', null, 'STRING'); // get TASK $TASK = $input->server->get('HTTP_VDM_TASK', null, 'STRING'); // check if correct value is given - if (SermondistributorHelper::checkString($DATA) && SermondistributorHelper::checkString($TASK)) + if (StringHelper::check($DATA) && StringHelper::check($TASK)) { // get data array $dataArray = explode('___VDM___', $DATA); // get the task $task = SermondistributorHelper::unlock($TASK); // check the array - if (SermondistributorHelper::checkArray($dataArray) && SermondistributorHelper::checkString($task)) + if (ArrayHelper::check($dataArray) && StringHelper::check($task)) { // open theQueue function if ('theQueue' === $task) @@ -72,7 +75,7 @@ class SermondistributorControllerApi extends FormController { echo 1; // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } } @@ -81,7 +84,7 @@ class SermondistributorControllerApi extends FormController // not success echo 0; // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } @@ -95,7 +98,7 @@ class SermondistributorControllerApi extends FormController foreach ($dataArray as $data) { $data = SermondistributorHelper::unlock($data); - if (SermondistributorHelper::checkArray($data) && count($data) == 3) + if (ArrayHelper::check($data) && count($data) == 3) { if (!$model->theQueue($data[0], $data[1], $data[2])) // id, target, typeID { @@ -129,13 +132,13 @@ class SermondistributorControllerApi extends FormController // not success echo 1; // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } // not success echo 0; // clear session - JFactory::getApplication()->getSession()->destroy(); + Factory::getApplication()->getSession()->destroy(); jexit(); } @@ -144,7 +147,7 @@ class SermondistributorControllerApi extends FormController // get params $params = JComponentHelper::getParams('com_sermondistributor'); // return user object - return JFactory::getUser($params->get('api', 0, 'INT')); + return Factory::getUser($params->get('api', 0, 'INT')); } /** @@ -159,13 +162,13 @@ class SermondistributorControllerApi extends FormController * * @since 12.2 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // to insure no other tampering return false; } - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -174,7 +177,7 @@ class SermondistributorControllerApi extends FormController * * @since 1.6 */ - protected function allowAdd($data = array()) + protected function allowAdd($data = []) { // to insure no other tampering return false; @@ -209,7 +212,7 @@ class SermondistributorControllerApi extends FormController * * @since 12.2 */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + protected function postSaveHook(JModelLegacy $model, $validData = []) { } } diff --git a/site/controllers/download.php b/site/controllers/download.php index 9605f049..4e451b32 100644 --- a/site/controllers/download.php +++ b/site/controllers/download.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage download.php diff --git a/site/controllers/help.php b/site/controllers/help.php index f724779f..6474ee87 100644 --- a/site/controllers/help.php +++ b/site/controllers/help.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage help.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Session\Session; use Joomla\Utilities\ArrayHelper; /** @@ -42,12 +45,12 @@ class SermondistributorControllerHelp extends BaseController public function help() { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; + $user = Factory::getUser(); + $jinput = Factory::getApplication()->input; // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && ($jinput->get($token, 0, 'ALNUM') || $token === $call_token)) { $task = $this->getTask(); switch($task){ @@ -84,8 +87,8 @@ class SermondistributorControllerHelp extends BaseController protected function getHelpDocumentText($id) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); + $db = Factory::getDbo(); + $query = $db->getQuery(true); $query->select(array('a.title','a.content')); $query->from('#__sermondistributor_help_document AS a'); $query->where('a.id = '.(int) $id); @@ -95,21 +98,21 @@ class SermondistributorControllerHelp extends BaseController $db->execute(); if($db->getNumRows()) { - $text = array(); + $text = []; $document = $db->loadObject(); // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; + $images['src="images'] = 'src="'.Uri::root().'images'; + $images["src='images"] = "src='".Uri::root()."images"; + $images['src="/images'] = 'src="'.Uri::root().'images'; + $images["src='/images"] = "src='".Uri::root()."images"; // set document template $text[] = ""; $text[] = ''; $text[] = ""; $text[] = ''; $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; + $text[] = ''; + $text[] = ''; $text[] = ""; $text[] = '
'; $text[] = '
'; diff --git a/site/helpers/category.php b/site/helpers/category.php index c7254aea..5f90d9ed 100644 --- a/site/helpers/category.php +++ b/site/helpers/category.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage category.php diff --git a/site/helpers/categorysermon.php b/site/helpers/categorysermon.php index 9c55a0d5..d92eb44c 100644 --- a/site/helpers/categorysermon.php +++ b/site/helpers/categorysermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categorysermon.php @@ -36,7 +36,7 @@ class SermondistributorSermonCategories extends JCategories * @param array $options Array of options * */ - public function __construct($options = array()) + public function __construct($options = []) { $options['table'] = '#__sermondistributor_sermon'; $options['extension'] = 'com_sermondistributor.sermon'; diff --git a/site/helpers/dropboxupdater.php b/site/helpers/dropboxupdater.php index 7788e4d1..81843d01 100644 --- a/site/helpers/dropboxupdater.php +++ b/site/helpers/dropboxupdater.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage dropboxupdater.php diff --git a/site/helpers/headercheck.php b/site/helpers/headercheck.php index a049a32a..09742471 100644 --- a/site/helpers/headercheck.php +++ b/site/helpers/headercheck.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage headercheck.php @@ -25,24 +25,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class sermondistributorHeaderCheck { + protected $document = null; + protected $app = null; + function js_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['scripts']) as $script) { if (stristr($script, $script_name)) @@ -53,24 +65,30 @@ class sermondistributorHeaderCheck return false; } - + function css_loaded($script_name) { // UIkit check point if (strpos($script_name,'uikit') !== false) { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - + if (!$this->app) + { + $this->app = Factory::getApplication(); + } + + $getTemplateName = $this->app->getTemplate('template')->template; if (strpos($getTemplateName,'yoo') !== false) { return true; } } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - + + if (!$this->document) + { + $this->document = Factory::getDocument(); + } + + $head_data = $this->document->getHeadData(); foreach (array_keys($head_data['styleSheets']) as $script) { if (stristr($script, $script_name)) diff --git a/site/helpers/route.php b/site/helpers/route.php index f48fc86a..de7a259d 100644 --- a/site/helpers/route.php +++ b/site/helpers/route.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage route.php @@ -25,6 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Categories\CategoryNode; +use Joomla\CMS\Categories\Categories; +use VDM\Joomla\Utilities\ArrayHelper; + /** * Sermondistributor Route Helper **/ @@ -57,7 +65,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.sermons'); + $categories = Categories::getInstance('sermondistributor.sermons'); $category = $categories->get($catid); if ($category) { @@ -100,7 +108,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.preachers'); + $categories = Categories::getInstance('sermondistributor.preachers'); $category = $categories->get($catid); if ($category) { @@ -143,7 +151,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.preacher'); + $categories = Categories::getInstance('sermondistributor.preacher'); $category = $categories->get($catid); if ($category) { @@ -250,7 +258,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.serieslist'); + $categories = Categories::getInstance('sermondistributor.serieslist'); $category = $categories->get($catid); if ($category) { @@ -293,7 +301,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.series'); + $categories = Categories::getInstance('sermondistributor.series'); $category = $categories->get($catid); if ($category) { @@ -336,7 +344,7 @@ abstract class SermondistributorHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('sermondistributor.api'); + $categories = Categories::getInstance('sermondistributor.api'); $category = $categories->get($catid); if ($category) { @@ -357,7 +365,7 @@ abstract class SermondistributorHelperRoute /** * Get the URL route for sermondistributor category from a category ID and language * - * @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode + * @param mixed $catid The id of the items's category either an integer id or a instance of CategoryNode * @param mixed $language The id of the language being used. * * @return string The link to the contact @@ -366,21 +374,21 @@ abstract class SermondistributorHelperRoute */ public static function getCategoryRoute_keep_for_later($catid, $language = 0) { - if ($catid instanceof JCategoryNode) + if ($catid instanceof CategoryNode) { - $id = $catid->id; - $category = $catid; + $id = $catid->id; + $category = $catid; } else - { - throw new Exception('First parameter must be JCategoryNode'); + { + throw new Exception('First parameter must be CategoryNode'); } - + $views = array( "com_sermondistributor.sermon" => "sermon"); $view = $views[$category->extension]; - - if ($id < 1 || !($category instanceof JCategoryNode)) + + if ($id < 1 || !($category instanceof CategoryNode)) { $link = ''; } @@ -388,20 +396,20 @@ abstract class SermondistributorHelperRoute { //Create the link $link = 'index.php?option=com_sermondistributor&view='.$view.'&category='.$category->slug; - + $needles = array( $view => array($id), 'category' => array($id) ); - - if ($language && $language != "*" && JLanguageMultilang::isEnabled()) + + if ($language && $language != "*" && Multilanguage::isEnabled()) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) + $db = Factory::getDbo(); + $query = $db->getQuery(true) ->select('a.sef AS sef') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); - + $db->setQuery($query); $langs = $db->loadObjectList(); foreach ($langs as $lang) @@ -413,11 +421,11 @@ abstract class SermondistributorHelperRoute } } } - + if ($item = self::_findItem($needles,'category')) { - $link .= '&Itemid='.$item; + $link .= '&Itemid='.$item; } else { @@ -443,16 +451,16 @@ abstract class SermondistributorHelperRoute protected static function _findItem($needles = null,$type = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $menus = $app->getMenu('site'); $language = isset($needles['language']) ? $needles['language'] : '*'; // Prepare the reverse lookup array. if (!isset(self::$lookup[$language])) { - self::$lookup[$language] = array(); + self::$lookup[$language] = []; - $component = JComponentHelper::getComponent('com_sermondistributor'); + $component = ComponentHelper::getComponent('com_sermondistributor'); $attributes = array('component_id'); $values = array($component->id); @@ -473,7 +481,7 @@ abstract class SermondistributorHelperRoute if (!isset(self::$lookup[$language][$view])) { - self::$lookup[$language][$view] = array(); + self::$lookup[$language][$view] = []; } if (isset($item->query['id'])) @@ -502,7 +510,7 @@ abstract class SermondistributorHelperRoute { if (isset(self::$lookup[$language][$view])) { - if (SermondistributorHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { foreach ($ids as $id) { @@ -523,7 +531,7 @@ abstract class SermondistributorHelperRoute if ($type) { // Check if the global menu item has been set. - $params = JComponentHelper::getParams('com_sermondistributor'); + $params = ComponentHelper::getParams('com_sermondistributor'); if ($item = $params->get($type.'_menu', 0)) { return $item; @@ -535,7 +543,7 @@ abstract class SermondistributorHelperRoute if ($active && $active->component == 'com_sermondistributor' - && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) + && ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) { return $active->id; } diff --git a/site/helpers/sermondistributor.php b/site/helpers/sermondistributor.php index 982e6778..13d881d0 100644 --- a/site/helpers/sermondistributor.php +++ b/site/helpers/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,12 +25,75 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// register additional namespace +\spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ]; + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // not found so move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); + +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Access\Access; +use Joomla\CMS\Access\Rules as AccessRules; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Language; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Version; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\MimeHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\FOF\Encrypt\AES; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\FormHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Sermondistributor component helper @@ -39,14 +102,14 @@ abstract class SermondistributorHelper { /** * Composer Switch - * + * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language - * + * * @var string */ public static $langTag; @@ -131,7 +194,7 @@ abstract class SermondistributorHelper // decrypt the urls $safe = new FOFEncryptAes($localkey, 128); // internal download url - $keyCounter = new stdClass; + $keyCounter = new \stdClass; $keyCounter->sermon = $sermon->id; if ($sermon->preacher) { @@ -144,7 +207,7 @@ abstract class SermondistributorHelper $keyCounterRAW = $safe->encryptString(json_encode($keyCounter)); $keyCounter = self::base64_urlencode($keyCounterRAW); $token = JSession::getFormToken(); - $downloadURL = JURI::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token; + $downloadURL = Uri::root().'index.php?option=com_sermondistributor&task=download.file&key='.$keyCounter.'&token='.$token; // check if local .htaccess should be set $setHtaccess = false; $onclick = ' onclick="sermonCounter(\''.$keyCounterRAW.'\',\'FILENAME\');"'; @@ -159,7 +222,7 @@ abstract class SermondistributorHelper if (2 == $sermon->link_type && strpos($localFolder, JPATH_ROOT) !== false) { $allowDirect = true; - $localFolderURL = JURI::root().str_replace(JPATH_ROOT, '', $localFolder); + $localFolderURL = Uri::root().str_replace(JPATH_ROOT, '', $localFolder); // insure no double // is in the URL $localFolderURL = str_replace('//', '/', $localFolderURL); $localFolderURL = str_replace(':/', '://', $localFolderURL); @@ -385,112 +448,37 @@ abstract class SermondistributorHelper } /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * @deprecated 3.3 Use FileHelper::getPath(...); + */ public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) { - // make sure to always have a string/path - if(!self::checkString($default)) - { - $default = JPATH_SITE . '/images/'; - } - // get the global settings - if (!self::checkObject(self::$params)) - { - self::$params = JComponentHelper::getParams('com_sermondistributor'); - } - $filePath = self::$params->get($target, $default); - // check the file path (revert to default only of not a hidden file path) - if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false) - { - $filePath = $default; - } - // create the folder if it does not exist - if ($createIfNotSet && !Folder::exists($filePath)) - { - Folder::create($filePath); - } - // setup the file name - $fileName = ''; - // Get basic key - $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; - if (method_exists(get_called_class(), "getCryptKey")) - { - $basickey = self::getCryptKey('basic', $basickey); - } - // check the key - if (!self::checkString($key)) - { - $key = 'vDm'; - } - // set the file name - if (self::checkString($fileType)) - { - // set the name - $fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.')); - } - else - { - $fileName = trim(md5($type.$target.$basickey.$key)) . '.txt'; - } - // return the url - if ('url' === $type) - { - if (strpos($filePath, JPATH_SITE) !== false) - { - $filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/'); - return JURI::root() . $filePath . '/' . $fileName; - } - // since the path is behind the root folder of the site, return only the root url (may be used to build the link) - return JURI::root(); - } - // sanitize the path - return '/' . trim( $filePath, '/' ) . '/' . $fileName; + // Get the file path or url + return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); } - /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * @deprecated 3.3 Use FileHelper::write(...); + */ public static function writeFile($path, $data) { - $klaar = false; - if (self::checkString($data)) - { - // open the file - $fh = fopen($path, "w"); - if (!is_resource($fh)) - { - return $klaar; - } - // write to the file - if (fwrite($fh, $data)) - { - // has been done - $klaar = true; - } - // close file. - fclose($fh); - } - return $klaar; + return FileHelper::write($path, $data); } - protected static function saveFile($data, $path_filename) { return self::writeFile($path_filename, $data); @@ -681,1101 +669,13 @@ abstract class SermondistributorHelper // get the size of the file $info['filesize'] = $db->loadResult(); // get the mime type - $info['type'] = self::mimeType($key); + $info['type'] = MimeHelper::mimeType($key); // return info return $info; } } return false; } - - /** - * File Extensions to Mimetypes - * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b - * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array - */ - protected static $fileExtensionToMimeType = array( - '123' => 'application/vnd.lotus-1-2-3', - '3dml' => 'text/vnd.in3d.3dml', - '3ds' => 'image/x-3ds', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gpp', - '7z' => 'application/x-7z-compressed', - 'aab' => 'application/x-authorware-bin', - 'aac' => 'audio/x-aac', - 'aam' => 'application/x-authorware-map', - 'aas' => 'application/x-authorware-seg', - 'abw' => 'application/x-abiword', - 'ac' => 'application/pkix-attr-cert', - 'acc' => 'application/vnd.americandynamics.acc', - 'ace' => 'application/x-ace-compressed', - 'acu' => 'application/vnd.acucobol', - 'acutc' => 'application/vnd.acucorp', - 'adp' => 'audio/adpcm', - 'aep' => 'application/vnd.audiograph', - 'afm' => 'application/x-font-type1', - 'afp' => 'application/vnd.ibm.modcap', - 'ahead' => 'application/vnd.ahead.space', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'air' => 'application/vnd.adobe.air-application-installer-package+zip', - 'ait' => 'application/vnd.dvb.ait', - 'ami' => 'application/vnd.amiga.ami', - 'apk' => 'application/vnd.android.package-archive', - 'appcache' => 'text/cache-manifest', - 'application' => 'application/x-ms-application', - 'apr' => 'application/vnd.lotus-approach', - 'arc' => 'application/x-freearc', - 'asc' => 'application/pgp-signature', - 'asf' => 'video/x-ms-asf', - 'asm' => 'text/x-asm', - 'aso' => 'application/vnd.accpac.simply.aso', - 'asx' => 'video/x-ms-asf', - 'atc' => 'application/vnd.acucorp', - 'atom' => 'application/atom+xml', - 'atomcat' => 'application/atomcat+xml', - 'atomsvc' => 'application/atomsvc+xml', - 'atx' => 'application/vnd.antix.game-component', - 'au' => 'audio/basic', - 'avi' => 'video/x-msvideo', - 'aw' => 'application/applixware', - 'azf' => 'application/vnd.airzip.filesecure.azf', - 'azs' => 'application/vnd.airzip.filesecure.azs', - 'azw' => 'application/vnd.amazon.ebook', - 'bat' => 'application/x-msdownload', - 'bcpio' => 'application/x-bcpio', - 'bdf' => 'application/x-font-bdf', - 'bdm' => 'application/vnd.syncml.dm+wbxml', - 'bed' => 'application/vnd.realvnc.bed', - 'bh2' => 'application/vnd.fujitsu.oasysprs', - 'bin' => 'application/octet-stream', - 'blb' => 'application/x-blorb', - 'blorb' => 'application/x-blorb', - 'bmi' => 'application/vnd.bmi', - 'bmp' => 'image/bmp', - 'book' => 'application/vnd.framemaker', - 'box' => 'application/vnd.previewsystems.box', - 'boz' => 'application/x-bzip2', - 'bpk' => 'application/octet-stream', - 'btif' => 'image/prs.btif', - 'bz' => 'application/x-bzip', - 'bz2' => 'application/x-bzip2', - 'c' => 'text/x-c', - 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', - 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', - 'c4d' => 'application/vnd.clonk.c4group', - 'c4f' => 'application/vnd.clonk.c4group', - 'c4g' => 'application/vnd.clonk.c4group', - 'c4p' => 'application/vnd.clonk.c4group', - 'c4u' => 'application/vnd.clonk.c4group', - 'cab' => 'application/vnd.ms-cab-compressed', - 'caf' => 'audio/x-caf', - 'cap' => 'application/vnd.tcpdump.pcap', - 'car' => 'application/vnd.curl.car', - 'cat' => 'application/vnd.ms-pki.seccat', - 'cb7' => 'application/x-cbr', - 'cba' => 'application/x-cbr', - 'cbr' => 'application/x-cbr', - 'cbt' => 'application/x-cbr', - 'cbz' => 'application/x-cbr', - 'cc' => 'text/x-c', - 'cct' => 'application/x-director', - 'ccxml' => 'application/ccxml+xml', - 'cdbcmsg' => 'application/vnd.contact.cmsg', - 'cdf' => 'application/x-netcdf', - 'cdkey' => 'application/vnd.mediastation.cdkey', - 'cdmia' => 'application/cdmi-capability', - 'cdmic' => 'application/cdmi-container', - 'cdmid' => 'application/cdmi-domain', - 'cdmio' => 'application/cdmi-object', - 'cdmiq' => 'application/cdmi-queue', - 'cdx' => 'chemical/x-cdx', - 'cdxml' => 'application/vnd.chemdraw+xml', - 'cdy' => 'application/vnd.cinderella', - 'cer' => 'application/pkix-cert', - 'cfs' => 'application/x-cfs-compressed', - 'cgm' => 'image/cgm', - 'chat' => 'application/x-chat', - 'chm' => 'application/vnd.ms-htmlhelp', - 'chrt' => 'application/vnd.kde.kchart', - 'cif' => 'chemical/x-cif', - 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', - 'cil' => 'application/vnd.ms-artgalry', - 'cla' => 'application/vnd.claymore', - 'class' => 'application/java-vm', - 'clkk' => 'application/vnd.crick.clicker.keyboard', - 'clkp' => 'application/vnd.crick.clicker.palette', - 'clkt' => 'application/vnd.crick.clicker.template', - 'clkw' => 'application/vnd.crick.clicker.wordbank', - 'clkx' => 'application/vnd.crick.clicker', - 'clp' => 'application/x-msclip', - 'cmc' => 'application/vnd.cosmocaller', - 'cmdf' => 'chemical/x-cmdf', - 'cml' => 'chemical/x-cml', - 'cmp' => 'application/vnd.yellowriver-custom-menu', - 'cmx' => 'image/x-cmx', - 'cod' => 'application/vnd.rim.cod', - 'com' => 'application/x-msdownload', - 'conf' => 'text/plain', - 'cpio' => 'application/x-cpio', - 'cpp' => 'text/x-c', - 'cpt' => 'application/mac-compactpro', - 'crd' => 'application/x-mscardfile', - 'crl' => 'application/pkix-crl', - 'crt' => 'application/x-x509-ca-cert', - 'cryptonote' => 'application/vnd.rig.cryptonote', - 'csh' => 'application/x-csh', - 'csml' => 'chemical/x-csml', - 'csp' => 'application/vnd.commonspace', - 'css' => 'text/css', - 'cst' => 'application/x-director', - 'csv' => 'text/csv', - 'cu' => 'application/cu-seeme', - 'curl' => 'text/vnd.curl', - 'cww' => 'application/prs.cww', - 'cxt' => 'application/x-director', - 'cxx' => 'text/x-c', - 'dae' => 'model/vnd.collada+xml', - 'daf' => 'application/vnd.mobius.daf', - 'dart' => 'application/vnd.dart', - 'dataless' => 'application/vnd.fdsn.seed', - 'davmount' => 'application/davmount+xml', - 'dbk' => 'application/docbook+xml', - 'dcr' => 'application/x-director', - 'dcurl' => 'text/vnd.curl.dcurl', - 'dd2' => 'application/vnd.oma.dd2+xml', - 'ddd' => 'application/vnd.fujixerox.ddd', - 'deb' => 'application/x-debian-package', - 'def' => 'text/plain', - 'deploy' => 'application/octet-stream', - 'der' => 'application/x-x509-ca-cert', - 'dfac' => 'application/vnd.dreamfactory', - 'dgc' => 'application/x-dgc-compressed', - 'dic' => 'text/x-c', - 'dir' => 'application/x-director', - 'dis' => 'application/vnd.mobius.dis', - 'dist' => 'application/octet-stream', - 'distz' => 'application/octet-stream', - 'djv' => 'image/vnd.djvu', - 'djvu' => 'image/vnd.djvu', - 'dll' => 'application/x-msdownload', - 'dmg' => 'application/x-apple-diskimage', - 'dmp' => 'application/vnd.tcpdump.pcap', - 'dms' => 'application/octet-stream', - 'dna' => 'application/vnd.dna', - 'doc' => 'application/msword', - 'docm' => 'application/vnd.ms-word.document.macroenabled.12', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot' => 'application/msword', - 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'dp' => 'application/vnd.osgi.dp', - 'dpg' => 'application/vnd.dpgraph', - 'dra' => 'audio/vnd.dra', - 'dsc' => 'text/prs.lines.tag', - 'dssc' => 'application/dssc+der', - 'dtb' => 'application/x-dtbook+xml', - 'dtd' => 'application/xml-dtd', - 'dts' => 'audio/vnd.dts', - 'dtshd' => 'audio/vnd.dts.hd', - 'dump' => 'application/octet-stream', - 'dvb' => 'video/vnd.dvb.file', - 'dvi' => 'application/x-dvi', - 'dwf' => 'model/vnd.dwf', - 'dwg' => 'image/vnd.dwg', - 'dxf' => 'image/vnd.dxf', - 'dxp' => 'application/vnd.spotfire.dxp', - 'dxr' => 'application/x-director', - 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', - 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', - 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', - 'ecma' => 'application/ecmascript', - 'edm' => 'application/vnd.novadigm.edm', - 'edx' => 'application/vnd.novadigm.edx', - 'efif' => 'application/vnd.picsel', - 'ei6' => 'application/vnd.pg.osasli', - 'elc' => 'application/octet-stream', - 'emf' => 'application/x-msmetafile', - 'eml' => 'message/rfc822', - 'emma' => 'application/emma+xml', - 'emz' => 'application/x-msmetafile', - 'eol' => 'audio/vnd.digital-winds', - 'eot' => 'application/vnd.ms-fontobject', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'es3' => 'application/vnd.eszigno3+xml', - 'esa' => 'application/vnd.osgi.subsystem', - 'esf' => 'application/vnd.epson.esf', - 'et3' => 'application/vnd.eszigno3+xml', - 'etx' => 'text/x-setext', - 'eva' => 'application/x-eva', - 'evy' => 'application/x-envoy', - 'exe' => 'application/x-msdownload', - 'exi' => 'application/exi', - 'ext' => 'application/vnd.novadigm.ext', - 'ez' => 'application/andrew-inset', - 'ez2' => 'application/vnd.ezpix-album', - 'ez3' => 'application/vnd.ezpix-package', - 'f' => 'text/x-fortran', - 'f4v' => 'video/x-f4v', - 'f77' => 'text/x-fortran', - 'f90' => 'text/x-fortran', - 'fbs' => 'image/vnd.fastbidsheet', - 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', - 'fcs' => 'application/vnd.isac.fcs', - 'fdf' => 'application/vnd.fdf', - 'fe_launch' => 'application/vnd.denovo.fcselayout-link', - 'fg5' => 'application/vnd.fujitsu.oasysgp', - 'fgd' => 'application/x-director', - 'fh' => 'image/x-freehand', - 'fh4' => 'image/x-freehand', - 'fh5' => 'image/x-freehand', - 'fh7' => 'image/x-freehand', - 'fhc' => 'image/x-freehand', - 'fig' => 'application/x-xfig', - 'flac' => 'audio/x-flac', - 'fli' => 'video/x-fli', - 'flo' => 'application/vnd.micrografx.flo', - 'flv' => 'video/x-flv', - 'flw' => 'application/vnd.kde.kivio', - 'flx' => 'text/vnd.fmi.flexstor', - 'fly' => 'text/vnd.fly', - 'fm' => 'application/vnd.framemaker', - 'fnc' => 'application/vnd.frogans.fnc', - 'for' => 'text/x-fortran', - 'fpx' => 'image/vnd.fpx', - 'frame' => 'application/vnd.framemaker', - 'fsc' => 'application/vnd.fsc.weblaunch', - 'fst' => 'image/vnd.fst', - 'ftc' => 'application/vnd.fluxtime.clip', - 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', - 'fvt' => 'video/vnd.fvt', - 'fxp' => 'application/vnd.adobe.fxp', - 'fxpl' => 'application/vnd.adobe.fxp', - 'fzs' => 'application/vnd.fuzzysheet', - 'g2w' => 'application/vnd.geoplan', - 'g3' => 'image/g3fax', - 'g3w' => 'application/vnd.geospace', - 'gac' => 'application/vnd.groove-account', - 'gam' => 'application/x-tads', - 'gbr' => 'application/rpki-ghostbusters', - 'gca' => 'application/x-gca-compressed', - 'gdl' => 'model/vnd.gdl', - 'geo' => 'application/vnd.dynageo', - 'gex' => 'application/vnd.geometry-explorer', - 'ggb' => 'application/vnd.geogebra.file', - 'ggt' => 'application/vnd.geogebra.tool', - 'ghf' => 'application/vnd.groove-help', - 'gif' => 'image/gif', - 'gim' => 'application/vnd.groove-identity-message', - 'gml' => 'application/gml+xml', - 'gmx' => 'application/vnd.gmx', - 'gnumeric' => 'application/x-gnumeric', - 'gph' => 'application/vnd.flographit', - 'gpx' => 'application/gpx+xml', - 'gqf' => 'application/vnd.grafeq', - 'gqs' => 'application/vnd.grafeq', - 'gram' => 'application/srgs', - 'gramps' => 'application/x-gramps-xml', - 'gre' => 'application/vnd.geometry-explorer', - 'grv' => 'application/vnd.groove-injector', - 'grxml' => 'application/srgs+xml', - 'gsf' => 'application/x-font-ghostscript', - 'gtar' => 'application/x-gtar', - 'gtm' => 'application/vnd.groove-tool-message', - 'gtw' => 'model/vnd.gtw', - 'gv' => 'text/vnd.graphviz', - 'gxf' => 'application/gxf', - 'gxt' => 'application/vnd.geonext', - 'h' => 'text/x-c', - 'h261' => 'video/h261', - 'h263' => 'video/h263', - 'h264' => 'video/h264', - 'hal' => 'application/vnd.hal+xml', - 'hbci' => 'application/vnd.hbci', - 'hdf' => 'application/x-hdf', - 'hh' => 'text/x-c', - 'hlp' => 'application/winhlp', - 'hpgl' => 'application/vnd.hp-hpgl', - 'hpid' => 'application/vnd.hp-hpid', - 'hps' => 'application/vnd.hp-hps', - 'hqx' => 'application/mac-binhex40', - 'htke' => 'application/vnd.kenameaapp', - 'htm' => 'text/html', - 'html' => 'text/html', - 'hvd' => 'application/vnd.yamaha.hv-dic', - 'hvp' => 'application/vnd.yamaha.hv-voice', - 'hvs' => 'application/vnd.yamaha.hv-script', - 'i2g' => 'application/vnd.intergeo', - 'icc' => 'application/vnd.iccprofile', - 'ice' => 'x-conference/x-cooltalk', - 'icm' => 'application/vnd.iccprofile', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ief' => 'image/ief', - 'ifb' => 'text/calendar', - 'ifm' => 'application/vnd.shana.informed.formdata', - 'iges' => 'model/iges', - 'igl' => 'application/vnd.igloader', - 'igm' => 'application/vnd.insors.igm', - 'igs' => 'model/iges', - 'igx' => 'application/vnd.micrografx.igx', - 'iif' => 'application/vnd.shana.informed.interchange', - 'imp' => 'application/vnd.accpac.simply.imp', - 'ims' => 'application/vnd.ms-ims', - 'in' => 'text/plain', - 'ink' => 'application/inkml+xml', - 'inkml' => 'application/inkml+xml', - 'install' => 'application/x-install-instructions', - 'iota' => 'application/vnd.astraea-software.iota', - 'ipfix' => 'application/ipfix', - 'ipk' => 'application/vnd.shana.informed.package', - 'irm' => 'application/vnd.ibm.rights-management', - 'irp' => 'application/vnd.irepository.package+xml', - 'iso' => 'application/x-iso9660-image', - 'itp' => 'application/vnd.shana.informed.formtemplate', - 'ivp' => 'application/vnd.immervision-ivp', - 'ivu' => 'application/vnd.immervision-ivu', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'jam' => 'application/vnd.jam', - 'jar' => 'application/java-archive', - 'java' => 'text/x-java-source', - 'jisp' => 'application/vnd.jisp', - 'jlt' => 'application/vnd.hp-jlyt', - 'jnlp' => 'application/x-java-jnlp-file', - 'joda' => 'application/vnd.joost.joda-archive', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'jpgm' => 'video/jpm', - 'jpgv' => 'video/jpeg', - 'jpm' => 'video/jpm', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'jsonml' => 'application/jsonml+json', - 'kar' => 'audio/midi', - 'karbon' => 'application/vnd.kde.karbon', - 'kfo' => 'application/vnd.kde.kformula', - 'kia' => 'application/vnd.kidspiration', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kne' => 'application/vnd.kinar', - 'knp' => 'application/vnd.kinar', - 'kon' => 'application/vnd.kde.kontour', - 'kpr' => 'application/vnd.kde.kpresenter', - 'kpt' => 'application/vnd.kde.kpresenter', - 'kpxx' => 'application/vnd.ds-keypoint', - 'ksp' => 'application/vnd.kde.kspread', - 'ktr' => 'application/vnd.kahootz', - 'ktx' => 'image/ktx', - 'ktz' => 'application/vnd.kahootz', - 'kwd' => 'application/vnd.kde.kword', - 'kwt' => 'application/vnd.kde.kword', - 'lasxml' => 'application/vnd.las.las+xml', - 'latex' => 'application/x-latex', - 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', - 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', - 'les' => 'application/vnd.hhe.lesson-player', - 'lha' => 'application/x-lzh-compressed', - 'link66' => 'application/vnd.route66.link66+xml', - 'list' => 'text/plain', - 'list3820' => 'application/vnd.ibm.modcap', - 'listafp' => 'application/vnd.ibm.modcap', - 'lnk' => 'application/x-ms-shortcut', - 'log' => 'text/plain', - 'lostxml' => 'application/lost+xml', - 'lrf' => 'application/octet-stream', - 'lrm' => 'application/vnd.ms-lrm', - 'ltf' => 'application/vnd.frogans.ltf', - 'lvp' => 'audio/vnd.lucent.voice', - 'lwp' => 'application/vnd.lotus-wordpro', - 'lzh' => 'application/x-lzh-compressed', - 'm13' => 'application/x-msmediaview', - 'm14' => 'application/x-msmediaview', - 'm1v' => 'video/mpeg', - 'm21' => 'application/mp21', - 'm2a' => 'audio/mpeg', - 'm2v' => 'video/mpeg', - 'm3a' => 'audio/mpeg', - 'm3u' => 'audio/x-mpegurl', - 'm3u8' => 'application/vnd.apple.mpegurl', - 'm4a' => 'audio/mp4', - 'm4u' => 'video/vnd.mpegurl', - 'm4v' => 'video/x-m4v', - 'ma' => 'application/mathematica', - 'mads' => 'application/mads+xml', - 'mag' => 'application/vnd.ecowin.chart', - 'maker' => 'application/vnd.framemaker', - 'man' => 'text/troff', - 'mar' => 'application/octet-stream', - 'mathml' => 'application/mathml+xml', - 'mb' => 'application/mathematica', - 'mbk' => 'application/vnd.mobius.mbk', - 'mbox' => 'application/mbox', - 'mc1' => 'application/vnd.medcalcdata', - 'mcd' => 'application/vnd.mcd', - 'mcurl' => 'text/vnd.curl.mcurl', - 'mdb' => 'application/x-msaccess', - 'mdi' => 'image/vnd.ms-modi', - 'me' => 'text/troff', - 'mesh' => 'model/mesh', - 'meta4' => 'application/metalink4+xml', - 'metalink' => 'application/metalink+xml', - 'mets' => 'application/mets+xml', - 'mfm' => 'application/vnd.mfmp', - 'mft' => 'application/rpki-manifest', - 'mgp' => 'application/vnd.osgeo.mapguide.package', - 'mgz' => 'application/vnd.proteus.magazine', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mie' => 'application/x-mie', - 'mif' => 'application/vnd.mif', - 'mime' => 'message/rfc822', - 'mj2' => 'video/mj2', - 'mjp2' => 'video/mj2', - 'mk3d' => 'video/x-matroska', - 'mka' => 'audio/x-matroska', - 'mks' => 'video/x-matroska', - 'mkv' => 'video/x-matroska', - 'mlp' => 'application/vnd.dolby.mlp', - 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', - 'mmf' => 'application/vnd.smaf', - 'mmr' => 'image/vnd.fujixerox.edmics-mmr', - 'mng' => 'video/x-mng', - 'mny' => 'application/x-msmoney', - 'mobi' => 'application/x-mobipocket-ebook', - 'mods' => 'application/mods+xml', - 'mov' => 'video/quicktime', - 'movie' => 'video/x-sgi-movie', - 'mp2' => 'audio/mpeg', - 'mp21' => 'application/mp21', - 'mp2a' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mp4a' => 'audio/mp4', - 'mp4s' => 'application/mp4', - 'mp4v' => 'video/mp4', - 'mpc' => 'application/vnd.mophun.certificate', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpg4' => 'video/mp4', - 'mpga' => 'audio/mpeg', - 'mpkg' => 'application/vnd.apple.installer+xml', - 'mpm' => 'application/vnd.blueice.multipass', - 'mpn' => 'application/vnd.mophun.application', - 'mpp' => 'application/vnd.ms-project', - 'mpt' => 'application/vnd.ms-project', - 'mpy' => 'application/vnd.ibm.minipay', - 'mqy' => 'application/vnd.mobius.mqy', - 'mrc' => 'application/marc', - 'mrcx' => 'application/marcxml+xml', - 'ms' => 'text/troff', - 'mscml' => 'application/mediaservercontrol+xml', - 'mseed' => 'application/vnd.fdsn.mseed', - 'mseq' => 'application/vnd.mseq', - 'msf' => 'application/vnd.epson.msf', - 'msh' => 'model/mesh', - 'msi' => 'application/x-msdownload', - 'msl' => 'application/vnd.mobius.msl', - 'msty' => 'application/vnd.muvee.style', - 'mts' => 'model/vnd.mts', - 'mus' => 'application/vnd.musician', - 'musicxml' => 'application/vnd.recordare.musicxml+xml', - 'mvb' => 'application/x-msmediaview', - 'mwf' => 'application/vnd.mfer', - 'mxf' => 'application/mxf', - 'mxl' => 'application/vnd.recordare.musicxml', - 'mxml' => 'application/xv+xml', - 'mxs' => 'application/vnd.triscape.mxs', - 'mxu' => 'video/vnd.mpegurl', - 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', - 'n3' => 'text/n3', - 'nb' => 'application/mathematica', - 'nbp' => 'application/vnd.wolfram.player', - 'nc' => 'application/x-netcdf', - 'ncx' => 'application/x-dtbncx+xml', - 'nfo' => 'text/x-nfo', - 'ngdat' => 'application/vnd.nokia.n-gage.data', - 'nitf' => 'application/vnd.nitf', - 'nlu' => 'application/vnd.neurolanguage.nlu', - 'nml' => 'application/vnd.enliven', - 'nnd' => 'application/vnd.noblenet-directory', - 'nns' => 'application/vnd.noblenet-sealer', - 'nnw' => 'application/vnd.noblenet-web', - 'npx' => 'image/vnd.net-fpx', - 'nsc' => 'application/x-conference', - 'nsf' => 'application/vnd.lotus-notes', - 'ntf' => 'application/vnd.nitf', - 'nzb' => 'application/x-nzb', - 'oa2' => 'application/vnd.fujitsu.oasys2', - 'oa3' => 'application/vnd.fujitsu.oasys3', - 'oas' => 'application/vnd.fujitsu.oasys', - 'obd' => 'application/x-msbinder', - 'obj' => 'application/x-tgif', - 'oda' => 'application/oda', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odft' => 'application/vnd.oasis.opendocument.formula-template', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'oga' => 'audio/ogg', - 'ogg' => 'audio/ogg', - 'ogv' => 'video/ogg', - 'ogx' => 'application/ogg', - 'omdoc' => 'application/omdoc+xml', - 'onepkg' => 'application/onenote', - 'onetmp' => 'application/onenote', - 'onetoc' => 'application/onenote', - 'onetoc2' => 'application/onenote', - 'opf' => 'application/oebps-package+xml', - 'opml' => 'text/x-opml', - 'oprc' => 'application/vnd.palm', - 'opus' => 'audio/ogg', - 'org' => 'application/vnd.lotus-organizer', - 'osf' => 'application/vnd.yamaha.openscoreformat', - 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', - 'otc' => 'application/vnd.oasis.opendocument.chart-template', - 'otf' => 'font/otf', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'oti' => 'application/vnd.oasis.opendocument.image-template', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'oxps' => 'application/oxps', - 'oxt' => 'application/vnd.openofficeorg.extension', - 'p' => 'text/x-pascal', - 'p10' => 'application/pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7b' => 'application/x-pkcs7-certificates', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'p8' => 'application/pkcs8', - 'pas' => 'text/x-pascal', - 'paw' => 'application/vnd.pawaafile', - 'pbd' => 'application/vnd.powerbuilder6', - 'pbm' => 'image/x-portable-bitmap', - 'pcap' => 'application/vnd.tcpdump.pcap', - 'pcf' => 'application/x-font-pcf', - 'pcl' => 'application/vnd.hp-pcl', - 'pclxl' => 'application/vnd.hp-pclxl', - 'pct' => 'image/x-pict', - 'pcurl' => 'application/vnd.curl.pcurl', - 'pcx' => 'image/x-pcx', - 'pdb' => 'application/vnd.palm', - 'pdf' => 'application/pdf', - 'pfa' => 'application/x-font-type1', - 'pfb' => 'application/x-font-type1', - 'pfm' => 'application/x-font-type1', - 'pfr' => 'application/font-tdpfr', - 'pfx' => 'application/x-pkcs12', - 'pgm' => 'image/x-portable-graymap', - 'pgn' => 'application/x-chess-pgn', - 'pgp' => 'application/pgp-encrypted', - 'pic' => 'image/x-pict', - 'pkg' => 'application/octet-stream', - 'pki' => 'application/pkixcmp', - 'pkipath' => 'application/pkix-pkipath', - 'plb' => 'application/vnd.3gpp.pic-bw-large', - 'plc' => 'application/vnd.mobius.plc', - 'plf' => 'application/vnd.pocketlearn', - 'pls' => 'application/pls+xml', - 'pml' => 'application/vnd.ctc-posml', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'portpkg' => 'application/vnd.macports.portpkg', - 'pot' => 'application/vnd.ms-powerpoint', - 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', - 'ppd' => 'application/vnd.cups-ppd', - 'ppm' => 'image/x-portable-pixmap', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppt' => 'application/vnd.ms-powerpoint', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'pqa' => 'application/vnd.palm', - 'prc' => 'application/x-mobipocket-ebook', - 'pre' => 'application/vnd.lotus-freelance', - 'prf' => 'application/pics-rules', - 'ps' => 'application/postscript', - 'psb' => 'application/vnd.3gpp.pic-bw-small', - 'psd' => 'image/vnd.adobe.photoshop', - 'psf' => 'application/x-font-linux-psf', - 'pskcxml' => 'application/pskc+xml', - 'ptid' => 'application/vnd.pvi.ptid1', - 'pub' => 'application/x-mspublisher', - 'pvb' => 'application/vnd.3gpp.pic-bw-var', - 'pwn' => 'application/vnd.3m.post-it-notes', - 'pya' => 'audio/vnd.ms-playready.media.pya', - 'pyv' => 'video/vnd.ms-playready.media.pyv', - 'qam' => 'application/vnd.epson.quickanime', - 'qbo' => 'application/vnd.intu.qbo', - 'qfx' => 'application/vnd.intu.qfx', - 'qps' => 'application/vnd.publishare-delta-tree', - 'qt' => 'video/quicktime', - 'qwd' => 'application/vnd.quark.quarkxpress', - 'qwt' => 'application/vnd.quark.quarkxpress', - 'qxb' => 'application/vnd.quark.quarkxpress', - 'qxd' => 'application/vnd.quark.quarkxpress', - 'qxl' => 'application/vnd.quark.quarkxpress', - 'qxt' => 'application/vnd.quark.quarkxpress', - 'ra' => 'audio/x-pn-realaudio', - 'ram' => 'audio/x-pn-realaudio', - 'rar' => 'application/x-rar-compressed', - 'ras' => 'image/x-cmu-raster', - 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', - 'rdf' => 'application/rdf+xml', - 'rdz' => 'application/vnd.data-vision.rdz', - 'rep' => 'application/vnd.businessobjects', - 'res' => 'application/x-dtbresource+xml', - 'rgb' => 'image/x-rgb', - 'rif' => 'application/reginfo+xml', - 'rip' => 'audio/vnd.rip', - 'ris' => 'application/x-research-info-systems', - 'rl' => 'application/resource-lists+xml', - 'rlc' => 'image/vnd.fujixerox.edmics-rlc', - 'rld' => 'application/resource-lists-diff+xml', - 'rm' => 'application/vnd.rn-realmedia', - 'rmi' => 'audio/midi', - 'rmp' => 'audio/x-pn-realaudio-plugin', - 'rms' => 'application/vnd.jcp.javame.midlet-rms', - 'rmvb' => 'application/vnd.rn-realmedia-vbr', - 'rnc' => 'application/relax-ng-compact-syntax', - 'roa' => 'application/rpki-roa', - 'roff' => 'text/troff', - 'rp9' => 'application/vnd.cloanto.rp9', - 'rpss' => 'application/vnd.nokia.radio-presets', - 'rpst' => 'application/vnd.nokia.radio-preset', - 'rq' => 'application/sparql-query', - 'rs' => 'application/rls-services+xml', - 'rsd' => 'application/rsd+xml', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'rtx' => 'text/richtext', - 's' => 'text/x-asm', - 's3m' => 'audio/s3m', - 'saf' => 'application/vnd.yamaha.smaf-audio', - 'sbml' => 'application/sbml+xml', - 'sc' => 'application/vnd.ibm.secure-container', - 'scd' => 'application/x-msschedule', - 'scm' => 'application/vnd.lotus-screencam', - 'scq' => 'application/scvp-cv-request', - 'scs' => 'application/scvp-cv-response', - 'scurl' => 'text/vnd.curl.scurl', - 'sda' => 'application/vnd.stardivision.draw', - 'sdc' => 'application/vnd.stardivision.calc', - 'sdd' => 'application/vnd.stardivision.impress', - 'sdkd' => 'application/vnd.solent.sdkm+xml', - 'sdkm' => 'application/vnd.solent.sdkm+xml', - 'sdp' => 'application/sdp', - 'sdw' => 'application/vnd.stardivision.writer', - 'see' => 'application/vnd.seemail', - 'seed' => 'application/vnd.fdsn.seed', - 'sema' => 'application/vnd.sema', - 'semd' => 'application/vnd.semd', - 'semf' => 'application/vnd.semf', - 'ser' => 'application/java-serialized-object', - 'setpay' => 'application/set-payment-initiation', - 'setreg' => 'application/set-registration-initiation', - 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', - 'sfs' => 'application/vnd.spotfire.sfs', - 'sfv' => 'text/x-sfv', - 'sgi' => 'image/sgi', - 'sgl' => 'application/vnd.stardivision.writer-global', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'sh' => 'application/x-sh', - 'shar' => 'application/x-shar', - 'shf' => 'application/shf+xml', - 'sid' => 'image/x-mrsid-image', - 'sig' => 'application/pgp-signature', - 'sil' => 'audio/silk', - 'silo' => 'model/mesh', - 'sis' => 'application/vnd.symbian.install', - 'sisx' => 'application/vnd.symbian.install', - 'sit' => 'application/x-stuffit', - 'sitx' => 'application/x-stuffitx', - 'skd' => 'application/vnd.koan', - 'skm' => 'application/vnd.koan', - 'skp' => 'application/vnd.koan', - 'skt' => 'application/vnd.koan', - 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'slt' => 'application/vnd.epson.salt', - 'sm' => 'application/vnd.stepmania.stepchart', - 'smf' => 'application/vnd.stardivision.math', - 'smi' => 'application/smil+xml', - 'smil' => 'application/smil+xml', - 'smv' => 'video/x-smv', - 'smzip' => 'application/vnd.stepmania.package', - 'snd' => 'audio/basic', - 'snf' => 'application/x-font-snf', - 'so' => 'application/octet-stream', - 'spc' => 'application/x-pkcs7-certificates', - 'spf' => 'application/vnd.yamaha.smaf-phrase', - 'spl' => 'application/x-futuresplash', - 'spot' => 'text/vnd.in3d.spot', - 'spp' => 'application/scvp-vp-response', - 'spq' => 'application/scvp-vp-request', - 'spx' => 'audio/ogg', - 'sql' => 'application/x-sql', - 'src' => 'application/x-wais-source', - 'srt' => 'application/x-subrip', - 'sru' => 'application/sru+xml', - 'srx' => 'application/sparql-results+xml', - 'ssdl' => 'application/ssdl+xml', - 'sse' => 'application/vnd.kodak-descriptor', - 'ssf' => 'application/vnd.epson.ssf', - 'ssml' => 'application/ssml+xml', - 'st' => 'application/vnd.sailingtracker.track', - 'stc' => 'application/vnd.sun.xml.calc.template', - 'std' => 'application/vnd.sun.xml.draw.template', - 'stf' => 'application/vnd.wt.stf', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'stk' => 'application/hyperstudio', - 'stl' => 'application/vnd.ms-pki.stl', - 'str' => 'application/vnd.pg.format', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sub' => 'text/vnd.dvb.subtitle', - 'sus' => 'application/vnd.sus-calendar', - 'susp' => 'application/vnd.sus-calendar', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'svc' => 'application/vnd.dvb.service', - 'svd' => 'application/vnd.svd', - 'svg' => 'image/svg+xml', - 'svgz' => 'image/svg+xml', - 'swa' => 'application/x-director', - 'swf' => 'application/x-shockwave-flash', - 'swi' => 'application/vnd.aristanetworks.swi', - 'sxc' => 'application/vnd.sun.xml.calc', - 'sxd' => 'application/vnd.sun.xml.draw', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sxm' => 'application/vnd.sun.xml.math', - 'sxw' => 'application/vnd.sun.xml.writer', - 't' => 'text/troff', - 't3' => 'application/x-t3vm-image', - 'taglet' => 'application/vnd.mynfc', - 'tao' => 'application/vnd.tao.intent-module-archive', - 'tar' => 'application/x-tar', - 'tcap' => 'application/vnd.3gpp2.tcap', - 'tcl' => 'application/x-tcl', - 'teacher' => 'application/vnd.smart.teacher', - 'tei' => 'application/tei+xml', - 'teicorpus' => 'application/tei+xml', - 'tex' => 'application/x-tex', - 'texi' => 'application/x-texinfo', - 'texinfo' => 'application/x-texinfo', - 'text' => 'text/plain', - 'tfi' => 'application/thraud+xml', - 'tfm' => 'application/x-tex-tfm', - 'tga' => 'image/x-tga', - 'thmx' => 'application/vnd.ms-officetheme', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'tmo' => 'application/vnd.tmobile-livetv', - 'torrent' => 'application/x-bittorrent', - 'tpl' => 'application/vnd.groove-tool-template', - 'tpt' => 'application/vnd.trid.tpt', - 'tr' => 'text/troff', - 'tra' => 'application/vnd.trueapp', - 'trm' => 'application/x-msterminal', - 'tsd' => 'application/timestamped-data', - 'tsv' => 'text/tab-separated-values', - 'ttc' => 'font/collection', - 'ttf' => 'font/ttf', - 'ttl' => 'text/turtle', - 'twd' => 'application/vnd.simtech-mindmapper', - 'twds' => 'application/vnd.simtech-mindmapper', - 'txd' => 'application/vnd.genomatix.tuxedo', - 'txf' => 'application/vnd.mobius.txf', - 'txt' => 'text/plain', - 'u32' => 'application/x-authorware-bin', - 'udeb' => 'application/x-debian-package', - 'ufd' => 'application/vnd.ufdl', - 'ufdl' => 'application/vnd.ufdl', - 'ulx' => 'application/x-glulx', - 'umj' => 'application/vnd.umajin', - 'unityweb' => 'application/vnd.unity', - 'uoml' => 'application/vnd.uoml+xml', - 'uri' => 'text/uri-list', - 'uris' => 'text/uri-list', - 'urls' => 'text/uri-list', - 'ustar' => 'application/x-ustar', - 'utz' => 'application/vnd.uiq.theme', - 'uu' => 'text/x-uuencode', - 'uva' => 'audio/vnd.dece.audio', - 'uvd' => 'application/vnd.dece.data', - 'uvf' => 'application/vnd.dece.data', - 'uvg' => 'image/vnd.dece.graphic', - 'uvh' => 'video/vnd.dece.hd', - 'uvi' => 'image/vnd.dece.graphic', - 'uvm' => 'video/vnd.dece.mobile', - 'uvp' => 'video/vnd.dece.pd', - 'uvs' => 'video/vnd.dece.sd', - 'uvt' => 'application/vnd.dece.ttml+xml', - 'uvu' => 'video/vnd.uvvu.mp4', - 'uvv' => 'video/vnd.dece.video', - 'uvva' => 'audio/vnd.dece.audio', - 'uvvd' => 'application/vnd.dece.data', - 'uvvf' => 'application/vnd.dece.data', - 'uvvg' => 'image/vnd.dece.graphic', - 'uvvh' => 'video/vnd.dece.hd', - 'uvvi' => 'image/vnd.dece.graphic', - 'uvvm' => 'video/vnd.dece.mobile', - 'uvvp' => 'video/vnd.dece.pd', - 'uvvs' => 'video/vnd.dece.sd', - 'uvvt' => 'application/vnd.dece.ttml+xml', - 'uvvu' => 'video/vnd.uvvu.mp4', - 'uvvv' => 'video/vnd.dece.video', - 'uvvx' => 'application/vnd.dece.unspecified', - 'uvvz' => 'application/vnd.dece.zip', - 'uvx' => 'application/vnd.dece.unspecified', - 'uvz' => 'application/vnd.dece.zip', - 'vcard' => 'text/vcard', - 'vcd' => 'application/x-cdlink', - 'vcf' => 'text/x-vcard', - 'vcg' => 'application/vnd.groove-vcard', - 'vcs' => 'text/x-vcalendar', - 'vcx' => 'application/vnd.vcx', - 'vis' => 'application/vnd.visionary', - 'viv' => 'video/vnd.vivo', - 'vob' => 'video/x-ms-vob', - 'vor' => 'application/vnd.stardivision.writer', - 'vox' => 'application/x-authorware-bin', - 'vrml' => 'model/vrml', - 'vsd' => 'application/vnd.visio', - 'vsf' => 'application/vnd.vsf', - 'vss' => 'application/vnd.visio', - 'vst' => 'application/vnd.visio', - 'vsw' => 'application/vnd.visio', - 'vtu' => 'model/vnd.vtu', - 'vxml' => 'application/voicexml+xml', - 'w3d' => 'application/x-director', - 'wad' => 'application/x-doom', - 'wav' => 'audio/x-wav', - 'wax' => 'audio/x-ms-wax', - 'wbmp' => 'image/vnd.wap.wbmp', - 'wbs' => 'application/vnd.criticaltools.wbs+xml', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wcm' => 'application/vnd.ms-works', - 'wdb' => 'application/vnd.ms-works', - 'wdp' => 'image/vnd.ms-photo', - 'weba' => 'audio/webm', - 'webm' => 'video/webm', - 'webp' => 'image/webp', - 'wg' => 'application/vnd.pmi.widget', - 'wgt' => 'application/widget', - 'wks' => 'application/vnd.ms-works', - 'wm' => 'video/x-ms-wm', - 'wma' => 'audio/x-ms-wma', - 'wmd' => 'application/x-ms-wmd', - 'wmf' => 'application/x-msmetafile', - 'wml' => 'text/vnd.wap.wml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmls' => 'text/vnd.wap.wmlscript', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'wmv' => 'video/x-ms-wmv', - 'wmx' => 'video/x-ms-wmx', - 'wmz' => 'application/x-msmetafile', - 'woff' => 'font/woff', - 'woff2' => 'font/woff2', - 'wpd' => 'application/vnd.wordperfect', - 'wpl' => 'application/vnd.ms-wpl', - 'wps' => 'application/vnd.ms-works', - 'wqd' => 'application/vnd.wqd', - 'wri' => 'application/x-mswrite', - 'wrl' => 'model/vrml', - 'wsdl' => 'application/wsdl+xml', - 'wspolicy' => 'application/wspolicy+xml', - 'wtb' => 'application/vnd.webturbo', - 'wvx' => 'video/x-ms-wvx', - 'x32' => 'application/x-authorware-bin', - 'x3d' => 'model/x3d+xml', - 'x3db' => 'model/x3d+binary', - 'x3dbz' => 'model/x3d+binary', - 'x3dv' => 'model/x3d+vrml', - 'x3dvz' => 'model/x3d+vrml', - 'x3dz' => 'model/x3d+xml', - 'xaml' => 'application/xaml+xml', - 'xap' => 'application/x-silverlight-app', - 'xar' => 'application/vnd.xara', - 'xbap' => 'application/x-ms-xbap', - 'xbd' => 'application/vnd.fujixerox.docuworks.binder', - 'xbm' => 'image/x-xbitmap', - 'xdf' => 'application/xcap-diff+xml', - 'xdm' => 'application/vnd.syncml.dm+xml', - 'xdp' => 'application/vnd.adobe.xdp+xml', - 'xdssc' => 'application/dssc+xml', - 'xdw' => 'application/vnd.fujixerox.docuworks', - 'xenc' => 'application/xenc+xml', - 'xer' => 'application/patch-ops-error+xml', - 'xfdf' => 'application/vnd.adobe.xfdf', - 'xfdl' => 'application/vnd.xfdl', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xhvml' => 'application/xv+xml', - 'xif' => 'image/vnd.xiff', - 'xla' => 'application/vnd.ms-excel', - 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', - 'xlc' => 'application/vnd.ms-excel', - 'xlf' => 'application/x-xliff+xml', - 'xlm' => 'application/vnd.ms-excel', - 'xls' => 'application/vnd.ms-excel', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xlt' => 'application/vnd.ms-excel', - 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlw' => 'application/vnd.ms-excel', - 'xm' => 'audio/xm', - 'xml' => 'application/xml', - 'xo' => 'application/vnd.olpc-sugar', - 'xop' => 'application/xop+xml', - 'xpi' => 'application/x-xpinstall', - 'xpl' => 'application/xproc+xml', - 'xpm' => 'image/x-xpixmap', - 'xpr' => 'application/vnd.is-xpr', - 'xps' => 'application/vnd.ms-xpsdocument', - 'xpw' => 'application/vnd.intercon.formnet', - 'xpx' => 'application/vnd.intercon.formnet', - 'xsl' => 'application/xml', - 'xslt' => 'application/xslt+xml', - 'xsm' => 'application/vnd.syncml+xml', - 'xspf' => 'application/xspf+xml', - 'xul' => 'application/vnd.mozilla.xul+xml', - 'xvm' => 'application/xv+xml', - 'xvml' => 'application/xv+xml', - 'xwd' => 'image/x-xwindowdump', - 'xyz' => 'chemical/x-xyz', - 'xz' => 'application/x-xz', - 'yang' => 'application/yang', - 'yin' => 'application/yin+xml', - 'z1' => 'application/x-zmachine', - 'z2' => 'application/x-zmachine', - 'z3' => 'application/x-zmachine', - 'z4' => 'application/x-zmachine', - 'z5' => 'application/x-zmachine', - 'z6' => 'application/x-zmachine', - 'z7' => 'application/x-zmachine', - 'z8' => 'application/x-zmachine', - 'zaz' => 'application/vnd.zzazz.deck+xml', - 'zip' => 'application/zip', - 'zir' => 'application/vnd.zul', - 'zirz' => 'application/vnd.zul', - 'zmm' => 'application/vnd.handheld-entertainment+xml' - ); - - /** - * Get the mime type based on file extension - * - * @param string $file The file name or path - * - * @return string the mime type on success - * - */ - public static function mimeType($file) - { - /** - * **DISCLAIMER** - * This will just match the file extension to the following - * array. It does not guarantee that the file is TRULY that - * of the extension that this function returns. - * https://gist.github.com/Llewellynvdm/74be373357e131b8775a7582c3de508b - */ - - // get the extension form file - $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION)); - // check if we have the extension listed - if (isset(self::$fileExtensionToMimeType[$extension])) - { - return self::$fileExtensionToMimeType[$extension]; - } - elseif (function_exists('mime_content_type')) - { - return mime_content_type($file); - } - elseif (function_exists('finfo_open')) - { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $file); - finfo_close($finfo); - return $mimetype; - } - return 'application/octet-stream'; - } - - /** - * Get the file extensions - * - * @param string $target The targeted/filter option - * @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used) - * - * @return array All the extensions (targeted & sorted) - * - */ - public static function getFileExtensions($target = null, $sorted = false) - { - // we have some in-house grouping/filters :) - $filters = array( - 'image' => array('image', 'font', 'model'), - 'document' => array('application', 'text', 'chemical', 'message'), - 'media' => array('video', 'audio'), - 'file' => array('image', 'application', 'text', 'video', 'audio'), - 'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference') - ); - // sould we filter - if ($target) - { - // the bucket to get extensions - $fileextensions = array(); - // check if filter exist (if not return empty array) - if (isset($filters[$target])) - { - foreach (self::$fileExtensionToMimeType as $extension => $mimetype) - { - // get the key mime type - $mimearr = explode("/", $mimetype, 2); - // check if this file extension should be added - if (in_array($mimearr[0], $filters[$target])) - { - if ($sorted) - { - if (!isset($fileextensions[$mimearr[0]])) - { - $fileextensions[$mimearr[0]] = array(); - } - $fileextensions[$mimearr[0]][$extension] = $extension; - } - else - { - $fileextensions[$extension] = $extension; - } - } - } - } - return $fileextensions; - } - // we just return all file extensions - return array_keys(self::$fileExtensionToMimeType); - } protected static function getDownloadFileName(&$sermon, $file, $type) { @@ -2214,44 +1114,48 @@ abstract class SermondistributorHelper /** - * Workers to load tasks - * - * @var array - */ - protected static $worker = array(); + * Workers to load tasks + * + * @var array + * @since 3.1 + */ + protected static array $worker = []; /** - * Set a worker dynamic URLs - * - * @var array - */ - protected static $workerURL = array(); + * Set a worker dynamic URLs + * + * @var array + * @since 3.1 + */ + protected static array $workerURL = []; /** - * Set a worker dynamic HEADERs - * - * @var array - */ - protected static $workerHEADER = array(); + * Set a worker dynamic HEADERs + * + * @var array + * @since 3.1 + */ + protected static array $workerHEADER = []; /** - * Curl Error Notice - * - * @var bool - */ - protected static $curlErrorLoaded = false; + * Curl Error Notice + * + * @var bool + * @since 3.1 + */ + protected static bool $curlErrorLoaded = false; /** - * check if a worker has more work - * - * @param string $function The function to target to perform the task - * - * @return bool - * - */ - public static function hasWork(&$function) + * check if a worker has more work + * + * @param string $function The function to target to perform the task + * + * @return bool + * @since 3.1 + */ + public static function hasWork(string $function): bool { - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { return count( (array) self::$worker[$function]); } @@ -2259,18 +1163,18 @@ abstract class SermondistributorHelper } /** - * Set a worker url - * - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * - * @return void - * - */ - public static function setWorkerUrl(&$function, &$url) + * Set a worker url + * + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * + * @return void + * @since 3.1 + */ + public static function setWorkerUrl(string $function, string $url): void { // set the URL if found - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure task function url is up self::$workerURL[$function] = $url; @@ -2278,18 +1182,18 @@ abstract class SermondistributorHelper } /** - * Set a worker headers - * - * @param string $function The function to target to perform the task - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorkerHeaders(&$function, &$headers) + * Set a worker headers + * + * @param string $function The function to target to perform the task + * @param array|null $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorkerHeaders(string $function, ?array $headers): void { // set the Headers if found - if (self::checkArray($headers)) + if (UtilitiesArrayHelper::check($headers)) { // make sure task function headers are set self::$workerHEADER[$function] = $headers; @@ -2297,30 +1201,33 @@ abstract class SermondistributorHelper } /** - * Set a worker that needs to perform a task - * - * @param mixed $data The data to pass to the task - * @param string $function The function to target to perform the task - * @param string $url The url of where the task is to be performed - * @param array $headers The headers needed for these workers/function - * - * @return void - * - */ - public static function setWorker($data, $function, $url = null, $headers = null) + * Set a worker that needs to perform a task + * + * @param mixed $data The data to pass to the task + * @param string $function The function to target to perform the task + * @param string $url The url of where the task is to be performed + * @param array $headers The headers needed for these workers/function + * + * @return void + * @since 3.1 + */ + public static function setWorker($data, string $function, ?string $url = null, ?array $headers = null) { // make sure task function is up if (!isset(self::$worker[$function])) { - self::$worker[$function] = array(); + self::$worker[$function] = []; } + // load the task self::$worker[$function][] = self::lock($data); + // set the Headers if found if ($headers && !isset(self::$workerHEADER[$function])) { self::setWorkerHeaders($function, $headers); } + // set the URL if found if ($url && !isset(self::$workerURL[$function])) { @@ -2329,24 +1236,24 @@ abstract class SermondistributorHelper } /** - * Run set Workers - * - * @param string $function The function to target to perform the task - * @param string $perTask The amount of task per worker - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ - public static function runWorker($function, $perTask = 50, $callback = null, $threadSize = 20) + * Run set Workers + * + * @param string $function The function to target to perform the task + * @param string $perTask The amount of task per worker + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ + public static function runWorker(string $function, $perTask = 50, $callback = null, $threadSize = 20): bool { // set task $task = self::lock($function); // build headers $headers = array('VDM-TASK: ' .$task); // build dynamic headers - if (isset(self::$workerHEADER[$function]) && self::checkArray(self::$workerHEADER[$function])) + if (isset(self::$workerHEADER[$function]) && UtilitiesArrayHelper::check(self::$workerHEADER[$function])) { foreach (self::$workerHEADER[$function] as $header) { @@ -2356,7 +1263,7 @@ abstract class SermondistributorHelper // build worker options $options = array(); // make sure worker is up - if (isset(self::$worker[$function]) && self::checkArray(self::$worker[$function])) + if (isset(self::$worker[$function]) && UtilitiesArrayHelper::check(self::$worker[$function])) { // this load method is for each if (1 == $perTask) @@ -2385,7 +1292,7 @@ abstract class SermondistributorHelper self::$worker[$function] = array(); } // do the execution - if (self::checkArray($options)) + if (UtilitiesArrayHelper::check($options)) { if (isset(self::$workerURL[$function])) { @@ -2393,7 +1300,7 @@ abstract class SermondistributorHelper } else { - $url = JURI::root() . '/index.php?option=com_sermondistributor&task=api.worker'; + $url = Uri::root() . '/index.php?option=com_sermondistributor&task=api.worker'; } return self::curlMultiExec($url, $options, $callback, $threadSize); } @@ -2401,16 +1308,16 @@ abstract class SermondistributorHelper } /** - * Do a multi curl execution of tasks - * - * @param string $url The url of where the task is to be performed - * @param array $_options The array of curl options/headers to set - * @param function $callback The option to do a call back when task is completed - * @param int $threadSize The size of the thread - * - * @return bool true On success - * - */ + * Do a multi curl execution of tasks + * + * @param string $url The url of where the task is to be performed + * @param array $_options The array of curl options/headers to set + * @param function $callback The option to do a call back when task is completed + * @param int $threadSize The size of the thread + * + * @return bool true On success + * @since 3.1 + */ public static function curlMultiExec(&$url, &$_options, $callback = null, $threadSize = 20) { // make sure we have curl available @@ -2419,14 +1326,14 @@ abstract class SermondistributorHelper if (!self::$curlErrorLoaded) { // set the notice - JFactory::getApplication()->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BSERMONDISTRIBUTORB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); // load the notice only once self::$curlErrorLoaded = true; } return false; } // make sure we have an url - if (self::checkString($url)) + if (UtilitiesStringHelper::check($url)) { // make sure the thread size isn't greater than the # of _options $threadSize = (count($_options) < $threadSize) ? count($_options) : $threadSize; @@ -2500,42 +1407,45 @@ abstract class SermondistributorHelper } /** - * the locker - * - * @var array - **/ - protected static $locker = array(); + * the locker + * + * @var array + * @since 3.1 + */ + protected static array $locker = []; /** - * the dynamic replacement salt - * - * @var array - **/ - protected static $globalSalt = array(); + * the dynamic replacement salt + * + * @var array + * @since 3.1 + */ + protected static array $globalSalt = []; /** - * the timer - * - * @var object - **/ + * the timer + * + * @var object + * @since 3.1 + */ protected static $keytimer; /** - * To Lock string - * - * @param string $string The string/array to lock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url encoding - * - * @return string Encrypted String - * - **/ - public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To Lock string + * + * @param string $string The string/array to lock + * @param string|null $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int|null $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String + * @since 3.1 + */ + public static function lock(string $string, ?string $key = null, int $salt = 2, ?int $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -2559,12 +1469,12 @@ abstract class SermondistributorHelper $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // convert array or object to string - if (self::checkArray($string) || self::checkObject($string)) + if (UtilitiesArrayHelper::check($string) || ObjectHelper::check($string)) { $string = serialize($string); } @@ -2577,21 +1487,21 @@ abstract class SermondistributorHelper } /** - * To un-Lock string - * - * @param string $string The string to unlock - * @param string $key The custom key to use - * @param int $salt The switch to add salt and type of salt - * @param int $dynamic The dynamic replacement array of salt build string - * @param int $urlencode The switch to control url decoding - * - * @return string Decrypted String - * - **/ - public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String + * @since 3.1 + */ + public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true): string { // get the global settings - if (!$key || !self::checkString($key)) + if (!$key || !UtilitiesStringHelper::check($key)) { // set temp timer $timer = 2; @@ -2615,9 +1525,9 @@ abstract class SermondistributorHelper $key .= self::salt($salt, $dynamic); } // get the locker settings - if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + if (!isset(self::$locker[$key]) || !ObjectHelper::check(self::$locker[$key])) { - self::$locker[$key] = new FOFEncryptAes($key, 128); + self::$locker[$key] = new AES($key, 128); } // make sure we have real base64 if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) @@ -2634,24 +1544,25 @@ abstract class SermondistributorHelper $string = unserialize($string); } } + return $string; } /** - * The Salt - * - * @param int $type The type of length the salt should be valid - * @param int $dynamic The dynamic replacement array of salt build string - * - * @return string - * - **/ - public static function salt($type = 1, $dynamic = null) + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string + * @since 3.1 + */ + public static function salt(int $type = 1, $dynamic = null): string { // get dynamic replacement salt $dynamic = self::getDynamicSalt($dynamic); // get the key timer - if (!self::checkObject(self::$keytimer)) + if (!ObjectHelper::check(self::$keytimer)) { // load the date time object self::$keytimer = new DateTime; @@ -2681,7 +1592,7 @@ abstract class SermondistributorHelper $format = 'Y-m-d \o\n H:' . self::periodFix(self::$keytimer->format('i')); } // get key - if (self::checkArray($dynamic)) + if (UtilitiesArrayHelper::check($dynamic)) { return md5(str_replace(array_keys($dynamic), array_values($dynamic), self::$keytimer->format($format) . ' @ VDM.I0')); } @@ -2689,35 +1600,37 @@ abstract class SermondistributorHelper } /** - * The function to insure the salt is valid within the given period (third try) - * - * @param int $main The main number - */ - protected static function periodFix($main) + * The function to insure the salt is valid within the given period (third try) + * + * @param int $main The main number + * @since 3.1 + */ + protected static function periodFix(int $main): int { return round($main / 3) * 3; } /** - * Check if a string is serialized - * - * @param string $string - * - * @return Boolean - * - */ - public static function is_serial($string) + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * @since 3.1 + */ + public static function is_serial(string $string): bool { return (@unserialize($string) !== false); } /** - * Get dynamic replacement salt - */ + * Get dynamic replacement salt + * @since 3.1 + */ public static function getDynamicSalt($dynamic = null) { // load global if not manually set - if (!self::checkArray($dynamic)) + if (!UtilitiesArrayHelper::check($dynamic)) { return self::getGlobalSalt(); } @@ -2729,8 +1642,9 @@ abstract class SermondistributorHelper } /** - * The random or dynamic secret salt - */ + * The random or dynamic secret salt + * @since 3.1 + */ public static function getSecretSalt($string = null, $size = 9) { // set the string @@ -2740,7 +1654,7 @@ abstract class SermondistributorHelper $string = self::randomkey($size); } // convert string to array - $string = self::safeString($string); + $string = UtilitiesStringHelper::safe($string); // convert string to array $array = str_split($string); // insure only unique values are used @@ -2752,24 +1666,25 @@ abstract class SermondistributorHelper } /** - * Get global replacement salt - */ + * Get global replacement salt + * @since 3.1 + */ public static function getGlobalSalt() { // load from memory if found - if (!self::checkArray(self::$globalSalt)) + if (!UtilitiesArrayHelper::check(self::$globalSalt)) { // get the global settings - if (!self::checkObject(self::$params)) + if (!ObjectHelper::check(self::$params)) { - self::$params = JComponentHelper::getParams('com_sermondistributor'); + self::$params = ComponentHelper::getParams('com_sermondistributor'); } // check if we have a global dynamic replacement array available (format --> ' 1->!,3->E,4->A') $tmp = self::$params->get('dynamic_salt', null); - if (self::checkString($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) + if (UtilitiesStringHelper::check($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) { $salt = array_map('trim', (array) explode(',', $tmp)); - if (self::checkArray($salt )) + if (UtilitiesArrayHelper::check($salt )) { foreach($salt as $replace) { @@ -2783,7 +1698,7 @@ abstract class SermondistributorHelper } } // return global if found - if (self::checkArray(self::$globalSalt)) + if (UtilitiesArrayHelper::check(self::$globalSalt)) { return self::$globalSalt; } @@ -2792,8 +1707,9 @@ abstract class SermondistributorHelper } /** - * Close public protocol - */ + * Close public protocol + * @since 3.1 + */ public static function closePublicProtocol($id, $public) { // get secret salt @@ -2819,8 +1735,9 @@ abstract class SermondistributorHelper } /** - * Open public protocol - */ + * Open public protocol + * @since 3.1 + */ public static function openPublicProtocol($SECRET, $ID, $PUBLIC) { // get secret salt @@ -2852,7 +1769,7 @@ abstract class SermondistributorHelper if (!isset(self::$composer[$target])) { // get the function name - $functionName = self::safeString('compose' . $target); + $functionName = UtilitiesStringHelper::safe('compose' . $target); // check if method exist if (method_exists(__CLASS__, $functionName)) { @@ -2864,54 +1781,22 @@ abstract class SermondistributorHelper } /** - * Convert it into a string + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * @deprecated 3.3 Use JsonHelper::string(...); */ public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; + return JsonHelper::string( + $value, + $sperator, + $table, + $id, + $name + ); } /** @@ -2925,7 +1810,7 @@ abstract class SermondistributorHelper /** * Joomla version object - */ + */ protected static $JVersion; /** @@ -2934,9 +1819,9 @@ abstract class SermondistributorHelper public static function jVersion() { // check if set - if (!self::checkObject(self::$JVersion)) + if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -2947,9 +1832,9 @@ abstract class SermondistributorHelper public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_sermondistributor'); + $params = ComponentHelper::getParams('com_sermondistributor'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) @@ -2958,22 +1843,22 @@ abstract class SermondistributorHelper { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } - elseif($params->get("useContributor".$nr) == 2) - { + elseif($params->get("useContributor".$nr) == 2) + { $link_front = ''; $link_back = ''; } - else - { + else + { $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -2984,9 +1869,9 @@ abstract class SermondistributorHelper **/ public static function getHelpUrl($view) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $groups = $user->get('groups'); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); $query->from('#__sermondistributor_help_document AS a'); @@ -2998,7 +1883,7 @@ abstract class SermondistributorHelper if($db->getNumRows()) { $helps = $db->loadObjectList(); - if (self::checkArray($helps)) + if (UtilitiesArrayHelper::check($helps)) { foreach ($helps as $nr => $help) { @@ -3039,7 +1924,7 @@ abstract class SermondistributorHelper **/ protected static function loadArticleLink($id) { - return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; + return Uri::root() . 'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; } /** @@ -3047,29 +1932,29 @@ abstract class SermondistributorHelper **/ protected static function loadHelpTextLink($id) { - $token = JSession::getFormToken(); - return 'index.php?option=com_sermondistributor&task=help.getText&id=' . (int) $id . '&token=' . $token; + $token = Session::getFormToken(); + return 'index.php?option=com_sermondistributor&task=help.getText&id=' . (int) $id . '&' . $token . '=1'; } /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = 'Sermondistributor', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = 'Sermondistributor', $config = []) { // fix the name - $name = self::safeString($name); + $name = UtilitiesStringHelper::safe($name); // full path to models $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + BaseDatabaseModel::addIncludePath($fullPathModels, $Component . 'Model'); // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + if (!isset($config['table_path']) || !UtilitiesStringHelper::check($config['table_path'])) { // This is the JCB default path to tables in Joomla 3.x $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; } // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + $model = BaseDatabaseModel::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { @@ -3104,14 +1989,14 @@ abstract class SermondistributorHelper */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_sermondistributor'); - + $parentId = $parent->id; $name = 'com_sermondistributor.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -3135,14 +2020,14 @@ abstract class SermondistributorHelper $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_sermondistributor', $table, $inherit); - if ($rules instanceof JAccessRules) + if ($rules instanceof AccessRules) { $asset->rules = (string) $rules; } if (!$asset->check() || !$asset->store()) { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + Factory::getApplication()->enqueueMessage($asset->getError(), 'warning'); return false; } else @@ -3155,7 +2040,7 @@ abstract class SermondistributorHelper $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__sermondistributor_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__sermondistributor_'.$table, $object, 'id'); } } return false; @@ -3172,7 +2057,7 @@ abstract class SermondistributorHelper if (!$inherit) { // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) @@ -3187,8 +2072,8 @@ abstract class SermondistributorHelper } } // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) + $result = Access::getAssetRules($assetId); + if ($result instanceof AccessRules) { $_result = (string) $result; $_result = json_decode($_result); @@ -3203,7 +2088,7 @@ abstract class SermondistributorHelper elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -3211,8 +2096,8 @@ abstract class SermondistributorHelper { $_result = json_encode($_result); $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); + // Instantiate and return the AccessRules object for the asset rules. + $rules = new AccessRules($_result); // return filtered rules return $rules; } @@ -3226,35 +2111,12 @@ abstract class SermondistributorHelper * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::append($xml, $node); */ public static function xmlAppend(&$xml, $node) { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } + FormHelper::append($xml, $node); } /** @@ -3263,16 +2125,12 @@ abstract class SermondistributorHelper * @param SimpleXMLElement $xml The XML element reference in which to inject a comment * @param string $comment The comment to inject * - * @return null - * + * @return void + * @deprecated 3.3 Use FormHelper::comment($xml, $comment); */ public static function xmlComment(&$xml, $comment) { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); + FormHelper::comment($xml, $comment); } /** @@ -3282,14 +2140,11 @@ abstract class SermondistributorHelper * @param array $attributes The attributes to apply to the XML element * * @return null - * + * @deprecated 3.3 Use FormHelper::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } + FormHelper::attributes($xml, $attributes); } /** @@ -3299,16 +2154,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return void - * + * @deprecated 3.3 Use FormHelper::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } + FormHelper::options($xml, $options); } /** @@ -3319,28 +2169,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::field($attributes, $default, $options); */ public static function getFieldObject(&$attributes, $default = '', $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; + return FormHelper::field($attributes, $default, $options); } /** @@ -3350,27 +2183,11 @@ abstract class SermondistributorHelper * @param array $options The options to apply to the XML element * * @return object - * + * @deprecated 3.3 Use FormHelper::xml($attributes, $options); */ public static function getFieldXML(&$attributes, $options = null) { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; + return FormHelper::xml($attributes, $options); } /** @@ -3394,17 +2211,17 @@ abstract class SermondistributorHelper // button attributes $buttonAttributes = array( 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'name' => isset($args[0]) ? UtilitiesStringHelper::html($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? UtilitiesStringHelper::safe(UtilitiesStringHelper::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); // set the button options $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + '1' => isset($args[3]) ? UtilitiesStringHelper::html($args[3]) : 'JYES', + '0' => isset($args[4]) ? UtilitiesStringHelper::html($args[4]) : 'JNO'); // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + return FormHelper::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } /** @@ -3477,7 +2294,7 @@ abstract class SermondistributorHelper if (strpos($content,'class="uk-') !== false) { // reset - $temp = array(); + $temp = []; foreach (self::$uk_components as $looking => $add) { if (strpos($content,$looking) !== false) @@ -3491,10 +2308,10 @@ abstract class SermondistributorHelper self::$uikit = true; } // sorter - if (self::checkArray($temp)) + if (UtilitiesArrayHelper::check($temp)) { // merger - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { $newTemp = array_merge($temp,$classes); $temp = array_unique($newTemp); @@ -3502,7 +2319,7 @@ abstract class SermondistributorHelper return $temp; } } - if (self::checkArray($classes)) + if (UtilitiesArrayHelper::check($classes)) { return $classes; } @@ -3510,7 +2327,7 @@ abstract class SermondistributorHelper } /** - * Get a variable + * Get a variable * * @param string $table The table from which to get the variable * @param string $where The value where @@ -3520,46 +2337,18 @@ abstract class SermondistributorHelper * @param string $main The component in which the table is found * * @return mix string/int/float - * + * @deprecated 3.3 Use GetHelper::var(...); */ public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'sermondistributor') { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; + return GetHelper::var( + $table, + $where, + $whereString, + $what, + $operator, + $main + ); } /** @@ -3574,63 +2363,20 @@ abstract class SermondistributorHelper * @param bool $unique The switch to return a unique array * * @return array - * + * @deprecated 3.3 Use GetHelper::vars(...); */ public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'sermondistributor', $unique = true) { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; - } + return GetHelper::vars( + $table, + $where, + $whereString, + $what, + $operator, + $main, + $unique + ); + } public static function isPublished($id,$type) { @@ -3638,7 +2384,7 @@ abstract class SermondistributorHelper { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__sermondistributor_'.$type.' AS a'); @@ -3656,7 +2402,7 @@ abstract class SermondistributorHelper public static function getGroupName($id) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('a.title')); $query->from('#__usergroups AS a'); @@ -3681,39 +2427,39 @@ abstract class SermondistributorHelper * @param string $component The target component * @param object $user The user whose permissions we are loading * - * @return object The JObject of permission/authorised actions - * + * @return object The CMSObject of permission/authorised actions + * */ public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor', $user = 'null') { // load the user if not given - if (!self::checkObject($user)) + if (!ObjectHelper::check($user)) { // get the user object - $user = JFactory::getUser(); + $user = Factory::getUser(); } - // load the JObject - $result = new JObject; + // load the CMSObject + $result = new CMSObject; // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) + $view = UtilitiesStringHelper::safe($view); + if (UtilitiesStringHelper::check($views)) { - $views = self::safeString($views); - } + $views = UtilitiesStringHelper::safe($views); + } // get all actions from component - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', "/access/section[@name='component']/" ); - // if non found then return empty JObject + // if non found then return empty CMSObject if (empty($actions)) { return $result; } // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + if (ObjectHelper::check($record) && !isset($record->created_by) && isset($record->id)) { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + $record->created_by = GetHelper::var($view, $record->id, 'id', 'created_by', '=', $component); } // set actions only set in component settings $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); @@ -3722,12 +2468,12 @@ abstract class SermondistributorHelper if ($target) { // convert to an array - if (self::checkString($target)) + if (UtilitiesStringHelper::check($target)) { $target = array($target); } // check if we are good to go - if (self::checkArray($target)) + if (UtilitiesArrayHelper::check($target)) { $checkTarget = true; } @@ -3748,7 +2494,7 @@ abstract class SermondistributorHelper // set area $area = 'comp'; // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + if (ObjectHelper::check($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) { // we are in item @@ -3781,7 +2527,7 @@ abstract class SermondistributorHelper } } } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + elseif (UtilitiesStringHelper::check($views) && isset($record->catid) && $record->catid > 0) { // we are in item $area = 'category'; @@ -3853,7 +2599,7 @@ abstract class SermondistributorHelper * @param array $targets The array of target actions * * @return boolean true if action should be filtered out - * + * */ protected static function filterActions(&$view, &$action, &$targets) { @@ -3872,78 +2618,53 @@ abstract class SermondistributorHelper /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success + * @deprecated 3.3 Use JsonHelper::check($string); */ public static function checkJson($string) { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; + return JsonHelper::check($string); } /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success + * @deprecated 3.3 Use ObjectHelper::check($object); */ public static function checkObject($object) { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; + return ObjectHelper::check($object); } /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); */ public static function checkArray($array, $removeEmptyString = false) { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; + return UtilitiesArrayHelper::check($array, $removeEmptyString); } /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success + * @deprecated 3.3 Use UtilitiesStringHelper::check($string); */ public static function checkString($string) { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; + return UtilitiesStringHelper::check($string); } /** @@ -3955,8 +2676,8 @@ abstract class SermondistributorHelper public static function isConnected() { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -3974,25 +2695,14 @@ abstract class SermondistributorHelper /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success + * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); */ public static function mergeArrays($arrays) { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; + return UtilitiesArrayHelper::merge($arrays); } // typo sorry! @@ -4004,310 +2714,101 @@ abstract class SermondistributorHelper /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); */ public static function shorten($string, $length = 40, $addTip = true) { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; + return UtilitiesStringHelper::shorten($string, $length, $addTip); } /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success + * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); */ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; + return UtilitiesStringHelper::safe( + $string, + $type, + $spacer, + $replaceNumbers, + $keepOnlyCharacters + ); } + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); + */ public static function transliterate($string) { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_sermondistributor')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); + return UtilitiesStringHelper::transliterate($string); } + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::html(...); + */ public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } + return UtilitiesStringHelper::html( + $var, + $charset, + $shorten, + $length + ); } + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); + */ public static function replaceNumbers($string) { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; + return UtilitiesStringHelper::numbers($string); } /** * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::number($x); */ public static function numberToString($x) { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; + return UtilitiesStringHelper::number($x); } /** * Random Key * * @returns a string + * @deprecated 3.3 Use UtilitiesStringHelper::random($size); */ public static function randomkey($size) { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); + return UtilitiesStringHelper::random($size); } /** @@ -4322,12 +2823,12 @@ abstract class SermondistributorHelper public static function getCryptKey($type, $default = false) { // Get the global params - $params = JComponentHelper::getParams('com_sermondistributor', true); + $params = ComponentHelper::getParams('com_sermondistributor', true); // Basic Encryption Type if ('basic' === $type) { $basic_key = $params->get('basic_key', $default); - if (self::checkString($basic_key)) + if (UtilitiesStringHelper::check($basic_key)) { return $basic_key; } @@ -4336,4 +2837,3 @@ abstract class SermondistributorHelper return $default; } } - diff --git a/site/layouts/addtodropboxbutton.php b/site/layouts/addtodropboxbutton.php index fc21b7ac..dfcdb762 100644 --- a/site/layouts/addtodropboxbutton.php +++ b/site/layouts/addtodropboxbutton.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage addtodropboxbutton.php @@ -25,17 +25,22 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> params->get('add_to_button') && isset($displayData->dropbox_buttons)): ?> dropbox_buttons) == 1): ?> dropbox_buttons as $filename => $link): ?> - onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> + onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> dropbox_buttons) > 1): ?> - +
@@ -43,7 +48,7 @@ defined('JPATH_BASE') or die('Restricted access'); dropbox_buttons as $filename => $link): ?>
  • onclick_drobox[$filename]; ?> href="" title=""> - +
  • diff --git a/site/layouts/addtodropboxicon.php b/site/layouts/addtodropboxicon.php index af205a14..bf633830 100644 --- a/site/layouts/addtodropboxicon.php +++ b/site/layouts/addtodropboxicon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage addtodropboxicon.php @@ -25,17 +25,22 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> params->get('add_to_button') && isset($displayData->dropbox_buttons)): ?> dropbox_buttons) == 1): ?> dropbox_buttons as $filename => $link): ?> - onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> + onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> dropbox_buttons) > 1): ?> - +
    @@ -43,7 +48,7 @@ defined('JPATH_BASE') or die('Restricted access'); dropbox_buttons as $filename => $link): ?>
  • onclick_drobox[$filename]; ?> target="_blank" href="" title=""> - +
  • diff --git a/site/layouts/categorieslistitem.php b/site/layouts/categorieslistitem.php index 922ee50a..4dba0221 100644 --- a/site/layouts/categorieslistitem.php +++ b/site/layouts/categorieslistitem.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categorieslistitem.php @@ -25,13 +25,18 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> -params->get('categories_sermon_count')): ?> data-uk-tooltip title=": idSeriesSermonB); ?>" href="link; ?>">name; ?> +params->get('categories_sermon_count')): ?> data-uk-tooltip title=": idSeriesSermonB); ?>" href="link; ?>">name; ?> params->get('categories_desc') && $displayData->desc): ?> desc; ?> params->get('categories_hits')): ?> - : hits; ?> + : hits; ?> diff --git a/site/layouts/categoriespanel.php b/site/layouts/categoriespanel.php index 534a77a9..3deefd1e 100644 --- a/site/layouts/categoriespanel.php +++ b/site/layouts/categoriespanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categoriespanel.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> @@ -37,11 +42,11 @@ defined('JPATH_BASE') or die('Restricted access'); ?>
    - : hits; ?> + : hits; ?>

    - + name; ?>

    @@ -59,9 +64,9 @@ defined('JPATH_BASE') or die('Restricted access');
    - + params->get('categories_sermon_count')): ?> - (idCatidSermonB); ?>) + (idCatidSermonB); ?>)
    diff --git a/site/layouts/categoriesrow.php b/site/layouts/categoriesrow.php index e8321cb9..719b6497 100644 --- a/site/layouts/categoriesrow.php +++ b/site/layouts/categoriesrow.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categoriesrow.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> diff --git a/site/layouts/downloadsermonbutton.php b/site/layouts/downloadsermonbutton.php index 8a6946ff..94de63ba 100644 --- a/site/layouts/downloadsermonbutton.php +++ b/site/layouts/downloadsermonbutton.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage downloadsermonbutton.php @@ -25,18 +25,23 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> download_links) && count($displayData->download_links) == 1): ?> download_links as $filename => $link): ?> onclick[$filename]; ?> href="" title=""> - + download_links) && count($displayData->download_links) > 1): ?> - +
    @@ -44,9 +49,9 @@ defined('JPATH_BASE') or die('Restricted access'); download_links as $filename => $link): ?>
  • onclick[$filename]; ?> href="" title=""> - + params->get($displayData->viewKey.'_sermons_download_counter') && isset($displayData->statistic[$filename])): ?> - (statistic[$filename]; ?>) + (statistic[$filename]; ?>)
  • diff --git a/site/layouts/htmlfive.php b/site/layouts/htmlfive.php index 0f6b8c33..51334200 100644 --- a/site/layouts/htmlfive.php +++ b/site/layouts/htmlfive.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage htmlfive.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> diff --git a/site/layouts/isnew.php b/site/layouts/isnew.php index 991ef8f2..fc3b4af2 100644 --- a/site/layouts/isnew.php +++ b/site/layouts/isnew.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage isnew.php @@ -25,7 +25,12 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); -$display = ''.JText::_('COM_SERMONDISTRIBUTOR_NEW').''; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + +$display = ''.Text::_('COM_SERMONDISTRIBUTOR_NEW').''; ?> isNew) ? $display:''; ?> diff --git a/site/layouts/jplayerbluemonday.php b/site/layouts/jplayerbluemonday.php index e76ae025..4aa9c7f4 100644 --- a/site/layouts/jplayerbluemonday.php +++ b/site/layouts/jplayerbluemonday.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage jplayerbluemonday.php @@ -25,8 +25,15 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); -$random = SermondistributorHelper::randomkey(5); -if (isset($displayData['script']) && SermondistributorHelper::checkArray($displayData['script'])) +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + +$random = StringHelper::random(5); +if (isset($displayData['script']) && ArrayHelper::check($displayData['script'])) { $script = array(); $script[] = 'jQuery(document).ready(function(){'; @@ -47,7 +54,7 @@ if (isset($displayData['script']) && SermondistributorHelper::checkArray($displa $script[] = 'toggleDuration: true'; $script[] = '}); });'; // get the document - $document = JFactory::getDocument(); + $document = Factory::getDocument(); // add script to document header $document->addScriptDeclaration(implode("\n", $script)); } @@ -58,8 +65,8 @@ if (isset($displayData['script']) && SermondistributorHelper::checkArray($displa
    diff --git a/site/layouts/jplayerbluemondaylist.php b/site/layouts/jplayerbluemondaylist.php index 48d53139..f17123b9 100644 --- a/site/layouts/jplayerbluemondaylist.php +++ b/site/layouts/jplayerbluemondaylist.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage jplayerbluemondaylist.php @@ -25,8 +25,15 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); -$random = SermondistributorHelper::randomkey(5); -if (isset($displayData['script']) && SermondistributorHelper::checkArray($displayData['script'])) +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; + +$random = StringHelper::random(5); +if (isset($displayData['script']) && ArrayHelper::check($displayData['script'])) { $script = array(); $script[] = 'jQuery(document).ready(function(){'; @@ -45,7 +52,7 @@ if (isset($displayData['script']) && SermondistributorHelper::checkArray($displa $script[] = 'keyEnabled: true'; $script[] = '}); });'; // get the document - $document = JFactory::getDocument(); + $document = Factory::getDocument(); // add script to document header $document->addScriptDeclaration(implode("\n", $script)); } @@ -56,10 +63,10 @@ if (isset($displayData['script']) && SermondistributorHelper::checkArray($displa
    diff --git a/site/layouts/mediaplayer.php b/site/layouts/mediaplayer.php index 0e23009a..5746d967 100644 --- a/site/layouts/mediaplayer.php +++ b/site/layouts/mediaplayer.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage mediaplayer.php @@ -25,6 +25,13 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; + $players = array(); $num = 'A'; if (isset($displayData->download_links) && count($displayData->download_links)) @@ -38,14 +45,14 @@ if (isset($displayData->download_links) && count($displayData->download_links)) $audio['link'] = $link; if (1 == count($displayData->download_links)) { - $audio['name'] = JText::_('COM_SERMONDISTRIBUTOR_PLAY_AUDIO_FILE'); + $audio['name'] = Text::_('COM_SERMONDISTRIBUTOR_PLAY_AUDIO_FILE'); } else { - $audio['name'] = JText::_('COM_SERMONDISTRIBUTOR_PLAY_AUDIO_FILE').' '.$num; + $audio['name'] = Text::_('COM_SERMONDISTRIBUTOR_PLAY_AUDIO_FILE').' '.$num; } $audio['filename'] = $filename; - $players[] = JLayoutHelper::render('soundmanagerthreesixty', $audio); + $players[] = LayoutHelper::render('soundmanagerthreesixty', $audio); $num++; } elseif (2 == $displayData->playerKey) @@ -53,11 +60,11 @@ if (isset($displayData->download_links) && count($displayData->download_links)) // use jPlayer if (1 == count($displayData->download_links)) { - $name = JText::_('COM_SERMONDISTRIBUTOR_AUDIO_FILE'); + $name = Text::_('COM_SERMONDISTRIBUTOR_AUDIO_FILE'); } else { - $name = JText::_('COM_SERMONDISTRIBUTOR_AUDIO_FILE').' '.$num; + $name = Text::_('COM_SERMONDISTRIBUTOR_AUDIO_FILE').' '.$num; } if (!isset($players['script'])) { @@ -79,31 +86,31 @@ if (isset($displayData->download_links) && count($displayData->download_links)) elseif (3 == $displayData->playerKey) { // use html5 player (plain and simple) - $players[] = JLayoutHelper::render('htmlfive', $link); + $players[] = LayoutHelper::render('htmlfive', $link); } } // use jPlayer layout - if (isset($players['script']) && SermondistributorHelper::checkArray($players['script'])) + if (isset($players['script']) && ArrayHelper::check($players['script'])) { - $players['swfPath'] = JURI::root() .'media/com_sermondistributor/jplayer/jplayer'; + $players['swfPath'] = Uri::root() .'media/com_sermondistributor/jplayer/jplayer'; if (2 == $displayData->playerKey && 1 == count($displayData->download_links)) { - $players = JLayoutHelper::render('jplayerbluemonday', $players); + $players = LayoutHelper::render('jplayerbluemonday', $players); } elseif (2 == $displayData->playerKey && count($displayData->download_links) > 1) { - $players = JLayoutHelper::render('jplayerbluemondaylist', $players); + $players = LayoutHelper::render('jplayerbluemondaylist', $players); } } } ?> -client->browser): ?> - playerKey && SermondistributorHelper::checkArray($players)): ?> +client->browser): ?> + playerKey && ArrayHelper::check($players)): ?>
  • - playerKey && SermondistributorHelper::checkString($players)): ?> + playerKey && StringHelper::check($players)): ?>
    - playerKey && SermondistributorHelper::checkArray($players)): ?> + playerKey && ArrayHelper::check($players)): ?>
    ', $players); ?>
    diff --git a/site/layouts/opensermonbutton.php b/site/layouts/opensermonbutton.php index 8034880c..49ecd8b0 100644 --- a/site/layouts/opensermonbutton.php +++ b/site/layouts/opensermonbutton.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage opensermonbutton.php @@ -25,24 +25,29 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> params->get($displayData->viewKey.'_sermons_open') && $displayData->params->get('add_to_button') && isset($displayData->dropbox_buttons)): ?> dropbox_buttons) > 1): ?> @@ -53,7 +58,7 @@ defined('JPATH_BASE') or die('Restricted access'); dropbox_buttons as $filename => $link): ?>
  • onclick_drobox[$filename]; ?> href="" title=""> - +
  • @@ -63,19 +68,19 @@ defined('JPATH_BASE') or die('Restricted access'); params->get($displayData->viewKey.'_sermons_open')): ?> - + params->get($displayData->viewKey.'_sermons_download_counter') && isset($displayData->statisticTotal)): ?> - (statisticTotal; ?>) + (statisticTotal; ?>) params->get('add_to_button') && isset($displayData->dropbox_buttons)): ?> dropbox_buttons) == 1): ?> dropbox_buttons as $filename => $link): ?> - onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> + onclick_drobox[$filename]; ?> href="" data-uk-tooltip title=""> dropbox_buttons) > 1): ?> - +
    @@ -83,7 +88,7 @@ defined('JPATH_BASE') or die('Restricted access'); dropbox_buttons as $filename => $link): ?>
  • onclick_drobox[$filename]; ?> target="_blank" href="" title=""> - +
  • diff --git a/site/layouts/preacherslistitem.php b/site/layouts/preacherslistitem.php index cf541985..53cb7c1b 100644 --- a/site/layouts/preacherslistitem.php +++ b/site/layouts/preacherslistitem.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacherslistitem.php @@ -25,19 +25,24 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> -params->get('preachers_sermon_count')): ?> data-uk-tooltip title=": idPreacherSermonB); ?>" href="link; ?>">name; ?> +params->get('preachers_sermon_count')): ?> data-uk-tooltip title=": idPreacherSermonB); ?>" href="link; ?>">name; ?> params->get('preachers_website')): ?> - website; ?> + website; ?> params->get('preachers_email')): ?> - email; ?> + email; ?> params->get('preachers_desc') && $displayData->desc): ?> desc; ?> params->get('preachers_hits')): ?> - : hits; ?> + : hits; ?> diff --git a/site/layouts/preacherspanel.php b/site/layouts/preacherspanel.php index 15c57f6c..1c1e5c79 100644 --- a/site/layouts/preacherspanel.php +++ b/site/layouts/preacherspanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacherspanel.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $displayData->params->get('preachers_list_style'); switch ($style) @@ -57,18 +62,18 @@ switch ($style) ?>
    - : hits; ?> + : hits; ?>

    - + name; ?>

    params->get('preachers_icon')): ?> icon = ($displayData->icon) ? $displayData->icon : $displayData->params->get('preacher_default_icon'); ?> icon): ?> - + <?php echo $displayData->name; ?> params->get('preachers_desc') && $displayData->desc): ?> @@ -84,19 +89,19 @@ switch ($style) params->get('preachers_website') && $displayData->website) || ($displayData->params->get('preachers_email') && $displayData->email)): ?> params->get('preachers_desc') && $displayData->desc): ?>
    - + params->get('preachers_sermon_count')): ?> - (idPreacherSermonB); ?>) + (idPreacherSermonB); ?>)
    diff --git a/site/layouts/preachersrow.php b/site/layouts/preachersrow.php index 68e067a2..8b653e67 100644 --- a/site/layouts/preachersrow.php +++ b/site/layouts/preachersrow.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachersrow.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> diff --git a/site/layouts/serieslistitem.php b/site/layouts/serieslistitem.php index 03b903a4..b9d0c0bb 100644 --- a/site/layouts/serieslistitem.php +++ b/site/layouts/serieslistitem.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage serieslistitem.php @@ -25,13 +25,18 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> -params->get('list_series_sermon_count')): ?> data-uk-tooltip title=": idSeriesSermonB); ?>" href="link; ?>">name; ?> +params->get('list_series_sermon_count')): ?> data-uk-tooltip title=": idSeriesSermonB); ?>" href="link; ?>">name; ?> params->get('list_series_desc') && $displayData->desc): ?> desc; ?> params->get('list_series_hits')): ?> - : hits; ?> + : hits; ?> diff --git a/site/layouts/seriespanel.php b/site/layouts/seriespanel.php index 26f20ab8..8854bfa6 100644 --- a/site/layouts/seriespanel.php +++ b/site/layouts/seriespanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage seriespanel.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> @@ -37,11 +42,11 @@ defined('JPATH_BASE') or die('Restricted access'); ?>
    - : hits; ?> + : hits; ?>

    - + name; ?>

    @@ -59,9 +64,9 @@ defined('JPATH_BASE') or die('Restricted access');
    - + params->get('list_series_sermon_count')): ?> - (idSeriesSermonB); ?>) + (idSeriesSermonB); ?>)
    diff --git a/site/layouts/seriesrow.php b/site/layouts/seriesrow.php index 09e92762..e3e019dc 100644 --- a/site/layouts/seriesrow.php +++ b/site/layouts/seriesrow.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage seriesrow.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> diff --git a/site/layouts/sermonslistitem.php b/site/layouts/sermonslistitem.php index 5b0b73b5..ff08e014 100644 --- a/site/layouts/sermonslistitem.php +++ b/site/layouts/sermonslistitem.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermonslistitem.php @@ -25,10 +25,15 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> - params->get($displayData->viewKey.'_sermons_download_count')): ?> data-uk-tooltip title=": " href="link; ?>">name; ?> + params->get($displayData->viewKey.'_sermons_download_count')): ?> data-uk-tooltip title=": " href="link; ?>">name; ?> viewKey || 'category' == $displayData->viewKey) && $displayData->params->get($displayData->viewKey.'_sermons_series')): ?> series_name; ?> @@ -44,5 +49,5 @@ defined('JPATH_BASE') or die('Restricted access'); desc; ?> params->get($displayData->viewKey.'_sermons_hits')): ?> - : hits; ?> + : hits; ?> diff --git a/site/layouts/sermonspanel.php b/site/layouts/sermonspanel.php index 385f448f..1c90ecc8 100644 --- a/site/layouts/sermonspanel.php +++ b/site/layouts/sermonspanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermonspanel.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $displayData->params->get($displayData->viewKey.'_sermons_list_style'); switch ($style) @@ -57,19 +62,19 @@ switch ($style) ?>
    - : hits; ?> + : hits; ?>
    - +

    - + name; ?>

    params->get($displayData->viewKey.'_sermons_icon')): ?> icon = ($displayData->icon) ? $displayData->icon : $displayData->params->get('sermon_default_icon'); ?> icon): ?> - + <?php echo $displayData->name; ?> params->get($displayData->viewKey.'_sermons_desc') && ($displayData->desc || $displayData->short_description)): ?> @@ -89,37 +94,37 @@ switch ($style) viewKey == 'preacher' && (($displayData->params->get($displayData->viewKey.'_sermons_series') && $displayData->series_name) || ($displayData->params->get($displayData->viewKey.'_sermons_category') && $displayData->category))): ?> viewKey == 'series' && (($displayData->params->get($displayData->viewKey.'_sermons_preacher') && $displayData->preacher_name) || ($displayData->params->get($displayData->viewKey.'_sermons_category') && $displayData->category))): ?> viewKey == 'category' && (($displayData->params->get($displayData->viewKey.'_sermons_series') && $displayData->series_name) || ($displayData->params->get($displayData->viewKey.'_sermons_preacher') && $displayData->preacher_name))): ?> params->get($displayData->viewKey.'_sermons_desc') && ($displayData->desc || $displayData->short_description)) && (($displayData->params->get($displayData->viewKey.'_sermons_open') || ($displayData->params->get('add_to_button') && isset($displayData->dropbox_buttons))) || ($displayData->params->get($displayData->viewKey.'_sermons_downloads') && isset($displayData->download_links)))): ?>
    params->get($displayData->viewKey.'_sermons_open') || ($displayData->params->get('add_to_button') && isset($displayData->dropbox_buttons))) && ($displayData->params->get($displayData->viewKey.'_sermons_downloads') && isset($displayData->download_links))): ?> - - + + params->get($displayData->viewKey.'_sermons_open') || ($displayData->params->get('add_to_button') && isset($displayData->dropbox_buttons))): ?> - +
    diff --git a/site/layouts/sermonsrow.php b/site/layouts/sermonsrow.php index 2af86f2a..3538ec3b 100644 --- a/site/layouts/sermonsrow.php +++ b/site/layouts/sermonsrow.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermonsrow.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> @@ -34,8 +39,8 @@ defined('JPATH_BASE') or die('Restricted access'); name; ?> - - + + params->get($displayData->viewKey.'_sermons_desc')): ?> @@ -75,7 +80,7 @@ defined('JPATH_BASE') or die('Restricted access'); params->get($displayData->viewKey.'_sermons_downloads')): ?> - + params->get($displayData->viewKey.'_sermons_download_counter')): ?> @@ -87,7 +92,7 @@ defined('JPATH_BASE') or die('Restricted access'); ?>
    - + statisticTotal; ?> diff --git a/site/layouts/soundmanagerthreesixty.php b/site/layouts/soundmanagerthreesixty.php index fd16455d..92f6f7f3 100644 --- a/site/layouts/soundmanagerthreesixty.php +++ b/site/layouts/soundmanagerthreesixty.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage soundmanagerthreesixty.php @@ -25,6 +25,11 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> diff --git a/site/models/ajax.php b/site/models/ajax.php index 77f67bb0..148dca1d 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage ajax.php @@ -25,8 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Sermondistributor Ajax List Model @@ -39,7 +47,7 @@ class SermondistributorModelAjax extends ListModel { parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_sermondistributor'); + $this->app_params = ComponentHelper::getParams('com_sermondistributor'); } @@ -55,7 +63,7 @@ class SermondistributorModelAjax extends ListModel protected function saveFile($data,$path_filename) { - if (SermondistributorHelper::checkString($data)) + if (StringHelper::check($data)) { $fp = fopen($path_filename, 'w'); fwrite($fp, $data); @@ -81,7 +89,7 @@ class SermondistributorModelAjax extends ListModel // the types allowed $types = array('manual','auto'); // check the type - if (SermondistributorHelper::checkString($type) && in_array($type,$types)) + if (StringHelper::check($type) && in_array($type,$types)) { // run the updatetype if (SermondistributorHelper::updateExternalSource($id, $target, $type)) @@ -95,7 +103,7 @@ class SermondistributorModelAjax extends ListModel } // return array('error' => SermondistributorHelper::getUpdateError($id)); } - // return array('error' => JText::_('COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB')); + // return array('error' => Text::_('COM_SERMONDISTRIBUTOR_BCOULD_NOT_USE_THE_GIVEN_TOKEN_OR_THE_GIVEN_BUILD_OPTION_DOES_NOT_EXISTB')); } /** @@ -105,14 +113,14 @@ class SermondistributorModelAjax extends ListModel { // check if we should update with auto listing $links_dropbox_auto = SermondistributorHelper::getExternalSourceLink('auto', 2); - if (SermondistributorHelper::checkArray($links_dropbox_auto)) + if (UtilitiesArrayHelper::check($links_dropbox_auto)) { $bucket = array(); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // load system aliases $this->getSermonAliasesUsed($db); // set the class var for sermons - $this->sermons = new stdClass(); + $this->sermons = new \stdClass(); // we must first get all the preacher names foreach ($links_dropbox_auto as $placeholder => $link) { @@ -156,7 +164,7 @@ class SermondistributorModelAjax extends ListModel protected function setSermons($db) { // check if we have values - if (SermondistributorHelper::checkObject($this->sermons)) + if (ObjectHelper::check($this->sermons)) { foreach ($this->sermons as $sermon) { @@ -223,7 +231,7 @@ class SermondistributorModelAjax extends ListModel $fields = array( $db->quoteName('published') . ' = 0' ); - if (isset($this->allSermons) && SermondistributorHelper::checkArray($this->allSermons)) + if (isset($this->allSermons) && UtilitiesArrayHelper::check($this->allSermons)) { // unpublish those AUTO sermons not found in this id list $conditions = array( @@ -316,7 +324,7 @@ class SermondistributorModelAjax extends ListModel else { // load the sermon data - $this->sermons->$key = new stdClass(); + $this->sermons->$key = new \stdClass(); } // check if this value has been set if (!isset($this->sermons->$key->alias)) @@ -337,7 +345,7 @@ class SermondistributorModelAjax extends ListModel $this->sermons->$key->name = $name; } // check if this value has been set - if (!isset($this->sermons->$key->short_description) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->short_description) && StringHelper::check($description)) { $this->sermons->$key->short_description = $description; } @@ -360,32 +368,32 @@ class SermondistributorModelAjax extends ListModel if (!isset($this->sermons->$key->created)) { // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); $this->sermons->$key->created = $date->toSql(); } // build the Download File NAme - first add the preacher name if set if ($preacher) { - $downloadName[] = SermondistributorHelper::safeString($preacherName,'U'); + $downloadName[] = StringHelper::safe($preacherName,'U'); } // add the series name if set if ($series) { - $downloadName[] = SermondistributorHelper::safeString($seriesName,'F'); + $downloadName[] = StringHelper::safe($seriesName,'F'); } // add the category name if set if ($category) { - $downloadName[] = SermondistributorHelper::safeString($categoryName, 'F'); + $downloadName[] = StringHelper::safe($categoryName, 'F'); } // add the main file name - $downloadName[] = SermondistributorHelper::safeString($name,'F'); + $downloadName[] = StringHelper::safe($name,'F'); // now build the download file name $downloadName = implode('__', $downloadName).'.'.$fileType; // load the placeholder to the sermon $this->sermons->$key->auto_sermons[$downloadName] = $placeholder; // set default metadate - if (!isset($this->sermons->$key->metadesc) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->metadesc) && StringHelper::check($description)) { // Only process once per/sermon $bad_characters = array("\"", "<", ">"); @@ -416,7 +424,7 @@ class SermondistributorModelAjax extends ListModel protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { $alias = JFilterOutput::stringURLUnicodeSlug($name); } @@ -436,7 +444,7 @@ class SermondistributorModelAjax extends ListModel // sanitize the name to an alias $alias = $this->getAlias($name); // check if there is a recored - if ($id = SermondistributorHelper::getVar($type, $alias, 'alias', 'id')) + if ($id = GetHelper::var($type, $alias, 'alias', 'id')) { return $id; } @@ -449,9 +457,9 @@ class SermondistributorModelAjax extends ListModel $name = ucwords($name); } // create the record - $object = new stdClass(); + $object = new \stdClass(); // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); // build the object $object->name = $name; $object->alias = $alias; diff --git a/site/models/api.php b/site/models/api.php index ec79e182..d98ac48f 100644 --- a/site/models/api.php +++ b/site/models/api.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage api.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; /** * Sermondistributor List Model for Api @@ -55,19 +65,19 @@ class SermondistributorModelApi extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -91,20 +101,20 @@ class SermondistributorModelApi extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } @@ -120,7 +130,7 @@ class SermondistributorModelApi extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } @@ -134,7 +144,7 @@ class SermondistributorModelApi extends ListModel { // get the next update value $update = SermondistributorHelper::getNextUpdateValues(true); // id, target, typeID - if (SermondistributorHelper::checkArray($update)) + if (UtilitiesArrayHelper::check($update)) { // add a worker SermondistributorHelper::setWorker($update, 'theQueue'); @@ -155,9 +165,9 @@ class SermondistributorModelApi extends ListModel $type = 'auto'; } // first get the file path - $path_filename = SermondistributorHelper::getFilePath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); + $path_filename = FileHelper::getPath('update', 'error', $id.$target.$typeID, '.txt', JPATH_COMPONENT_ADMINISTRATOR); // check the type - if (isset($type) && SermondistributorHelper::checkString($type)) + if (isset($type) && StringHelper::check($type)) { // run the updatetype if (SermondistributorHelper::updateExternalSource($id, $target, $type)) @@ -173,7 +183,7 @@ class SermondistributorModelApi extends ListModel SermondistributorHelper::writeFile($path_filename,SermondistributorHelper::getUpdateError($id)); return false; } - SermondistributorHelper::writeFile($path_filename,JText::_('COM_SERMONDISTRIBUTOR_BTHERE_WAS_AN_ERRORB')); + SermondistributorHelper::writeFile($path_filename,Text::_('COM_SERMONDISTRIBUTOR_BTHERE_WAS_AN_ERRORB')); return false; } @@ -184,12 +194,12 @@ class SermondistributorModelApi extends ListModel { // check if we should update with auto listing $links_dropbox_auto = SermondistributorHelper::getExternalSourceLink('auto', 2); - if (SermondistributorHelper::checkArray($links_dropbox_auto)) + if (UtilitiesArrayHelper::check($links_dropbox_auto)) { // load system aliases $this->getSermonAliasesUsed(); // set the class var for sermons - $this->sermons = new stdClass(); + $this->sermons = new \stdClass(); // we must first get all the preacher names foreach ($links_dropbox_auto as $placeholder => $link) { @@ -233,7 +243,7 @@ class SermondistributorModelApi extends ListModel protected function setSermons() { // check if we have values - if (SermondistributorHelper::checkObject($this->sermons)) + if (ObjectHelper::check($this->sermons)) { foreach ($this->sermons as $sermon) { @@ -300,7 +310,7 @@ class SermondistributorModelApi extends ListModel $fields = array( $this->db->quoteName('published') . ' = 0' ); - if (isset($this->allSermons) && SermondistributorHelper::checkArray($this->allSermons)) + if (isset($this->allSermons) && UtilitiesArrayHelper::check($this->allSermons)) { // unpublish those AUTO sermons not found in this id list $conditions = array( @@ -393,7 +403,7 @@ class SermondistributorModelApi extends ListModel else { // load the sermon data - $this->sermons->$key = new stdClass(); + $this->sermons->$key = new \stdClass(); } // check if this value has been set if (!isset($this->sermons->$key->alias)) @@ -414,7 +424,7 @@ class SermondistributorModelApi extends ListModel $this->sermons->$key->name = $name; } // check if this value has been set - if (!isset($this->sermons->$key->short_description) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->short_description) && StringHelper::check($description)) { $this->sermons->$key->short_description = $description; } @@ -437,32 +447,32 @@ class SermondistributorModelApi extends ListModel if (!isset($this->sermons->$key->created)) { // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); $this->sermons->$key->created = $date->toSql(); } // build the Download File NAme - first add the preacher name if set if ($preacher) { - $downloadName[] = SermondistributorHelper::safeString($preacherName,'U'); + $downloadName[] = StringHelper::safe($preacherName,'U'); } // add the series name if set if ($series) { - $downloadName[] = SermondistributorHelper::safeString($seriesName,'F'); + $downloadName[] = StringHelper::safe($seriesName,'F'); } // add the category name if set if ($category) { - $downloadName[] = SermondistributorHelper::safeString($categoryName, 'F'); + $downloadName[] = StringHelper::safe($categoryName, 'F'); } // add the main file name - $downloadName[] = SermondistributorHelper::safeString($name,'F'); + $downloadName[] = StringHelper::safe($name,'F'); // now build the download file name $downloadName = implode('__', $downloadName).'.'.$fileType; // load the placeholder to the sermon $this->sermons->$key->auto_sermons[$downloadName] = $placeholder; // set default metadate - if (!isset($this->sermons->$key->metadesc) && SermondistributorHelper::checkString($description)) + if (!isset($this->sermons->$key->metadesc) && StringHelper::check($description)) { // Only process once per/sermon $bad_characters = array("\"", "<", ">"); @@ -493,7 +503,7 @@ class SermondistributorModelApi extends ListModel protected function getAlias($name,$type = false) { // sanitize the name to an alias - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { $alias = JFilterOutput::stringURLUnicodeSlug($name); } @@ -513,7 +523,7 @@ class SermondistributorModelApi extends ListModel // sanitize the name to an alias $alias = $this->getAlias($name); // check if there is a recored - if ($id = SermondistributorHelper::getVar($type, $alias, 'alias', 'id')) + if ($id = GetHelper::var($type, $alias, 'alias', 'id')) { return $id; } @@ -526,9 +536,9 @@ class SermondistributorModelApi extends ListModel $name = ucwords($name); } // create the record - $object = new stdClass(); + $object = new \stdClass(); // set the date object - $date = JFactory::getDate(); + $date = Factory::getDate(); // build the object $object->name = $name; $object->alias = $alias; diff --git a/site/models/categories.php b/site/models/categories.php index 1e992d26..ee9a6ecb 100644 --- a/site/models/categories.php +++ b/site/models/categories.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage categories.php @@ -25,8 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor List Model for Categories @@ -55,17 +63,17 @@ class SermondistributorModelCategories extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -93,49 +101,49 @@ class SermondistributorModelCategories extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.categories.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_CATEGORIES'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_CATEGORIES'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // set idCatidSermonB to the $item object. $item->idCatidSermonB = $this->getIdCatidSermonEfee_B($item->id); } } - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { - if (!SermondistributorHelper::checkArray($item->idCatidSermonB)) + if (!UtilitiesArrayHelper::check($item->idCatidSermonB)) { // remove empty category unset($items[$nr]); } // set the icon if found - if (SermondistributorHelper::checkJson($item->params)) + if (JsonHelper::check($item->params)) { $params = json_decode($item->params, true); - if (isset($params['image']) && SermondistributorHelper::checkString($params['image'])) + if (isset($params['image']) && StringHelper::check($params['image'])) { $item->icon = $params['image']; } @@ -156,7 +164,7 @@ class SermondistributorModelCategories extends ListModel public function getIdCatidSermonEfee_B($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -192,7 +200,7 @@ class SermondistributorModelCategories extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/category.php b/site/models/category.php index d5d96b32..6fcb3087 100644 --- a/site/models/category.php +++ b/site/models/category.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage category.php @@ -25,8 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Category @@ -55,17 +63,17 @@ class SermondistributorModelCategory extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -96,7 +104,7 @@ class SermondistributorModelCategory extends ListModel $query->where('a.access IN (' . implode(',', $this->levels) . ')'); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.catid = ' . $db->quote($checkValue)); } @@ -123,48 +131,48 @@ class SermondistributorModelCategory extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.category.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_CATEGORY'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_CATEGORY'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if we can decode local_files - if (SermondistributorHelper::checkJson($item->local_files)) + if (isset($item->local_files) && JsonHelper::check($item->local_files)) { // Decode local_files $item->local_files = json_decode($item->local_files, true); } // Check if we can decode manual_files - if (SermondistributorHelper::checkJson($item->manual_files)) + if (isset($item->manual_files) && JsonHelper::check($item->manual_files)) { // Decode manual_files $item->manual_files = json_decode($item->manual_files, true); } // Check if item has params, or pass whole item. - $params = (isset($item->params) && SermondistributorHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.category.description', &$_description, &$params, 0)); @@ -190,13 +198,13 @@ class SermondistributorModelCategory extends ListModel $item->isNew = true; } $item->statisticTotal = 0; - if (isset($item->auto_sermons) && SermondistributorHelper::checkString($item->auto_sermons)) + if (isset($item->auto_sermons) && StringHelper::check($item->auto_sermons)) { // Decode the auto files $item->auto_sermons = json_decode($item->auto_sermons, true); } // set statistic per filename if found - if (isset($item->idSermonStatisticE) && SermondistributorHelper::checkArray($item->idSermonStatisticE)) + if (isset($item->idSermonStatisticE) && UtilitiesArrayHelper::check($item->idSermonStatisticE)) { foreach ($item->idSermonStatisticE as $statistic) { @@ -233,7 +241,7 @@ class SermondistributorModelCategory extends ListModel public function getIdSermonStatisticBcea_E($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -269,7 +277,7 @@ class SermondistributorModelCategory extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -278,7 +286,7 @@ class SermondistributorModelCategory extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -288,9 +296,9 @@ class SermondistributorModelCategory extends ListModel array('a.id','a.parent_id','a.lft','a.rgt','a.level','a.title','a.alias','a.note','a.description','a.params','a.metadesc','a.metakey','a.metadata','a.hits','a.language','a.version'), array('id','parent_id','lft','rgt','level','name','alias','note','description','params','metadesc','metakey','metadata','hits','language','version'))); $query->from($db->quoteName('#__categories', 'a')); - // Check if JRequest::getInt('id') is a string or numeric value. - $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + // Check if $this->input->getInt('id') is a string or numeric value. + $checkValue = $this->input->getInt('id'); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.id = ' . $db->quote($checkValue)); } @@ -331,7 +339,7 @@ class SermondistributorModelCategory extends ListModel public function getIdCatidSermonFbdf_B($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -341,7 +349,7 @@ class SermondistributorModelCategory extends ListModel array('b.id'), array('id'))); $query->from($db->quoteName('#__sermondistributor_sermon', 'b')); - $query->where('b.catid = ' . $db->quote($id)); + $query->where('b.catid = ' . $db->quote($id)); // Reset the query using our newly populated query object. $db->setQuery($query); @@ -372,7 +380,7 @@ class SermondistributorModelCategory extends ListModel public function getIdSermonStatisticFbdf_C($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -405,7 +413,7 @@ class SermondistributorModelCategory extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/preacher.php b/site/models/preacher.php index bfc7d18d..4b8f2a12 100644 --- a/site/models/preacher.php +++ b/site/models/preacher.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preacher.php @@ -25,8 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Preacher @@ -55,17 +63,17 @@ class SermondistributorModelPreacher extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -95,7 +103,7 @@ class SermondistributorModelPreacher extends ListModel $query->join('LEFT', ($db->quoteName('#__categories', 'b')) . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('b.id') . ')'); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.preacher = ' . $db->quote($checkValue)); } @@ -123,48 +131,48 @@ class SermondistributorModelPreacher extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.preacher.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_PREACHER'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_PREACHER'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if we can decode local_files - if (SermondistributorHelper::checkJson($item->local_files)) + if (isset($item->local_files) && JsonHelper::check($item->local_files)) { // Decode local_files $item->local_files = json_decode($item->local_files, true); } // Check if we can decode manual_files - if (SermondistributorHelper::checkJson($item->manual_files)) + if (isset($item->manual_files) && JsonHelper::check($item->manual_files)) { // Decode manual_files $item->manual_files = json_decode($item->manual_files, true); } // Check if item has params, or pass whole item. - $params = (isset($item->params) && SermondistributorHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.preacher.description', &$_description, &$params, 0)); @@ -190,13 +198,13 @@ class SermondistributorModelPreacher extends ListModel $item->isNew = true; } $item->statisticTotal = 0; - if (isset($item->auto_sermons) && SermondistributorHelper::checkString($item->auto_sermons)) + if (isset($item->auto_sermons) && StringHelper::check($item->auto_sermons)) { // Decode the auto files $item->auto_sermons = json_decode($item->auto_sermons, true); } // set statistic per filename if found - if (isset($item->idSermonStatisticE) && SermondistributorHelper::checkArray($item->idSermonStatisticE)) + if (isset($item->idSermonStatisticE) && UtilitiesArrayHelper::check($item->idSermonStatisticE)) { foreach ($item->idSermonStatisticE as $statistic) { @@ -233,7 +241,7 @@ class SermondistributorModelPreacher extends ListModel public function getIdSermonStatisticFcff_E($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -269,7 +277,7 @@ class SermondistributorModelPreacher extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -278,7 +286,7 @@ class SermondistributorModelPreacher extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -291,7 +299,7 @@ class SermondistributorModelPreacher extends ListModel $query->where('a.access IN (' . implode(',', $this->levels) . ')'); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.id = ' . $db->quote($checkValue)); } @@ -317,12 +325,12 @@ class SermondistributorModelPreacher extends ListModel return false; } // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); // Check if item has params, or pass whole item. - $params = (isset($data->params) && SermondistributorHelper::checkJson($data->params)) ? json_decode($data->params) : $data; + $params = (isset($data->params) && JsonHelper::check($data->params)) ? json_decode($data->params) : $data; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $data->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.preacher.description', &$_description, &$params, 0)); @@ -344,7 +352,7 @@ class SermondistributorModelPreacher extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -354,9 +362,9 @@ class SermondistributorModelPreacher extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -366,9 +374,9 @@ class SermondistributorModelPreacher extends ListModel array('a.id','a.counter'), array('id','counter'))); $query->from($db->quoteName('#__sermondistributor_statistic', 'a')); - // Check if JRequest::getInt('id') is a string or numeric value. - $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + // Check if $this->input->getInt('id') is a string or numeric value. + $checkValue = $this->input->getInt('id'); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.preacher = ' . $db->quote($checkValue)); } @@ -394,12 +402,12 @@ class SermondistributorModelPreacher extends ListModel } // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } // return items @@ -417,7 +425,7 @@ class SermondistributorModelPreacher extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -427,9 +435,9 @@ class SermondistributorModelPreacher extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -441,7 +449,7 @@ class SermondistributorModelPreacher extends ListModel $query->from($db->quoteName('#__sermondistributor_sermon', 'a')); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.preacher = ' . $db->quote($checkValue)); } @@ -468,12 +476,12 @@ class SermondistributorModelPreacher extends ListModel } // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } // return items @@ -488,7 +496,7 @@ class SermondistributorModelPreacher extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/preachers.php b/site/models/preachers.php index 929e1b00..8c035cb2 100644 --- a/site/models/preachers.php +++ b/site/models/preachers.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage preachers.php @@ -25,8 +25,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Preachers @@ -55,17 +62,17 @@ class SermondistributorModelPreachers extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -91,36 +98,36 @@ class SermondistributorModelPreachers extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.preachers.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_PREACHERS'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_PREACHERS'), 'error'); // redirect away to the home page if no access allowed. - $app->redirect(JURI::root()); + $app->redirect(Uri::root()); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if item has params, or pass whole item. - $params = (isset($item->params) && SermondistributorHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.preacher.description', &$_description, &$params, 0)); @@ -132,11 +139,11 @@ class SermondistributorModelPreachers extends ListModel } - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { - if (!SermondistributorHelper::checkArray($item->idPreacherSermonB)) + if (!UtilitiesArrayHelper::check($item->idPreacherSermonB)) { // remove empty preacher unset($items[$nr]); @@ -157,7 +164,7 @@ class SermondistributorModelPreachers extends ListModel public function getIdPreacherSermonDcaa_B($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -193,7 +200,7 @@ class SermondistributorModelPreachers extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/series.php b/site/models/series.php index 5a94a2f4..c2a36777 100644 --- a/site/models/series.php +++ b/site/models/series.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage series.php @@ -25,8 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Series @@ -55,17 +63,17 @@ class SermondistributorModelSeries extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -96,7 +104,7 @@ class SermondistributorModelSeries extends ListModel $query->where('a.access IN (' . implode(',', $this->levels) . ')'); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.series = ' . $db->quote($checkValue)); } @@ -123,48 +131,48 @@ class SermondistributorModelSeries extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.series.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERIES'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERIES'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if we can decode local_files - if (SermondistributorHelper::checkJson($item->local_files)) + if (isset($item->local_files) && JsonHelper::check($item->local_files)) { // Decode local_files $item->local_files = json_decode($item->local_files, true); } // Check if we can decode manual_files - if (SermondistributorHelper::checkJson($item->manual_files)) + if (isset($item->manual_files) && JsonHelper::check($item->manual_files)) { // Decode manual_files $item->manual_files = json_decode($item->manual_files, true); } // Check if item has params, or pass whole item. - $params = (isset($item->params) && SermondistributorHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.series.description', &$_description, &$params, 0)); @@ -190,13 +198,13 @@ class SermondistributorModelSeries extends ListModel $item->isNew = true; } $item->statisticTotal = 0; - if (isset($item->auto_sermons) && SermondistributorHelper::checkString($item->auto_sermons)) + if (isset($item->auto_sermons) && StringHelper::check($item->auto_sermons)) { // Decode the auto files $item->auto_sermons = json_decode($item->auto_sermons, true); } // set statistic per filename if found - if (isset($item->idSermonStatisticE) && SermondistributorHelper::checkArray($item->idSermonStatisticE)) + if (isset($item->idSermonStatisticE) && UtilitiesArrayHelper::check($item->idSermonStatisticE)) { foreach ($item->idSermonStatisticE as $statistic) { @@ -233,7 +241,7 @@ class SermondistributorModelSeries extends ListModel public function getIdSermonStatisticEfeb_E($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -269,7 +277,7 @@ class SermondistributorModelSeries extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -278,7 +286,7 @@ class SermondistributorModelSeries extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -291,7 +299,7 @@ class SermondistributorModelSeries extends ListModel $query->where('a.access IN (' . implode(',', $this->levels) . ')'); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.id = ' . $db->quote($checkValue)); } @@ -317,12 +325,12 @@ class SermondistributorModelSeries extends ListModel return false; } // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); // Check if item has params, or pass whole item. - $params = (isset($data->params) && SermondistributorHelper::checkJson($data->params)) ? json_decode($data->params) : $data; + $params = (isset($data->params) && JsonHelper::check($data->params)) ? json_decode($data->params) : $data; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $data->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.series.description', &$_description, &$params, 0)); @@ -344,7 +352,7 @@ class SermondistributorModelSeries extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -354,9 +362,9 @@ class SermondistributorModelSeries extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -368,7 +376,7 @@ class SermondistributorModelSeries extends ListModel $query->from($db->quoteName('#__sermondistributor_statistic', 'a')); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.series = ' . $db->quote($checkValue)); } @@ -394,12 +402,12 @@ class SermondistributorModelSeries extends ListModel } // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } // return items @@ -417,7 +425,7 @@ class SermondistributorModelSeries extends ListModel if (!isset($this->initSet) || !$this->initSet) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); @@ -427,9 +435,9 @@ class SermondistributorModelSeries extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -441,7 +449,7 @@ class SermondistributorModelSeries extends ListModel $query->from($db->quoteName('#__sermondistributor_sermon', 'a')); // Check if JRequest::getInt('id') is a string or numeric value. $checkValue = JRequest::getInt('id'); - if (isset($checkValue) && SermondistributorHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.series = ' . $db->quote($checkValue)); } @@ -468,12 +476,12 @@ class SermondistributorModelSeries extends ListModel } // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); } } // return items @@ -488,7 +496,7 @@ class SermondistributorModelSeries extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/serieslist.php b/site/models/serieslist.php index baa912b0..89c818ca 100644 --- a/site/models/serieslist.php +++ b/site/models/serieslist.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage serieslist.php @@ -25,8 +25,15 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Sermondistributor List Model for Serieslist @@ -55,17 +62,17 @@ class SermondistributorModelSerieslist extends ListModel protected function getListQuery() { // Get the current user for authorisation checks - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->userId = $this->user->get('id'); $this->guest = $this->user->get('guest'); $this->groups = $this->user->get('groups'); $this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->levels = $this->user->getAuthorisedViewLevels(); - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; $this->initSet = true; // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -91,36 +98,36 @@ class SermondistributorModelSerieslist extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.serieslist.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERIESLIST'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERIESLIST'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // load parent items $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_sermondistributor', true); + $globalParams = ComponentHelper::getParams('com_sermondistributor', true); // Insure all item fields are adapted where needed. - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's - $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + $item->slug = ($item->id ?? '0') . (isset($item->alias) ? ':' . $item->alias : ''); // Check if item has params, or pass whole item. - $params = (isset($item->params) && SermondistributorHelper::checkJson($item->params)) ? json_decode($item->params) : $item; + $params = (isset($item->params) && JsonHelper::check($item->params)) ? json_decode($item->params) : $item; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.series.description', &$_description, &$params, 0)); @@ -132,11 +139,11 @@ class SermondistributorModelSerieslist extends ListModel } - if (SermondistributorHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { - if (!SermondistributorHelper::checkArray($item->idSeriesSermonB)) + if (!UtilitiesArrayHelper::check($item->idSeriesSermonB)) { // remove empty series unset($items[$nr]); @@ -157,7 +164,7 @@ class SermondistributorModelSerieslist extends ListModel public function getIdSeriesSermonBcae_B($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -193,7 +200,7 @@ class SermondistributorModelSerieslist extends ListModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/models/sermon.php b/site/models/sermon.php index 57d70d52..26f8d74b 100644 --- a/site/models/sermon.php +++ b/site/models/sermon.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermon.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ItemModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Sermondistributor Sermon Item Model @@ -70,7 +80,7 @@ class SermondistributorModelSermon extends ItemModel */ protected function populateState() { - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->input = $this->app->input; // Get the itme main id $id = $this->input->getInt('id', null); @@ -91,14 +101,14 @@ class SermondistributorModelSermon extends ItemModel */ public function getItem($pk = null) { - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // check if this user has permission to access item if (!$this->user->authorise('site.sermon.access', 'com_sermondistributor')) { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERMON'), 'error'); + $app = Factory::getApplication(); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_AUTHORISED_TO_VIEW_SERMON'), 'error'); // redirect away to the default view if no access allowed. - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } $this->userId = $this->user->get('id'); @@ -109,10 +119,10 @@ class SermondistributorModelSermon extends ItemModel $this->initSet = true; $pk = (!empty($pk)) ? $pk : (int) $this->getState('sermon.id'); - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; } if (!isset($this->_item[$pk])) @@ -120,7 +130,7 @@ class SermondistributorModelSermon extends ItemModel try { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -161,31 +171,31 @@ class SermondistributorModelSermon extends ItemModel if (empty($data)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. - $app->enqueueMessage(JText::_('COM_SERMONDISTRIBUTOR_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); - $app->redirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers')); + $app->enqueueMessage(Text::_('COM_SERMONDISTRIBUTOR_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); + $app->redirect(Route::_('index.php?option=com_sermondistributor&view=preachers')); return false; } // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); // Check if we can decode local_files - if (SermondistributorHelper::checkJson($data->local_files)) + if (isset($data->local_files) && JsonHelper::check($data->local_files)) { // Decode local_files $data->local_files = json_decode($data->local_files, true); } // Check if we can decode manual_files - if (SermondistributorHelper::checkJson($data->manual_files)) + if (isset($data->manual_files) && JsonHelper::check($data->manual_files)) { // Decode manual_files $data->manual_files = json_decode($data->manual_files, true); } // Check if item has params, or pass whole item. - $params = (isset($data->params) && SermondistributorHelper::checkJson($data->params)) ? json_decode($data->params) : $data; + $params = (isset($data->params) && JsonHelper::check($data->params)) ? json_decode($data->params) : $data; // Make sure the content prepare plugins fire on description - $_description = new stdClass(); + $_description = new \stdClass(); $_description->text =& $data->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context $this->_dispatcher->triggerEvent("onContentPrepare", array('com_sermondistributor.sermon.description', &$_description, &$params, 0)); @@ -204,7 +214,7 @@ class SermondistributorModelSermon extends ItemModel if ($e->getCode() == 404) { // Need to go thru the error handler to allow Redirect to work. - JError::raiseWarning(404, $e->getMessage()); + JError::raiseError(404, $e->getMessage()); } else { @@ -219,13 +229,13 @@ class SermondistributorModelSermon extends ItemModel // set some default tottals $this->_item[$pk]->statisticTotal = 0; // set the auto links if found - if (isset($this->_item[$pk]->auto_sermons) && SermondistributorHelper::checkString($this->_item[$pk]->auto_sermons)) + if (isset($this->_item[$pk]->auto_sermons) && StringHelper::check($this->_item[$pk]->auto_sermons)) { // Decode the auto files $this->_item[$pk]->auto_sermons = json_decode($this->_item[$pk]->auto_sermons, true); } // set statistic per filename if found - if (isset($this->_item[$pk]->idSermonStatisticD) && SermondistributorHelper::checkArray($this->_item[$pk]->idSermonStatisticD)) + if (isset($this->_item[$pk]->idSermonStatisticD) && UtilitiesArrayHelper::check($this->_item[$pk]->idSermonStatisticD)) { foreach ($this->_item[$pk]->idSermonStatisticD as $statistic) { @@ -246,7 +256,7 @@ class SermondistributorModelSermon extends ItemModel // build the download links SermondistributorHelper::getDownloadLinks($this->_item[$pk]); // fix the scripture links that they will show - if (isset($this->_item[$pk]->scripture) && SermondistributorHelper::checkString($this->_item[$pk]->scripture)) + if (isset($this->_item[$pk]->scripture) && StringHelper::check($this->_item[$pk]->scripture)) { if (strpos(",",$this->_item[$pk]->scripture) !== false) { @@ -262,7 +272,7 @@ class SermondistributorModelSermon extends ItemModel } // now load the getBible taging $scripture = '

    '.implode(' [in]

    ',$scripture).' [in]

    '; - $this->_item[$pk]->scripture = JHtml::_('content.prepare', $scripture); + $this->_item[$pk]->scripture = Html::_('content.prepare', $scripture); } } @@ -278,7 +288,7 @@ class SermondistributorModelSermon extends ItemModel public function getIdSermonStatisticEbbd_D($id) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -311,7 +321,7 @@ class SermondistributorModelSermon extends ItemModel */ public function getUikitComp() { - if (isset($this->uikitComp) && SermondistributorHelper::checkArray($this->uikitComp)) + if (isset($this->uikitComp) && UtilitiesArrayHelper::check($this->uikitComp)) { return $this->uikitComp; } diff --git a/site/router.php b/site/router.php index de417db5..f0d88ae0 100644 --- a/site/router.php +++ b/site/router.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage router.php @@ -25,13 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; + /** * Routing class from com_sermondistributor * * @since 3.3 */ class SermondistributorRouter extends JComponentRouterBase -{ +{ /** * Build the route for the com_sermondistributor component * @@ -43,11 +46,11 @@ class SermondistributorRouter extends JComponentRouterBase */ public function build(&$query) { - $segments = array(); + $segments = []; // Get a menu item based on Itemid or currently active - $params = JComponentHelper::getParams('com_sermondistributor'); - + $params = ComponentHelper::getParams('com_sermondistributor'); + if (empty($query['Itemid'])) { $menuItem = $this->menu->getActive(); @@ -71,7 +74,7 @@ class SermondistributorRouter extends JComponentRouterBase unset($query['view']); } - + // Are we dealing with a item that is attached to a menu item? if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) { @@ -101,7 +104,7 @@ class SermondistributorRouter extends JComponentRouterBase } unset($query['id']); } - + $total = count($segments); for ($i = 0; $i < $total; $i++) @@ -109,8 +112,8 @@ class SermondistributorRouter extends JComponentRouterBase $segments[$i] = str_replace(':', '-', $segments[$i]); } - return $segments; - + return $segments; + } /** @@ -123,10 +126,10 @@ class SermondistributorRouter extends JComponentRouterBase * @since 3.3 */ public function parse(&$segments) - { + { $count = count($segments); - $vars = array(); - + $vars = []; + // Handle View and Identifier switch($segments[0]) { @@ -253,7 +256,7 @@ class SermondistributorRouter extends JComponentRouterBase } return $vars; - } + } protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'sermondistributor') { @@ -262,7 +265,7 @@ class SermondistributorRouter extends JComponentRouterBase return false; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -278,7 +281,7 @@ class SermondistributorRouter extends JComponentRouterBase { // we must check if the table exist (TODO not ideal) $tables = $db->getTableList(); - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $prefix = $app->get('dbprefix'); $check = $prefix.$main.'_'.$table; if (in_array($check, $tables)) @@ -320,7 +323,7 @@ class SermondistributorRouter extends JComponentRouterBase } return false; } - + protected function checkString($string) { if (isset($string) && is_string($string) && strlen($string) > 0) @@ -334,7 +337,7 @@ class SermondistributorRouter extends JComponentRouterBase function SermondistributorBuildRoute(&$query) { $router = new SermondistributorRouter; - + return $router->build($query); } diff --git a/site/sermondistributor.php b/site/sermondistributor.php index cef4810f..fef39832 100644 --- a/site/sermondistributor.php +++ b/site/sermondistributor.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage sermondistributor.php @@ -25,22 +25,68 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// register additional namespace +\spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ]; + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // not found so move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\Controller\BaseController; // Set the component css/js -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_sermondistributor/assets/css/site.css'); -$document->addScript('components/com_sermondistributor/assets/js/site.js'); +Html::_('stylesheet', 'components/com_sermondistributor/assets/css/site.css', ['version' => 'auto']); +Html::_('script', 'components/com_sermondistributor/assets/js/site.js', ['version' => 'auto']); // Require helper files JLoader::register('SermondistributorHelper', __DIR__ . '/helpers/sermondistributor.php'); JLoader::register('SermondistributorHelperRoute', __DIR__ . '/helpers/route.php'); // Get an instance of the controller prefixed by Sermondistributor -$controller = JControllerLegacy::getInstance('Sermondistributor'); +$controller = BaseController::getInstance('Sermondistributor'); // Perform the request task -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller->execute(Factory::getApplication()->input->get('task')); // Redirect if set by the controller $controller->redirect(); diff --git a/site/views/api/submitbutton.js b/site/views/api/submitbutton.js index 4662cc66..f4d41a12 100644 --- a/site/views/api/submitbutton.js +++ b/site/views/api/submitbutton.js @@ -9,7 +9,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage submitbutton.js @@ -25,7 +25,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/site/views/api/tmpl/default.php b/site/views/api/tmpl/default.php index d2981325..a8c0c4f2 100644 --- a/site/views/api/tmpl/default.php +++ b/site/views/api/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,10 +25,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; ?>
    -

    -

    +

    +

    diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index 407ce267..17e655ba 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,7 +25,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Api @@ -34,13 +43,13 @@ class SermondistributorViewApi extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); // do not load the display @@ -49,13 +58,13 @@ class SermondistributorViewApi extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -67,12 +76,15 @@ class SermondistributorViewApi extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -91,12 +103,12 @@ class SermondistributorViewApi extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } } // Use Uikit Version 3 @@ -105,17 +117,17 @@ class SermondistributorViewApi extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/api.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/api.css', ['version' => 'auto']); } /** @@ -123,15 +135,15 @@ class SermondistributorViewApi extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('api'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -144,6 +156,16 @@ class SermondistributorViewApi extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/categories/tmpl/default.php b/site/views/categories/tmpl/default.php index 8d8f173c..428f2c9b 100644 --- a/site/views/categories/tmpl/default.php +++ b/site/views/categories/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; // Set the heading of the page $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading') : ((isset($this->menu->title)) ? $this->menu->title : ''); ?> -
    + params->get('show_page_heading')): ?>

    @@ -45,7 +47,7 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi
    -

    +

    @@ -58,5 +60,5 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi
    toolbar->render(); ?> - + diff --git a/site/views/categories/tmpl/default_categories-grid.php b/site/views/categories/tmpl/default_categories-grid.php index 396dce90..494bfd97 100644 --- a/site/views/categories/tmpl/default_categories-grid.php +++ b/site/views/categories/tmpl/default_categories-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categories-grid.php @@ -25,21 +25,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('categories_hits')): ?> -
    • -
    • +
    • +
    • params->get('categories_sermon_count')): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('categoriespanel', $item); ?>
    +
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('categoriespanel', $item); ?>
    diff --git a/site/views/categories/tmpl/default_categories-list.php b/site/views/categories/tmpl/default_categories-list.php index c28995cc..7cb95724 100644 --- a/site/views/categories/tmpl/default_categories-list.php +++ b/site/views/categories/tmpl/default_categories-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categories-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('categories_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo JLayoutHelper::render('categorieslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo LayoutHelper::render('categorieslistitem', $item); ?>
    diff --git a/site/views/categories/tmpl/default_categories-table.php b/site/views/categories/tmpl/default_categories-table.php index 32ee8c7b..3e74317e 100644 --- a/site/views/categories/tmpl/default_categories-table.php +++ b/site/views/categories/tmpl/default_categories-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categories-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -65,15 +69,15 @@ switch ($color) - + params->get('categories_desc')): ?> - + params->get('categories_hits')): ?> - + params->get('categories_sermon_count')): ?> - + @@ -86,7 +90,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('categoriesrow', $item); ?> + params = $this->params; echo LayoutHelper::render('categoriesrow', $item); ?>
    diff --git a/site/views/categories/view.html.php b/site/views/categories/view.html.php index 838ac01f..4730df1c 100644 --- a/site/views/categories/view.html.php +++ b/site/views/categories/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Categories @@ -35,13 +45,13 @@ class SermondistributorViewCategories extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -71,13 +81,13 @@ class SermondistributorViewCategories extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -89,12 +99,15 @@ class SermondistributorViewCategories extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -113,28 +126,26 @@ class SermondistributorViewCategories extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-tooltip'; $uikitComp[] = 'data-uk-grid'; } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -144,13 +155,13 @@ class SermondistributorViewCategories extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -162,35 +173,35 @@ class SermondistributorViewCategories extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if ($this->params->get('menu-meta_description')) { @@ -207,7 +218,7 @@ class SermondistributorViewCategories extends HtmlView $this->document->setMetadata('robots', $this->params->get('robots')); } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/categories.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/categories.css', ['version' => 'auto']); } /** @@ -215,15 +226,15 @@ class SermondistributorViewCategories extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('categories'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -236,6 +247,16 @@ class SermondistributorViewCategories extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/category/tmpl/default.php b/site/views/category/tmpl/default.php index e6035ddd..819a4a5d 100644 --- a/site/views/category/tmpl/default.php +++ b/site/views/category/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,9 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; ?> -
    + category): ?> params->get('category_display') == 1) : ?>
    loadTemplate('categorypanel'); ?>
    @@ -39,7 +41,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    items): ?> @@ -70,7 +72,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    @@ -83,5 +85,5 @@ defined('_JEXEC') or die('Restricted access');
    toolbar->render(); ?> - + diff --git a/site/views/category/tmpl/default_categorybox.php b/site/views/category/tmpl/default_categorybox.php index b556f85a..47d582b2 100644 --- a/site/views/category/tmpl/default_categorybox.php +++ b/site/views/category/tmpl/default_categorybox.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categorybox.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('category_list_style'); switch ($style) @@ -89,7 +93,7 @@ elseif (!$this->params->get('category_icon')) ?>
    - : category->hits; ?> + : category->hits; ?>
    params->get('category_icon')): ?> @@ -105,10 +109,10 @@ elseif (!$this->params->get('category_icon'))
      params->get('category_sermon_count')): ?> -
    • : sermonTotal; ?>
    • +
    • : sermonTotal; ?>
    • params->get('category_sermons_download_counter')): ?> -
    • : downloadTotal; ?>
    • +
    • : downloadTotal; ?>
    diff --git a/site/views/category/tmpl/default_categorypanel.php b/site/views/category/tmpl/default_categorypanel.php index 2caea8cf..b4ece9c0 100644 --- a/site/views/category/tmpl/default_categorypanel.php +++ b/site/views/category/tmpl/default_categorypanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categorypanel.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('category_list_style'); switch ($style) @@ -77,7 +81,7 @@ elseif (!$this->params->get('category_icon')) ?>
    - : category->hits; ?> + : category->hits; ?>

    category->name; ?>

    @@ -94,10 +98,10 @@ elseif (!$this->params->get('category_icon'))
      params->get('category_sermon_count')): ?> -
    • : sermonTotal; ?>
    • +
    • : sermonTotal; ?>
    • params->get('category_sermons_download_counter')): ?> -
    • : downloadTotal; ?>
    • +
    • : downloadTotal; ?>
    diff --git a/site/views/category/tmpl/default_categorysmall.php b/site/views/category/tmpl/default_categorysmall.php index 3477313b..15d20f7c 100644 --- a/site/views/category/tmpl/default_categorysmall.php +++ b/site/views/category/tmpl/default_categorysmall.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_categorysmall.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
    @@ -38,13 +42,13 @@ defined('_JEXEC') or die('Restricted access'); params->get('category_hits') || $this->params->get('category_sermon_count')): ?>
    params->get('category_hits')): ?> - : category->hits; ?>
    + : category->hits; ?>
    params->get('category_sermon_count')): ?> - : sermonTotal; ?>
    + : sermonTotal; ?>
    params->get('category_sermons_download_counter')): ?> - : downloadTotal; ?>
    + : downloadTotal; ?>
    diff --git a/site/views/category/tmpl/default_sermons-grid.php b/site/views/category/tmpl/default_sermons-grid.php index 4f885c58..7465c400 100644 --- a/site/views/category/tmpl/default_sermons-grid.php +++ b/site/views/category/tmpl/default_sermons-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-grid.php @@ -25,34 +25,38 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('category_sermons_preacher', 0)): ?> -
    • -
    • +
    • +
    • params->get('category_sermons_category', 0)): ?> -
    • -
    • +
    • +
    • params->get('category_sermons_series', 0)): ?> -
    • -
    • +
    • +
    • params->get('category_sermons_hits', 0)): ?> -
    • -
    • +
    • +
    • params->get('category_sermons_download_counter', 0)): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params->get('category_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('category_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('category_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('sermonspanel', $item); ?>
    +
    params->get('category_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('category_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('category_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('sermonspanel', $item); ?>
    diff --git a/site/views/category/tmpl/default_sermons-list.php b/site/views/category/tmpl/default_sermons-list.php index ef424276..58d54700 100644 --- a/site/views/category/tmpl/default_sermons-list.php +++ b/site/views/category/tmpl/default_sermons-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('category_sermons_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo JLayoutHelper::render('sermonslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo LayoutHelper::render('sermonslistitem', $item); ?>
    diff --git a/site/views/category/tmpl/default_sermons-table.php b/site/views/category/tmpl/default_sermons-table.php index e5025f33..d2ffd4b1 100644 --- a/site/views/category/tmpl/default_sermons-table.php +++ b/site/views/category/tmpl/default_sermons-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -66,27 +70,27 @@ switch ($color) - + params->get('category_sermons_desc')): ?> - + params->get('category_sermons_preacher', 0)): ?> - + params->get('category_sermons_series', 0)): ?> - + params->get('category_sermons_category', 0)): ?> - + params->get('category_sermons_downloads')): ?> - + params->get('category_sermons_download_counter')): ?> - + params->get('category_sermons_hits')): ?> - + @@ -99,7 +103,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('sermonsrow', $item); ?> + params = $this->params; echo LayoutHelper::render('sermonsrow', $item); ?>
    diff --git a/site/views/category/view.html.php b/site/views/category/view.html.php index b967d1f2..859f7046 100644 --- a/site/views/category/view.html.php +++ b/site/views/category/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Category @@ -35,13 +45,13 @@ class SermondistributorViewCategory extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -59,7 +69,7 @@ class SermondistributorViewCategory extends HtmlView { foreach ($this->category->idCatidSermonB as $sermon) { - if (isset($sermon->idSermonStatisticC) && SermondistributorHelper::checkArray($sermon->idSermonStatisticC)) + if (isset($sermon->idSermonStatisticC) && ArrayHelper::check($sermon->idSermonStatisticC)) { foreach ($sermon->idSermonStatisticC as $download) { @@ -87,13 +97,13 @@ class SermondistributorViewCategory extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -110,7 +120,7 @@ class SermondistributorViewCategory extends HtmlView { if ($pk) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Fields to update. @@ -137,12 +147,15 @@ class SermondistributorViewCategory extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -161,26 +174,26 @@ class SermondistributorViewCategory extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-grid'; // Get field uikit components needed in this view. $uikitFieldComp = $this->get('UikitComp'); - if (isset($uikitFieldComp) && SermondistributorHelper::checkArray($uikitFieldComp)) + if (isset($uikitFieldComp) && ArrayHelper::check($uikitFieldComp)) { - if (isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if (isset($uikitComp) && ArrayHelper::check($uikitComp)) { $uikitComp = array_merge($uikitComp, $uikitFieldComp); $uikitComp = array_unique($uikitComp); @@ -193,10 +206,8 @@ class SermondistributorViewCategory extends HtmlView } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -206,13 +217,13 @@ class SermondistributorViewCategory extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -224,35 +235,35 @@ class SermondistributorViewCategory extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if (isset($this->category->metadesc) && $this->category->metadesc) { @@ -298,7 +309,7 @@ class SermondistributorViewCategory extends HtmlView } } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/category.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/category.css', ['version' => 'auto']); } /** @@ -306,15 +317,15 @@ class SermondistributorViewCategory extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('category'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -327,6 +338,16 @@ class SermondistributorViewCategory extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/preacher/tmpl/default.php b/site/views/preacher/tmpl/default.php index 855d7094..3f9c0c4c 100644 --- a/site/views/preacher/tmpl/default.php +++ b/site/views/preacher/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,9 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; ?> -
    + preacher): ?> params->get('preacher_display') == 1) : ?>
    loadTemplate('preacherpanel'); ?>
    @@ -39,7 +41,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    items): ?> @@ -70,7 +72,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    @@ -84,5 +86,5 @@ defined('_JEXEC') or die('Restricted access');
    toolbar->render(); ?> - + diff --git a/site/views/preacher/tmpl/default_preacherbox.php b/site/views/preacher/tmpl/default_preacherbox.php index 4f34749c..cd9348a8 100644 --- a/site/views/preacher/tmpl/default_preacherbox.php +++ b/site/views/preacher/tmpl/default_preacherbox.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preacherbox.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('preacher_list_style'); switch ($style) @@ -89,7 +93,7 @@ elseif (!$this->params->get('preacher_icon')) ?>
    - : preacher->hits; ?> + : preacher->hits; ?>
    params->get('preacher_icon')): ?> @@ -105,16 +109,16 @@ elseif (!$this->params->get('preacher_icon'))
    diff --git a/site/views/preacher/tmpl/default_preacherpanel.php b/site/views/preacher/tmpl/default_preacherpanel.php index 727527a4..9e8ec224 100644 --- a/site/views/preacher/tmpl/default_preacherpanel.php +++ b/site/views/preacher/tmpl/default_preacherpanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preacherpanel.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('preacher_list_style'); switch ($style) @@ -77,7 +81,7 @@ elseif (!$this->params->get('preacher_icon')) ?>
    - : preacher->hits; ?> + : preacher->hits; ?>

    preacher->name; ?>

    @@ -94,16 +98,16 @@ elseif (!$this->params->get('preacher_icon'))
    diff --git a/site/views/preacher/tmpl/default_preachersmall.php b/site/views/preacher/tmpl/default_preachersmall.php index f16fd491..eb3aff71 100644 --- a/site/views/preacher/tmpl/default_preachersmall.php +++ b/site/views/preacher/tmpl/default_preachersmall.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preachersmall.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
    @@ -41,19 +45,19 @@ defined('_JEXEC') or die('Restricted access'); || $this->params->get('preacher_sermon_count')): ?>
    params->get('preacher_hits')): ?> - : preacher->hits; ?>
    + : preacher->hits; ?>
    params->get('preacher_sermon_count')): ?> - : sermonTotal; ?>
    + : sermonTotal; ?>
    params->get('preacher_sermons_download_counter')): ?> - : downloadTotal; ?>
    + : downloadTotal; ?>
    params->get('preacher_website') && $this->preacher->website): ?> - preacher->website; ?>
    + preacher->website; ?>
    params->get('preacher_email') && $this->preacher->email): ?> - preacher->email; ?>
    + preacher->email; ?>
    diff --git a/site/views/preacher/tmpl/default_sermons-grid.php b/site/views/preacher/tmpl/default_sermons-grid.php index 347dcd04..16df790c 100644 --- a/site/views/preacher/tmpl/default_sermons-grid.php +++ b/site/views/preacher/tmpl/default_sermons-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-grid.php @@ -25,34 +25,38 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('preacher_sermons_preacher', 0)): ?> -
    • -
    • +
    • +
    • params->get('preacher_sermons_category', 0)): ?> -
    • -
    • +
    • +
    • params->get('preacher_sermons_series', 0)): ?> -
    • -
    • +
    • +
    • params->get('preacher_sermons_hits', 0)): ?> -
    • -
    • +
    • +
    • params->get('preacher_sermons_download_counter', 0)): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params->get('preacher_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('preacher_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('preacher_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('sermonspanel', $item); ?>
    +
    params->get('preacher_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('preacher_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('preacher_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('sermonspanel', $item); ?>
    diff --git a/site/views/preacher/tmpl/default_sermons-list.php b/site/views/preacher/tmpl/default_sermons-list.php index da5fbdf2..0bce759e 100644 --- a/site/views/preacher/tmpl/default_sermons-list.php +++ b/site/views/preacher/tmpl/default_sermons-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('preacher_sermons_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo JLayoutHelper::render('sermonslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo LayoutHelper::render('sermonslistitem', $item); ?>
    diff --git a/site/views/preacher/tmpl/default_sermons-table.php b/site/views/preacher/tmpl/default_sermons-table.php index fec187c5..5726432e 100644 --- a/site/views/preacher/tmpl/default_sermons-table.php +++ b/site/views/preacher/tmpl/default_sermons-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -66,27 +70,27 @@ switch ($color) - + params->get('preacher_sermons_desc')): ?> - + params->get('preacher_sermons_preacher', 0)): ?> - + params->get('preacher_sermons_series', 0)): ?> - + params->get('preacher_sermons_category', 0)): ?> - + params->get('preacher_sermons_downloads')): ?> - + params->get('preacher_sermons_download_counter')): ?> - + params->get('preacher_sermons_hits')): ?> - + @@ -99,7 +103,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('sermonsrow', $item); ?> + params = $this->params; echo LayoutHelper::render('sermonsrow', $item); ?>
    diff --git a/site/views/preacher/view.html.php b/site/views/preacher/view.html.php index 6307627d..21658582 100644 --- a/site/views/preacher/view.html.php +++ b/site/views/preacher/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Preacher @@ -35,13 +45,13 @@ class SermondistributorViewPreacher extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -56,7 +66,7 @@ class SermondistributorViewPreacher extends HtmlView // set some total defaults $this->sermonTotal = count($this->numbersermons); $this->downloadTotal = 0; - if (isset($this->numberdownloads) && SermondistributorHelper::checkArray($this->numberdownloads)) + if (isset($this->numberdownloads) && ArrayHelper::check($this->numberdownloads)) { foreach ($this->numberdownloads as $download) { @@ -81,13 +91,13 @@ class SermondistributorViewPreacher extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -105,7 +115,7 @@ class SermondistributorViewPreacher extends HtmlView { if ($pk) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Fields to update. @@ -132,12 +142,15 @@ class SermondistributorViewPreacher extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -156,27 +169,27 @@ class SermondistributorViewPreacher extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-grid'; $uikitComp[] = 'data-uk-tooltip'; // Get field uikit components needed in this view. $uikitFieldComp = $this->get('UikitComp'); - if (isset($uikitFieldComp) && SermondistributorHelper::checkArray($uikitFieldComp)) + if (isset($uikitFieldComp) && ArrayHelper::check($uikitFieldComp)) { - if (isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if (isset($uikitComp) && ArrayHelper::check($uikitComp)) { $uikitComp = array_merge($uikitComp, $uikitFieldComp); $uikitComp = array_unique($uikitComp); @@ -189,10 +202,8 @@ class SermondistributorViewPreacher extends HtmlView } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -202,13 +213,13 @@ class SermondistributorViewPreacher extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -220,35 +231,35 @@ class SermondistributorViewPreacher extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if (isset($this->preacher->metadesc) && $this->preacher->metadesc) { @@ -294,7 +305,7 @@ class SermondistributorViewPreacher extends HtmlView } } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/preacher.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/preacher.css', ['version' => 'auto']); } /** @@ -302,15 +313,15 @@ class SermondistributorViewPreacher extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('preacher'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -323,6 +334,16 @@ class SermondistributorViewPreacher extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/preachers/tmpl/default.php b/site/views/preachers/tmpl/default.php index ff017bd6..dba10043 100644 --- a/site/views/preachers/tmpl/default.php +++ b/site/views/preachers/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; // Set the heading of the page $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading') : ((isset($this->menu->title)) ? $this->menu->title : ''); ?> -
    + params->get('show_page_heading')): ?>

    @@ -45,7 +47,7 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi
    -

    +

    @@ -58,5 +60,5 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi
    toolbar->render(); ?> - + diff --git a/site/views/preachers/tmpl/default_preachers-grid.php b/site/views/preachers/tmpl/default_preachers-grid.php index c662d273..cadb395a 100644 --- a/site/views/preachers/tmpl/default_preachers-grid.php +++ b/site/views/preachers/tmpl/default_preachers-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preachers-grid.php @@ -25,21 +25,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('preachers_hits')): ?> -
    • -
    • +
    • +
    • params->get('preachers_sermon_count')): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('preacherspanel', $item); ?>
    +
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('preacherspanel', $item); ?>
    diff --git a/site/views/preachers/tmpl/default_preachers-list.php b/site/views/preachers/tmpl/default_preachers-list.php index b5d7bb35..df98e05e 100644 --- a/site/views/preachers/tmpl/default_preachers-list.php +++ b/site/views/preachers/tmpl/default_preachers-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preachers-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('preachers_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo JLayoutHelper::render('preacherslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo LayoutHelper::render('preacherslistitem', $item); ?>
    diff --git a/site/views/preachers/tmpl/default_preachers-table.php b/site/views/preachers/tmpl/default_preachers-table.php index e7cf9e40..045c1b67 100644 --- a/site/views/preachers/tmpl/default_preachers-table.php +++ b/site/views/preachers/tmpl/default_preachers-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_preachers-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -65,21 +69,21 @@ switch ($color) - + params->get('preachers_desc')): ?> - + params->get('preachers_website')): ?> - + params->get('preachers_email')): ?> - + params->get('preachers_hits')): ?> - + params->get('preachers_sermon_count')): ?> - + @@ -92,7 +96,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('preachersrow', $item); ?> + params = $this->params; echo LayoutHelper::render('preachersrow', $item); ?>
    diff --git a/site/views/preachers/view.html.php b/site/views/preachers/view.html.php index 1e02048c..f1064704 100644 --- a/site/views/preachers/view.html.php +++ b/site/views/preachers/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Preachers @@ -35,13 +45,13 @@ class SermondistributorViewPreachers extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -71,13 +81,13 @@ class SermondistributorViewPreachers extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -89,12 +99,15 @@ class SermondistributorViewPreachers extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -113,27 +126,27 @@ class SermondistributorViewPreachers extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-tooltip'; $uikitComp[] = 'data-uk-grid'; // Get field uikit components needed in this view. $uikitFieldComp = $this->get('UikitComp'); - if (isset($uikitFieldComp) && SermondistributorHelper::checkArray($uikitFieldComp)) + if (isset($uikitFieldComp) && ArrayHelper::check($uikitFieldComp)) { - if (isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if (isset($uikitComp) && ArrayHelper::check($uikitComp)) { $uikitComp = array_merge($uikitComp, $uikitFieldComp); $uikitComp = array_unique($uikitComp); @@ -146,10 +159,8 @@ class SermondistributorViewPreachers extends HtmlView } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -159,13 +170,13 @@ class SermondistributorViewPreachers extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -177,35 +188,35 @@ class SermondistributorViewPreachers extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if ($this->params->get('menu-meta_description')) { @@ -222,7 +233,7 @@ class SermondistributorViewPreachers extends HtmlView $this->document->setMetadata('robots', $this->params->get('robots')); } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/preachers.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/preachers.css', ['version' => 'auto']); } /** @@ -230,15 +241,15 @@ class SermondistributorViewPreachers extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('preachers'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -251,6 +262,16 @@ class SermondistributorViewPreachers extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/series/tmpl/default.php b/site/views/series/tmpl/default.php index 7fd05622..86eb0993 100644 --- a/site/views/series/tmpl/default.php +++ b/site/views/series/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,9 +25,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; ?> -
    + series): ?> params->get('series_display') == 1) : ?>
    loadTemplate('seriespanel'); ?>
    @@ -39,7 +41,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    items): ?> @@ -70,7 +72,7 @@ defined('_JEXEC') or die('Restricted access');
    -

    +

    @@ -83,5 +85,5 @@ defined('_JEXEC') or die('Restricted access'); toolbar->render(); ?> - +
    diff --git a/site/views/series/tmpl/default_seriesbox.php b/site/views/series/tmpl/default_seriesbox.php index 818594ca..429ebcf5 100644 --- a/site/views/series/tmpl/default_seriesbox.php +++ b/site/views/series/tmpl/default_seriesbox.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_seriesbox.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('series_list_style'); switch ($style) @@ -89,7 +93,7 @@ elseif (!$this->params->get('series_icon')) ?>
    - : series->hits; ?> + : series->hits; ?>
    params->get('series_icon')): ?> @@ -105,10 +109,10 @@ elseif (!$this->params->get('series_icon'))
      params->get('series_sermon_count')): ?> -
    • : sermonTotal; ?>
    • +
    • : sermonTotal; ?>
    • params->get('series_sermons_download_counter')): ?> -
    • : downloadTotal; ?>
    • +
    • : downloadTotal; ?>
    diff --git a/site/views/series/tmpl/default_seriespanel.php b/site/views/series/tmpl/default_seriespanel.php index 252b9462..97e56029 100644 --- a/site/views/series/tmpl/default_seriespanel.php +++ b/site/views/series/tmpl/default_seriespanel.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_seriespanel.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('series_list_style'); switch ($style) @@ -77,7 +81,7 @@ elseif (!$this->params->get('series_icon')) ?>
    - : series->hits; ?> + : series->hits; ?>

    series->name; ?>

    @@ -94,10 +98,10 @@ elseif (!$this->params->get('series_icon'))
      params->get('series_sermon_count')): ?> -
    • : sermonTotal; ?>
    • +
    • : sermonTotal; ?>
    • params->get('series_sermons_download_counter')): ?> -
    • : downloadTotal; ?>
    • +
    • : downloadTotal; ?>
    diff --git a/site/views/series/tmpl/default_seriessmall.php b/site/views/series/tmpl/default_seriessmall.php index 52343b50..c6d17421 100644 --- a/site/views/series/tmpl/default_seriessmall.php +++ b/site/views/series/tmpl/default_seriessmall.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_seriessmall.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
    @@ -38,13 +42,13 @@ defined('_JEXEC') or die('Restricted access'); params->get('series_hits') || $this->params->get('series_sermon_count') || $this->params->get('series_sermons_download_counter')): ?>
    params->get('series_hits')): ?> - : series->hits; ?>
    + : series->hits; ?>
    params->get('series_sermon_count')): ?> - : sermonTotal; ?>
    + : sermonTotal; ?>
    params->get('series_sermons_download_counter')): ?> - : downloadTotal; ?>
    + : downloadTotal; ?>
    diff --git a/site/views/series/tmpl/default_sermons-grid.php b/site/views/series/tmpl/default_sermons-grid.php index bb565143..00760818 100644 --- a/site/views/series/tmpl/default_sermons-grid.php +++ b/site/views/series/tmpl/default_sermons-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-grid.php @@ -25,34 +25,38 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('series_sermons_preacher', 0)): ?> -
    • -
    • +
    • +
    • params->get('series_sermons_category', 0)): ?> -
    • -
    • +
    • +
    • params->get('series_sermons_series', 0)): ?> -
    • -
    • +
    • +
    • params->get('series_sermons_hits', 0)): ?> -
    • -
    • +
    • +
    • params->get('series_sermons_download_counter', 0)): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params->get('series_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('series_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('series_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('sermonspanel', $item); ?>
    +
    params->get('series_sermons_preacher')): ?>data-preacher="escape($item->preacher_name); ?>" params->get('series_sermons_category')): ?> data-category="escape($item->category); ?>" params->get('series_sermons_series')): ?> data-series="escape($item->series_name); ?>" data-hits="hits; ?>" data-downloads="statisticTotal; ?>">params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('sermonspanel', $item); ?>
    diff --git a/site/views/series/tmpl/default_sermons-list.php b/site/views/series/tmpl/default_sermons-list.php index acec7f81..381d0332 100644 --- a/site/views/series/tmpl/default_sermons-list.php +++ b/site/views/series/tmpl/default_sermons-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('series_sermons_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo JLayoutHelper::render('sermonslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 90); echo LayoutHelper::render('sermonslistitem', $item); ?>
    diff --git a/site/views/series/tmpl/default_sermons-table.php b/site/views/series/tmpl/default_sermons-table.php index 7c4405a5..a52a1a02 100644 --- a/site/views/series/tmpl/default_sermons-table.php +++ b/site/views/series/tmpl/default_sermons-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_sermons-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -66,27 +70,27 @@ switch ($color) - + params->get('series_sermons_desc')): ?> - + params->get('series_sermons_preacher', 0)): ?> - + params->get('series_sermons_series', 0)): ?> - + params->get('series_sermons_category', 0)): ?> - + params->get('series_sermons_downloads')): ?> - + params->get('series_sermons_download_counter')): ?> - + params->get('series_sermons_hits')): ?> - + @@ -99,7 +103,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('sermonsrow', $item); ?> + params = $this->params; echo LayoutHelper::render('sermonsrow', $item); ?>
    diff --git a/site/views/series/view.html.php b/site/views/series/view.html.php index 6bcef520..4f403137 100644 --- a/site/views/series/view.html.php +++ b/site/views/series/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Series @@ -35,13 +45,13 @@ class SermondistributorViewSeries extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -56,7 +66,7 @@ class SermondistributorViewSeries extends HtmlView // set some total defaults $this->sermonTotal = count($this->numbersermons); $this->downloadTotal = 0; - if (isset($this->numberdownloads) && SermondistributorHelper::checkArray($this->numberdownloads)) + if (isset($this->numberdownloads) && ArrayHelper::check($this->numberdownloads)) { foreach ($this->numberdownloads as $download) { @@ -81,13 +91,13 @@ class SermondistributorViewSeries extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -105,7 +115,7 @@ class SermondistributorViewSeries extends HtmlView { if ($pk) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Fields to update. @@ -132,12 +142,15 @@ class SermondistributorViewSeries extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -156,26 +169,26 @@ class SermondistributorViewSeries extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-grid'; // Get field uikit components needed in this view. $uikitFieldComp = $this->get('UikitComp'); - if (isset($uikitFieldComp) && SermondistributorHelper::checkArray($uikitFieldComp)) + if (isset($uikitFieldComp) && ArrayHelper::check($uikitFieldComp)) { - if (isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if (isset($uikitComp) && ArrayHelper::check($uikitComp)) { $uikitComp = array_merge($uikitComp, $uikitFieldComp); $uikitComp = array_unique($uikitComp); @@ -188,10 +201,8 @@ class SermondistributorViewSeries extends HtmlView } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -201,13 +212,13 @@ class SermondistributorViewSeries extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -219,35 +230,35 @@ class SermondistributorViewSeries extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if (isset($this->series->metadesc) && $this->series->metadesc) { @@ -293,7 +304,7 @@ class SermondistributorViewSeries extends HtmlView } } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/series.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/series.css', ['version' => 'auto']); } /** @@ -301,15 +312,15 @@ class SermondistributorViewSeries extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('series'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -322,6 +333,16 @@ class SermondistributorViewSeries extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/serieslist/tmpl/default.php b/site/views/serieslist/tmpl/default.php index 61dd6998..11739747 100644 --- a/site/views/serieslist/tmpl/default.php +++ b/site/views/serieslist/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,12 +25,14 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; // Set the heading of the page $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading') : ((isset($this->menu->title)) ? $this->menu->title : ''); ?> -
    + params->get('show_page_heading')): ?>

    @@ -45,7 +47,7 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi
    -

    +

    @@ -58,5 +60,5 @@ $heading = ($this->params->get('page_heading')) ? $this->params->get('page_headi - +
    diff --git a/site/views/serieslist/tmpl/default_series-grid.php b/site/views/serieslist/tmpl/default_series-grid.php index 1f706653..089cc2a6 100644 --- a/site/views/serieslist/tmpl/default_series-grid.php +++ b/site/views/serieslist/tmpl/default_series-grid.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_series-grid.php @@ -25,21 +25,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?>
      -
    • -
    • +
    • +
    • params->get('list_series_hits')): ?> -
    • -
    • +
    • +
    • params->get('list_series_sermon_count')): ?> -
    • -
    • +
    • +
    items as $item): ?> -
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo JLayoutHelper::render('seriespanel', $item); ?>
    +
    params = $this->params; $item->desc = $this->escape($item->description, true, 65); echo LayoutHelper::render('seriespanel', $item); ?>
    diff --git a/site/views/serieslist/tmpl/default_series-list.php b/site/views/serieslist/tmpl/default_series-list.php index 282c6242..10ed2afa 100644 --- a/site/views/serieslist/tmpl/default_series-list.php +++ b/site/views/serieslist/tmpl/default_series-list.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_series-list.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // build the list class $style = $this->params->get('list_series_list_style'); switch ($style) @@ -50,6 +54,6 @@ switch ($style) ?>
      items as $item): ?> -
    • params = $this->params; $item->desc = $this->escape($item->description, true, 140); echo JLayoutHelper::render('serieslistitem', $item); ?>
    • +
    • params = $this->params; $item->desc = $this->escape($item->description, true, 140); echo LayoutHelper::render('serieslistitem', $item); ?>
    diff --git a/site/views/serieslist/tmpl/default_series-table.php b/site/views/serieslist/tmpl/default_series-table.php index 92cb8234..8378f731 100644 --- a/site/views/serieslist/tmpl/default_series-table.php +++ b/site/views/serieslist/tmpl/default_series-table.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default_series-table.php @@ -25,6 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + // Column counter $column_nr = 1; // build the table class @@ -65,15 +69,15 @@ switch ($color) - + params->get('list_series_desc')): ?> - + params->get('list_series_hits')): ?> - + params->get('list_series_sermon_count')): ?> - + @@ -86,7 +90,7 @@ switch ($color) items as $item): ?> - params = $this->params; echo JLayoutHelper::render('seriesrow', $item); ?> + params = $this->params; echo LayoutHelper::render('seriesrow', $item); ?>
    diff --git a/site/views/serieslist/view.html.php b/site/views/serieslist/view.html.php index 77a0ccc2..3817b48b 100644 --- a/site/views/serieslist/view.html.php +++ b/site/views/serieslist/view.html.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage view.html.php @@ -25,8 +25,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Filesystem\File; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Sermondistributor Html View class for the Serieslist @@ -35,13 +45,13 @@ class SermondistributorViewSerieslist extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -71,13 +81,13 @@ class SermondistributorViewSerieslist extends HtmlView // Set the toolbar $this->addToolBar(); - // set the document + // Set the html view document stuff $this->_prepareDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -89,12 +99,15 @@ class SermondistributorViewSerieslist extends HtmlView protected function _prepareDocument() { - // always make sure jquery is loaded. - JHtml::_('jquery.framework'); + // Only load jQuery if needed. (default is true) + if ($this->params->get('add_jquery_framework', 1) == 1) + { + Html::_('jquery.framework'); + } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); // Initialize the header checker. - $HeaderCheck = new sermondistributorHeaderCheck; + $HeaderCheck = new sermondistributorHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -113,27 +126,27 @@ class SermondistributorViewSerieslist extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']); } // Load the script to find all uikit components needed. if ($uikit != 2) { // Set the default uikit components in this view. - $uikitComp = array(); + $uikitComp = []; $uikitComp[] = 'data-uk-tooltip'; $uikitComp[] = 'data-uk-grid'; // Get field uikit components needed in this view. $uikitFieldComp = $this->get('UikitComp'); - if (isset($uikitFieldComp) && SermondistributorHelper::checkArray($uikitFieldComp)) + if (isset($uikitFieldComp) && ArrayHelper::check($uikitFieldComp)) { - if (isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if (isset($uikitComp) && ArrayHelper::check($uikitComp)) { $uikitComp = array_merge($uikitComp, $uikitFieldComp); $uikitComp = array_unique($uikitComp); @@ -146,10 +159,8 @@ class SermondistributorViewSerieslist extends HtmlView } // Load the needed uikit components in this view. - if ($uikit != 2 && isset($uikitComp) && SermondistributorHelper::checkArray($uikitComp)) + if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { @@ -159,13 +170,13 @@ class SermondistributorViewSerieslist extends HtmlView if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']); } // check if the JavaScript file exists. if (File::exists(JPATH_ROOT.'/media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. - JHtml::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); + Html::_('script', 'media/com_sermondistributor/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']); } } } @@ -177,35 +188,35 @@ class SermondistributorViewSerieslist extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); } // The uikit js. if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } } // Add the CSS for Footable. - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.core.min.css', ['version' => 'auto']); // Use the Metro Style if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.metro.min.css', ['version' => 'auto']); } // Use the Legacy Style. elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) { - JHtml::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_sermondistributor/footable-v2/css/footable.standalone.min.css', ['version' => 'auto']); } // Add the JavaScript for Footable - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.sort.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.filter.js', ['version' => 'auto']); + Html::_('script', 'media/com_sermondistributor/footable-v2/js/footable.paginate.js', ['version' => 'auto']); // load the meta description if ($this->params->get('menu-meta_description')) { @@ -222,7 +233,7 @@ class SermondistributorViewSerieslist extends HtmlView $this->document->setMetadata('robots', $this->params->get('robots')); } // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_sermondistributor/assets/css/serieslist.css', (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + Html::_('stylesheet', 'components/com_sermondistributor/assets/css/serieslist.css', ['version' => 'auto']); } /** @@ -230,15 +241,15 @@ class SermondistributorViewSerieslist extends HtmlView */ protected function addToolBar() { - + // set help url for this view if found $this->help_url = SermondistributorHelper::getHelpUrl('serieslist'); - if (SermondistributorHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -251,6 +262,16 @@ class SermondistributorViewSerieslist extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return SermondistributorHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); + } + + /** + * Get the Document (helper method toward Joomla 4 and 5) + */ + public function getDocument() + { + $this->document ??= JFactory::getDocument(); + + return $this->document; } } diff --git a/site/views/sermon/tmpl/default.php b/site/views/sermon/tmpl/default.php index 8cfb362b..7c4a797c 100644 --- a/site/views/sermon/tmpl/default.php +++ b/site/views/sermon/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.1.x + @version 3.0.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -25,7 +25,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use VDM\Joomla\Utilities\StringHelper; ?> item): ?> @@ -36,7 +39,7 @@ defined('_JEXEC') or die('Restricted access'); loadTemplate('sermonbig'); ?> - item->scripture) && SermondistributorHelper::checkString($this->item->scripture)): ?> + item->scripture) && StringHelper::check($this->item->scripture)): ?>
    item->scripture; ?>
    diff --git a/site/views/category/view.html.php b/site/views/category/view.html.php index 859f7046..a7381195 100644 --- a/site/views/category/view.html.php +++ b/site/views/category/view.html.php @@ -109,7 +109,7 @@ class SermondistributorViewCategory extends HtmlView parent::display($tpl); } - /** + /** * Increment the hit counter for the category. * * @param integer $pk Primary key of the category to increment. diff --git a/site/views/preacher/tmpl/default.php b/site/views/preacher/tmpl/default.php index 54928edb..87239458 100644 --- a/site/views/preacher/tmpl/default.php +++ b/site/views/preacher/tmpl/default.php @@ -54,20 +54,31 @@ use Joomla\CMS\HTML\HTMLHelper as Html; loadTemplate('sermons-list'); ?> diff --git a/site/views/preacher/view.html.php b/site/views/preacher/view.html.php index 21658582..f8e2481d 100644 --- a/site/views/preacher/view.html.php +++ b/site/views/preacher/view.html.php @@ -133,8 +133,7 @@ class SermondistributorViewPreacher extends HtmlView return $db->execute(); } return false; - } - + } /** * Prepares the document diff --git a/site/views/preachers/view.html.php b/site/views/preachers/view.html.php index f1064704..1238854c 100644 --- a/site/views/preachers/view.html.php +++ b/site/views/preachers/view.html.php @@ -60,7 +60,7 @@ class SermondistributorViewPreachers extends HtmlView { foreach ($this->items as $nr => &$item) { - $item->link = JRoute::_(SermondistributorHelperRoute::getPreacherRoute($item->slug)); + $item->link = \JRoute::_(SermondistributorHelperRoute::getPreacherRoute($item->slug)); } } // set the FooTable style diff --git a/site/views/series/tmpl/default.php b/site/views/series/tmpl/default.php index d39c77b2..16a4d125 100644 --- a/site/views/series/tmpl/default.php +++ b/site/views/series/tmpl/default.php @@ -29,6 +29,7 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Session\Session; ?>
    series): ?> @@ -54,20 +55,31 @@ use Joomla\CMS\HTML\HTMLHelper as Html; loadTemplate('sermons-list'); ?> diff --git a/site/views/series/view.html.php b/site/views/series/view.html.php index 4f403137..7ff30366 100644 --- a/site/views/series/view.html.php +++ b/site/views/series/view.html.php @@ -133,8 +133,7 @@ class SermondistributorViewSeries extends HtmlView return $db->execute(); } return false; - } - + } /** * Prepares the document diff --git a/site/views/serieslist/view.html.php b/site/views/serieslist/view.html.php index 3817b48b..b37e1176 100644 --- a/site/views/serieslist/view.html.php +++ b/site/views/serieslist/view.html.php @@ -60,7 +60,7 @@ class SermondistributorViewSerieslist extends HtmlView { foreach ($this->items as $nr => &$item) { - $item->link = JRoute::_(SermondistributorHelperRoute::getSeriesRoute($item->slug)); + $item->link = \JRoute::_(SermondistributorHelperRoute::getSeriesRoute($item->slug)); } } // set the FooTable style diff --git a/site/views/sermon/tmpl/default.php b/site/views/sermon/tmpl/default.php index 20607120..eeec4797 100644 --- a/site/views/sermon/tmpl/default.php +++ b/site/views/sermon/tmpl/default.php @@ -44,20 +44,31 @@ use VDM\Joomla\Utilities\StringHelper;
    item->scripture; ?>