From 8d583feb3f9bfdee36ecbd8268a0929e35aa8241 Mon Sep 17 00:00:00 2001 From: aB0t Date: Sat, 23 Dec 2023 18:05:05 +0200 Subject: [PATCH] Stable release of v2.1.0 Move all JText to use the namespaced class Text directly. Move all JHtml to use the namespaced class Html directly. Move all JFactory to use the namespaced class Factory directly. Move all JRoute to use the namespaced class Route directly. Move all JFormHelper to use the namespaced class FormHelper directly. Move all JLayout to use the namespaced class FileLayout directly. Move all JLanguageMultilang to use the namespaced class Multilanguage directly. Move all JComponentHelper to use the namespaced class ComponentHelper directly. Move all JCategoryNode to use the namespaced class CategoryNode directly. Move all JComponentHelper to use the namespaced class ComponentHelper directly. Move all JToolbar to use the namespaced class Toolbar directly. Move all JToolbarHelper to use the namespaced class ToolbarHelper directly. Convert all addStyleSheet to make use of Html class instead. Convert all addScript to make use of Html class instead. --- CHANGELOG.md | 17 ++ README.md | 26 +- admin/README.txt | 26 +- admin/controller.php | 22 +- admin/controllers/ajax.json.php | 12 +- admin/controllers/book.php | 57 ++-- admin/controllers/books.php | 66 ++-- admin/controllers/chapter.php | 57 ++-- admin/controllers/chapters.php | 4 + admin/controllers/getbible.php | 4 + admin/controllers/linker.php | 57 ++-- admin/controllers/linkers.php | 4 + admin/controllers/note.php | 57 ++-- admin/controllers/notes.php | 4 + admin/controllers/open_ai_message.php | 57 ++-- admin/controllers/open_ai_messages.php | 4 + admin/controllers/open_ai_response.php | 57 ++-- admin/controllers/open_ai_responses.php | 4 + admin/controllers/password.php | 57 ++-- admin/controllers/passwords.php | 4 + admin/controllers/prompt.php | 57 ++-- admin/controllers/prompts.php | 4 + admin/controllers/tag.php | 57 ++-- admin/controllers/tagged_verse.php | 57 ++-- admin/controllers/tagged_verses.php | 4 + admin/controllers/tags.php | 4 + admin/controllers/translation.php | 57 ++-- admin/controllers/translations.php | 54 ++-- admin/controllers/verse.php | 57 ++-- admin/controllers/verses.php | 4 + admin/getbible.php | 20 +- admin/helpers/getbible.php | 94 +++--- admin/helpers/headercheck.php | 48 ++- admin/helpers/html/batch_.php | 2 +- admin/layouts/batchselection.php | 5 +- admin/layouts/book/details_above.php | 2 +- admin/layouts/book/details_left.php | 2 +- admin/layouts/book/details_right.php | 2 +- admin/layouts/book/publishing.php | 2 +- admin/layouts/book/publlshing.php | 2 +- admin/layouts/chapter/details_above.php | 2 +- admin/layouts/chapter/details_left.php | 2 +- admin/layouts/chapter/details_right.php | 2 +- admin/layouts/chapter/publishing.php | 2 +- admin/layouts/chapter/publlshing.php | 2 +- admin/layouts/linker/details_above.php | 2 +- admin/layouts/linker/details_left.php | 2 +- admin/layouts/linker/details_right.php | 2 +- admin/layouts/linker/notes_fullwidth.php | 49 +-- admin/layouts/linker/passwords_fullwidth.php | 47 +-- admin/layouts/linker/publishing.php | 2 +- admin/layouts/linker/publlshing.php | 2 +- admin/layouts/linker/tags_fullwidth.php | 53 ++-- admin/layouts/note/details_above.php | 2 +- admin/layouts/note/details_left.php | 2 +- admin/layouts/note/details_right.php | 2 +- admin/layouts/note/publishing.php | 2 +- admin/layouts/note/publlshing.php | 2 +- .../layouts/open_ai_message/message_above.php | 2 +- .../open_ai_message/message_fullwidth.php | 2 +- .../layouts/open_ai_message/message_left.php | 2 +- .../layouts/open_ai_message/message_right.php | 2 +- admin/layouts/open_ai_message/publishing.php | 2 +- admin/layouts/open_ai_message/publlshing.php | 2 +- admin/layouts/open_ai_response/bible_left.php | 2 +- .../layouts/open_ai_response/bible_right.php | 2 +- .../open_ai_response/details_above.php | 2 +- .../layouts/open_ai_response/details_left.php | 2 +- .../open_ai_response/details_right.php | 2 +- .../open_ai_response/message_fullwidth.php | 51 ++-- .../layouts/open_ai_response/prompt_left.php | 2 +- .../layouts/open_ai_response/prompt_right.php | 2 +- admin/layouts/open_ai_response/publishing.php | 2 +- admin/layouts/open_ai_response/publlshing.php | 2 +- admin/layouts/password/details_above.php | 2 +- admin/layouts/password/details_left.php | 2 +- admin/layouts/password/details_right.php | 2 +- admin/layouts/password/publishing.php | 2 +- admin/layouts/password/publlshing.php | 2 +- admin/layouts/prompt/open_ai_left.php | 9 +- admin/layouts/prompt/open_ai_right.php | 5 + admin/layouts/prompt/prompt_above.php | 2 +- admin/layouts/prompt/prompt_fullwidth.php | 2 +- admin/layouts/prompt/prompt_left.php | 2 +- admin/layouts/prompt/prompt_right.php | 2 +- admin/layouts/prompt/publishing.php | 2 +- admin/layouts/prompt/publlshing.php | 2 +- admin/layouts/tag/details_above.php | 2 +- admin/layouts/tag/details_fullwidth.php | 2 +- admin/layouts/tag/details_left.php | 2 +- admin/layouts/tag/publishing.php | 2 +- admin/layouts/tag/publlshing.php | 2 +- admin/layouts/tagged_verse/details_above.php | 2 +- admin/layouts/tagged_verse/details_left.php | 2 +- admin/layouts/tagged_verse/details_right.php | 2 +- admin/layouts/tagged_verse/publishing.php | 2 +- admin/layouts/tagged_verse/publlshing.php | 2 +- admin/layouts/translation/details_above.php | 2 +- .../layouts/translation/details_fullwidth.php | 2 +- admin/layouts/translation/details_left.php | 2 +- admin/layouts/translation/details_right.php | 2 +- admin/layouts/translation/publishing.php | 2 +- admin/layouts/translation/publlshing.php | 2 +- admin/layouts/trashhelper.php | 21 +- admin/layouts/verse/details_above.php | 2 +- admin/layouts/verse/details_fullwidth.php | 2 +- admin/layouts/verse/details_left.php | 2 +- admin/layouts/verse/details_right.php | 2 +- admin/layouts/verse/publishing.php | 2 +- admin/layouts/verse/publlshing.php | 2 +- admin/models/ajax.php | 31 +- admin/models/book.php | 123 ++++---- admin/models/books.php | 39 ++- admin/models/chapter.php | 123 ++++---- admin/models/chapters.php | 47 +-- admin/models/fields/booksfiltername.php | 10 +- admin/models/fields/booksfilternr.php | 10 +- admin/models/fields/chaptersfilterbooknr.php | 8 +- admin/models/fields/chaptersfilterchapter.php | 8 +- admin/models/fields/linkers.php | 14 +- admin/models/fields/linkersfiltername.php | 10 +- .../fields/linkersfilterpublicnotes.php | 10 +- .../linkersfilterpublictaggedverses.php | 10 +- admin/models/fields/notesfilteraccess.php | 10 +- admin/models/fields/notesfilterbooknr.php | 10 +- admin/models/fields/notesfilterchapter.php | 10 +- admin/models/fields/notesfilterverse.php | 10 +- .../fields/openaimessagesfilterrole.php | 10 +- .../fields/openaimessagesfiltersource.php | 10 +- admin/models/fields/openairesponses.php | 4 + .../openairesponsesfilterresponseid.php | 10 +- .../openairesponsesfilterresponsemodel.php | 10 +- admin/models/fields/passwordsfiltername.php | 10 +- admin/models/fields/prompts.php | 4 + .../fields/promptsfiltercachebehaviour.php | 10 +- admin/models/fields/promptsfiltermodel.php | 10 +- admin/models/fields/promptsfiltername.php | 10 +- admin/models/fields/tagers.php | 14 +- .../fields/taggedversesfilteraccess.php | 10 +- .../fields/taggedversesfilterbooknr.php | 8 +- .../fields/taggedversesfilterchapter.php | 8 +- .../models/fields/taggedversesfilterverse.php | 8 +- admin/models/fields/tagsfilteraccess.php | 10 +- admin/models/fields/targettranslations.php | 4 + admin/models/fields/translations.php | 4 + .../fields/translationsfilterdirection.php | 10 +- admin/models/fields/versesfilterbooknr.php | 10 +- admin/models/fields/versesfilterchapter.php | 10 +- admin/models/fields/versesfilterverse.php | 10 +- admin/models/getbible.php | 56 ++-- admin/models/linker.php | 163 +++++----- admin/models/linkers.php | 45 +-- admin/models/note.php | 123 ++++---- admin/models/notes.php | 39 ++- admin/models/open_ai_message.php | 123 ++++---- admin/models/open_ai_messages.php | 45 +-- admin/models/open_ai_response.php | 141 +++++---- admin/models/open_ai_responses.php | 39 ++- admin/models/password.php | 125 ++++---- admin/models/passwords.php | 39 ++- admin/models/prompt.php | 125 ++++---- admin/models/prompts.php | 47 +-- admin/models/rules/guid.php | 3 + admin/models/rules/int.php | 3 + admin/models/rules/numbershyphens.php | 3 + admin/models/tag.php | 123 ++++---- admin/models/tagged_verse.php | 123 ++++---- admin/models/tagged_verses.php | 55 ++-- admin/models/tags.php | 39 ++- admin/models/translation.php | 125 ++++---- admin/models/translations.php | 43 +-- admin/models/verse.php | 123 ++++---- admin/models/verses.php | 39 ++- admin/sql/updates/mysql/2.0.32.sql | 1 + admin/tables/book.php | 51 ++-- admin/tables/chapter.php | 51 ++-- admin/tables/linker.php | 51 ++-- admin/tables/note.php | 53 ++-- admin/tables/open_ai_message.php | 53 ++-- admin/tables/open_ai_response.php | 53 ++-- admin/tables/password.php | 51 ++-- admin/tables/prompt.php | 53 ++-- admin/tables/tag.php | 53 ++-- admin/tables/tagged_verse.php | 53 ++-- admin/tables/translation.php | 51 ++-- admin/tables/verse.php | 51 ++-- admin/views/book/tmpl/edit.php | 46 +-- admin/views/book/view.html.php | 38 ++- admin/views/books/tmpl/default.php | 30 +- admin/views/books/tmpl/default_batch_body.php | 5 +- .../views/books/tmpl/default_batch_footer.php | 6 +- admin/views/books/tmpl/default_body.php | 22 +- admin/views/books/tmpl/default_head.php | 19 +- admin/views/books/tmpl/default_toolbar.php | 27 +- admin/views/books/view.html.php | 117 +++---- admin/views/chapter/tmpl/edit.php | 46 +-- admin/views/chapter/view.html.php | 38 ++- admin/views/chapters/tmpl/default.php | 34 ++- .../chapters/tmpl/default_batch_body.php | 5 +- .../chapters/tmpl/default_batch_footer.php | 6 +- admin/views/chapters/tmpl/default_body.php | 22 +- admin/views/chapters/tmpl/default_head.php | 21 +- admin/views/chapters/tmpl/default_toolbar.php | 27 +- admin/views/chapters/view.html.php | 115 +++---- admin/views/getbible/tmpl/default.php | 64 ++-- admin/views/getbible/tmpl/default_main.php | 6 +- ...t_notice_board_vast_development_method.php | 4 + .../tmpl/default_readme_information.php | 4 + admin/views/getbible/tmpl/default_vdm.php | 21 +- .../getbible/tmpl/default_wiki_tutorials.php | 4 + admin/views/getbible/view.html.php | 35 ++- admin/views/linker/tmpl/edit.php | 64 ++-- admin/views/linker/view.html.php | 76 +++-- admin/views/linkers/tmpl/default.php | 30 +- .../views/linkers/tmpl/default_batch_body.php | 5 +- .../linkers/tmpl/default_batch_footer.php | 6 +- admin/views/linkers/tmpl/default_body.php | 26 +- admin/views/linkers/tmpl/default_head.php | 21 +- admin/views/linkers/tmpl/default_toolbar.php | 27 +- admin/views/linkers/view.html.php | 113 ++++--- admin/views/note/tmpl/edit.php | 46 +-- admin/views/note/view.html.php | 74 +++-- admin/views/notes/tmpl/default.php | 30 +- admin/views/notes/tmpl/default_batch_body.php | 5 +- .../views/notes/tmpl/default_batch_footer.php | 6 +- admin/views/notes/tmpl/default_body.php | 24 +- admin/views/notes/tmpl/default_head.php | 19 +- admin/views/notes/tmpl/default_toolbar.php | 27 +- admin/views/notes/view.html.php | 129 ++++---- admin/views/open_ai_message/tmpl/edit.php | 48 +-- admin/views/open_ai_message/view.html.php | 74 +++-- admin/views/open_ai_messages/tmpl/default.php | 30 +- .../tmpl/default_batch_body.php | 5 +- .../tmpl/default_batch_footer.php | 6 +- .../open_ai_messages/tmpl/default_body.php | 28 +- .../open_ai_messages/tmpl/default_head.php | 21 +- .../open_ai_messages/tmpl/default_toolbar.php | 27 +- admin/views/open_ai_messages/view.html.php | 125 ++++---- admin/views/open_ai_response/tmpl/edit.php | 68 +++-- admin/views/open_ai_response/view.html.php | 78 +++-- .../views/open_ai_responses/tmpl/default.php | 30 +- .../tmpl/default_batch_body.php | 5 +- .../tmpl/default_batch_footer.php | 6 +- .../open_ai_responses/tmpl/default_body.php | 22 +- .../open_ai_responses/tmpl/default_head.php | 23 +- .../tmpl/default_toolbar.php | 27 +- admin/views/open_ai_responses/view.html.php | 117 +++---- admin/views/password/tmpl/edit.php | 46 +-- admin/views/password/view.html.php | 72 +++-- admin/views/passwords/tmpl/default.php | 30 +- .../passwords/tmpl/default_batch_body.php | 5 +- .../passwords/tmpl/default_batch_footer.php | 6 +- admin/views/passwords/tmpl/default_body.php | 22 +- admin/views/passwords/tmpl/default_head.php | 19 +- .../views/passwords/tmpl/default_toolbar.php | 27 +- admin/views/passwords/view.html.php | 101 +++--- admin/views/prompt/tmpl/edit.php | 56 ++-- admin/views/prompt/view.html.php | 74 +++-- admin/views/prompts/tmpl/default.php | 30 +- .../views/prompts/tmpl/default_batch_body.php | 5 +- .../prompts/tmpl/default_batch_footer.php | 6 +- admin/views/prompts/tmpl/default_body.php | 28 +- admin/views/prompts/tmpl/default_head.php | 25 +- admin/views/prompts/tmpl/default_toolbar.php | 27 +- admin/views/prompts/view.html.php | 125 ++++---- admin/views/tag/tmpl/edit.php | 46 +-- admin/views/tag/view.html.php | 74 +++-- admin/views/tagged_verse/tmpl/edit.php | 46 +-- admin/views/tagged_verse/view.html.php | 74 +++-- admin/views/tagged_verses/tmpl/default.php | 38 ++- .../tagged_verses/tmpl/default_batch_body.php | 5 +- .../tmpl/default_batch_footer.php | 6 +- .../views/tagged_verses/tmpl/default_body.php | 24 +- .../views/tagged_verses/tmpl/default_head.php | 23 +- .../tagged_verses/tmpl/default_toolbar.php | 27 +- admin/views/tagged_verses/view.html.php | 153 +++++----- admin/views/tags/tmpl/default.php | 30 +- admin/views/tags/tmpl/default_batch_body.php | 5 +- .../views/tags/tmpl/default_batch_footer.php | 6 +- admin/views/tags/tmpl/default_body.php | 24 +- admin/views/tags/tmpl/default_head.php | 19 +- admin/views/tags/tmpl/default_toolbar.php | 27 +- admin/views/tags/view.html.php | 99 +++--- admin/views/translation/tmpl/edit.php | 48 +-- admin/views/translation/view.html.php | 40 ++- admin/views/translations/tmpl/default.php | 30 +- .../translations/tmpl/default_batch_body.php | 5 +- .../tmpl/default_batch_footer.php | 6 +- .../views/translations/tmpl/default_body.php | 24 +- .../views/translations/tmpl/default_head.php | 21 +- .../translations/tmpl/default_toolbar.php | 27 +- admin/views/translations/view.html.php | 99 +++--- admin/views/verse/tmpl/edit.php | 48 +-- admin/views/verse/view.html.php | 38 ++- admin/views/verses/tmpl/default.php | 30 +- .../views/verses/tmpl/default_batch_body.php | 5 +- .../verses/tmpl/default_batch_footer.php | 6 +- admin/views/verses/tmpl/default_body.php | 22 +- admin/views/verses/tmpl/default_head.php | 21 +- admin/views/verses/tmpl/default_toolbar.php | 27 +- admin/views/verses/view.html.php | 125 ++++---- getbible.xml | 6 +- .../VDM.Joomla/src/Utilities/FileHelper.php | 16 +- .../VDM.Joomla/src/Utilities/GuidHelper.php | 2 +- script.php | 176 +++++------ site/controller.php | 11 +- site/controllers/ajax.json.php | 12 +- site/getbible.php | 13 +- site/helpers/getbible.php | 70 +++-- site/helpers/headercheck.php | 46 ++- site/helpers/route.php | 44 +-- site/layouts/aidetails.php | 13 +- site/layouts/airesponsemessage.php | 5 + site/layouts/getbibleappnote.php | 5 + site/layouts/getbibleappnotelink.php | 7 +- site/layouts/getbiblefavouriteverse.php | 25 +- site/layouts/getbiblefooter.php | 11 +- site/layouts/getbiblehashdetails.php | 5 + site/layouts/getbiblelinkers.php | 19 +- site/layouts/getbibleparagraph.php | 5 + site/layouts/getbibleverse.php | 5 + site/layouts/getbibleverses.php | 5 + site/layouts/getbibleversetag.php | 7 +- site/layouts/input.php | 5 + site/layouts/inputbox.php | 7 +- site/layouts/modal.php | 7 +- site/layouts/modulepositionerror.php | 9 +- site/layouts/nextchapter.php | 7 +- site/layouts/previouschapter.php | 7 +- site/layouts/promptmessage.php | 5 + site/layouts/promptsettings.php | 15 +- site/layouts/rows.php | 5 + site/layouts/select.php | 7 +- site/layouts/selectbox.php | 7 +- site/layouts/table.php | 7 +- site/layouts/textarea.php | 5 + site/layouts/textareabox.php | 7 +- site/models/ajax.php | 78 ++--- site/models/api.php | 17 +- site/models/app.php | 288 +++++++++--------- site/models/openai.php | 51 ++-- site/models/search.php | 46 +-- site/models/tag.php | 113 +++---- site/router.php | 9 +- site/views/api/tmpl/default.php | 6 +- site/views/api/view.html.php | 31 +- site/views/app/tmpl/default.php | 8 +- site/views/app/tmpl/default_getbibleapp.php | 4 + .../tmpl/default_getbibleappactivesession.php | 54 ++-- .../app/tmpl/default_getbibleappbody.php | 4 + .../tmpl/default_getbibleappbottommenu.php | 4 + .../tmpl/default_getbibleappcustomtabs.php | 4 + .../default_getbibleappcustomtabsmenu.php | 4 + .../app/tmpl/default_getbibleappdebug.php | 36 ++- .../app/tmpl/default_getbibleappdetails.php | 14 +- .../app/tmpl/default_getbibleappfooter.php | 20 +- .../tmpl/default_getbibleappmodalbottom.php | 4 + .../app/tmpl/default_getbibleappnotes.php | 16 +- .../app/tmpl/default_getbibleappsettings.php | 14 +- .../app/tmpl/default_getbibleappshare.php | 70 +++-- .../app/tmpl/default_getbibleapptags.php | 48 +-- .../app/tmpl/default_getbibleapptopmenu.php | 4 + .../app/tmpl/default_getbibleappword.php | 8 +- site/views/app/tmpl/default_getbiblebooks.php | 4 + .../app/tmpl/default_getbiblechapters.php | 4 + ...default_getbiblefavouriteverseselector.php | 20 +- .../tmpl/default_getbibleinstallbutton.php | 24 +- .../tmpl/default_getbiblelinkermanager.php | 4 + .../app/tmpl/default_getbiblemodules.php | 4 + site/views/app/tmpl/default_getbibletext.php | 10 +- .../app/tmpl/default_getbibletranslations.php | 4 + .../app/tmpl/default_versesparagraph.php | 4 + .../app/tmpl/default_versesunorderedlist.php | 4 + site/views/app/view.html.php | 82 ++--- site/views/openai/tmpl/default.php | 8 +- site/views/openai/tmpl/default_getbibleai.php | 6 +- .../openai/tmpl/default_getbibleaibody.php | 4 + .../tmpl/default_getbibleaibottommenu.php | 12 +- .../tmpl/default_getbibleaicustomtabs.php | 4 + .../tmpl/default_getbibleaicustomtabsmenu.php | 4 + .../openai/tmpl/default_getbibleaidebug.php | 10 +- .../openai/tmpl/default_getbibleaidetails.php | 4 + .../openai/tmpl/default_getbibleaifilter.php | 4 + .../openai/tmpl/default_getbibleaifooter.php | 4 + .../tmpl/default_getbibleaimessages.php | 4 + .../tmpl/default_getbibleaipromptmessages.php | 4 + .../openai/tmpl/default_getbibleaitopmenu.php | 12 +- .../openai/tmpl/default_getbiblemodules.php | 4 + .../tmpl/default_getbiblepromptsettings.php | 4 + site/views/openai/view.html.php | 54 ++-- site/views/search/tmpl/default.php | 6 +- .../search/tmpl/default_getbiblemodules.php | 4 + .../search/tmpl/default_getbiblesearch.php | 8 +- .../search/tmpl/default_getbiblesearchbox.php | 10 +- .../tmpl/default_getbiblesearchinput.php | 4 + .../default_getbiblesearchnotenoughverses.php | 6 +- .../tmpl/default_getbiblesearchoptions.php | 36 ++- .../tmpl/default_getbiblesearchtable.php | 22 +- site/views/search/view.html.php | 96 +++--- site/views/tag/tmpl/default.php | 8 +- .../tag/tmpl/default_getbiblemodules.php | 4 + site/views/tag/tmpl/default_getbiblenotag.php | 12 +- .../tag/tmpl/default_getbibleselecttags.php | 6 +- site/views/tag/tmpl/default_getbibletag.php | 4 + .../tag/tmpl/default_getbibletagbody.php | 8 +- .../tmpl/default_getbibletagbottommenu.php | 8 +- .../tmpl/default_getbibletagcustomtabs.php | 4 + .../default_getbibletagcustomtabsmenu.php | 4 + .../tag/tmpl/default_getbibletagdebug.php | 16 +- .../tag/tmpl/default_getbibletagfooter.php | 4 + .../tmpl/default_getbibletagparagraphs.php | 4 + .../default_getbibletagparagraphssorter.php | 6 +- .../tag/tmpl/default_getbibletagshare.php | 12 +- .../tag/tmpl/default_getbibletagtopmenu.php | 8 +- site/views/tag/view.html.php | 62 ++-- update_server.xml | 18 ++ 416 files changed, 6447 insertions(+), 4666 deletions(-) create mode 100644 admin/sql/updates/mysql/2.0.32.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index f0f2ece..6b7e8f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v2.1.0 + +- Move all JText to use the namespaced class Text directly. +- Move all JHtml to use the namespaced class Html directly. +- Move all JFactory to use the namespaced class Factory directly. +- Move all JRoute to use the namespaced class Route directly. +- Move all JFormHelper to use the namespaced class FormHelper directly. +- Move all JLayout to use the namespaced class FileLayout directly. +- Move all JLanguageMultilang to use the namespaced class Multilanguage directly. +- Move all JComponentHelper to use the namespaced class ComponentHelper directly. +- Move all JCategoryNode to use the namespaced class CategoryNode directly. +- Move all JComponentHelper to use the namespaced class ComponentHelper directly. +- Move all JToolbar to use the namespaced class Toolbar directly. +- Move all JToolbarHelper to use the namespaced class ToolbarHelper directly. +- Convert all addStyleSheet to make use of Html class instead. +- Convert all addScript to make use of Html class instead. + # v2.0.32 - Fixed other search related issues. diff --git a/README.md b/README.md index c6a4cc8..fe53dff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (2.1.0) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 4th December, 2023 -+ *Version*: 2.0.32 ++ *Last Build*: 23rd December, 2023 ++ *Version*: 2.1.0 + *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 -**561 Hours** or **70 Eight Hour Days** (actual time the author saved - +**566 Hours** or **71 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*: **200979** -+ *File count*: **1744** ++ *Line count*: **202968** ++ *File count*: **1745** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**374 Hours** or **47 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @140hours** = codingtime / 4; -> **planning @80hours** = codingtime / 7; -> **mapping @56hours** = codingtime / 10; -> **office @93hours** = codingtime / 6;) +> **debugging @142hours** = codingtime / 4; +> **planning @81hours** = codingtime / 7; +> **mapping @57hours** = codingtime / 10; +> **office @94hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**940 Hours** or **118 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: **23.2 weeks** or **4.8 months** +Project duration: **23.6 weeks** or **4.9 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index c6a4cc8..fe53dff 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (2.1.0) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 4th December, 2023 -+ *Version*: 2.0.32 ++ *Last Build*: 23rd December, 2023 ++ *Version*: 2.1.0 + *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 -**561 Hours** or **70 Eight Hour Days** (actual time the author saved - +**566 Hours** or **71 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*: **200979** -+ *File count*: **1744** ++ *Line count*: **202968** ++ *File count*: **1745** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**374 Hours** or **47 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @140hours** = codingtime / 4; -> **planning @80hours** = codingtime / 7; -> **mapping @56hours** = codingtime / 10; -> **office @93hours** = codingtime / 6;) +> **debugging @142hours** = codingtime / 4; +> **planning @81hours** = codingtime / 7; +> **mapping @57hours** = codingtime / 10; +> **office @94hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**940 Hours** or **118 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: **23.2 weeks** or **4.8 months** +Project duration: **23.6 weeks** or **4.9 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/controller.php b/admin/controller.php index 0b43409..0c71d3a 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -20,6 +20,10 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\MVC\Controller\BaseController; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * General Controller of Getbible component @@ -35,7 +39,7 @@ class GetbibleController extends BaseController * * @since 3.0 */ - public function __construct($config = array()) + public function __construct($config = []) { // set the default view $config['default_view'] = 'getbible'; @@ -57,32 +61,32 @@ class GetbibleController extends BaseController $id = $this->input->getInt('id'); // Check for edit form. - if(GetbibleHelper::checkArray($data)) + if(UtilitiesArrayHelper::check($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_getbible.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); // set redirect - if ($refid > 0 && GetbibleHelper::checkString($ref)) + if ($refid > 0 && StringHelper::check($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (GetbibleHelper::checkString($ref)) + elseif (StringHelper::check($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.(string)$ref, false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view='.$data['views'], false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view='.$data['views'], false)); } return false; @@ -95,7 +99,7 @@ class GetbibleController extends BaseController protected function getViewRelation($view) { // check the we have a value - if (GetbibleHelper::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 156bbaa..b8d2e36 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -18,7 +18,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; /** @@ -30,9 +32,9 @@ class GetbibleControllerAjax 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 @@ -45,15 +47,15 @@ class GetbibleControllerAjax 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'); // return to a callback function $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); + $token = Session::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { diff --git a/admin/controllers/book.php b/admin/controllers/book.php index 6f06b35..6df733b 100644 --- a/admin/controllers/book.php +++ b/admin/controllers/book.php @@ -18,8 +18,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; /** * Book Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerBook extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Books'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerBook 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('book.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerBook 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; @@ -156,12 +162,12 @@ class GetbibleControllerBook 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; @@ -178,13 +184,13 @@ class GetbibleControllerBook 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('Book', '', array()); + $model = $this->getModel('Book', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerBook 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerBook extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerBook extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerBook 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) { @@ -281,29 +287,29 @@ class GetbibleControllerBook 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerBook 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/books.php b/admin/controllers/books.php index b04e748..1bafb39 100644 --- a/admin/controllers/books.php +++ b/admin/controllers/books.php @@ -18,10 +18,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\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; /** * Books Admin Controller @@ -55,108 +59,108 @@ class GetbibleControllerBooks extends AdminController public function updateChaptersNames() { // Check for request forgeries - JSession::checkToken() or die(Text::_('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('book.update_chapters_names', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Chapter')->names($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Chapter')->names($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '

' . JText::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; // get the data to export if ($number == 1) { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_BOOK_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_BOOK_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; } else { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_SELECTED_BOOKS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_CHAPTER_NAMES_OF_THE_SELECTED_BOOKS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_CHAPTER_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_CHAPTER_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } public function forceHashCheck() { // Check for request forgeries - JSession::checkToken() or die(Text::_('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('book.force_hash_check', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_BOOK_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Chapter')->force($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Chapter')->force($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '

' . JText::_('COM_GETBIBLE_FORCE_HASH_CHECK_ENABLED') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_FORCE_HASH_CHECK_ENABLED') . '

'; // get the data to export if ($number == 1) { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_BOOK_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_BOOK_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '

'; } else { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_SELECTED_BOOKS_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_CHAPTERS_OF_THE_SELECTED_BOOKS_WILL_BE_FORCEFULLY_SYNCED_WITH_THE_GETBIBLE_API') . '

'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_ENABLED_FORCEFUL_CHECK_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_ENABLED_FORCEFUL_CHECK_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=books', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=books', false), $message, 'error'); return; } } \ No newline at end of file diff --git a/admin/controllers/chapter.php b/admin/controllers/chapter.php index e3a5a4a..e33609f 100644 --- a/admin/controllers/chapter.php +++ b/admin/controllers/chapter.php @@ -18,8 +18,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; /** * Chapter Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerChapter extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Chapters'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerChapter 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('chapter.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerChapter 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; @@ -156,12 +162,12 @@ class GetbibleControllerChapter 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; @@ -178,13 +184,13 @@ class GetbibleControllerChapter 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('Chapter', '', array()); + $model = $this->getModel('Chapter', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=chapters' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=chapters' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerChapter 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerChapter extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerChapter extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerChapter 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) { @@ -281,29 +287,29 @@ class GetbibleControllerChapter 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerChapter 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/chapters.php b/admin/controllers/chapters.php index 92c8c0e..5f6a8de 100644 --- a/admin/controllers/chapters.php +++ b/admin/controllers/chapters.php @@ -18,8 +18,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; /** * Chapters Admin Controller diff --git a/admin/controllers/getbible.php b/admin/controllers/getbible.php index 6a25675..43f34e6 100644 --- a/admin/controllers/getbible.php +++ b/admin/controllers/getbible.php @@ -18,8 +18,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; /** * Getbible Admin Controller diff --git a/admin/controllers/linker.php b/admin/controllers/linker.php index c9c7f49..6b2d133 100644 --- a/admin/controllers/linker.php +++ b/admin/controllers/linker.php @@ -18,8 +18,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; /** * Linker Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerLinker extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Linkers'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerLinker 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('linker.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerLinker 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; @@ -156,12 +162,12 @@ class GetbibleControllerLinker 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; @@ -178,13 +184,13 @@ class GetbibleControllerLinker 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('Linker', '', array()); + $model = $this->getModel('Linker', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=linkers' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=linkers' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerLinker 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerLinker extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerLinker extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerLinker 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) { @@ -281,29 +287,29 @@ class GetbibleControllerLinker 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerLinker 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/linkers.php b/admin/controllers/linkers.php index 7e371ae..3ea23ee 100644 --- a/admin/controllers/linkers.php +++ b/admin/controllers/linkers.php @@ -18,8 +18,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; /** * Linkers Admin Controller diff --git a/admin/controllers/note.php b/admin/controllers/note.php index 4445a4f..02c7a94 100644 --- a/admin/controllers/note.php +++ b/admin/controllers/note.php @@ -18,8 +18,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; /** * Note Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerNote extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Notes'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerNote 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('note.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerNote 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; @@ -156,12 +162,12 @@ class GetbibleControllerNote 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; @@ -178,13 +184,13 @@ class GetbibleControllerNote 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('Note', '', array()); + $model = $this->getModel('Note', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=notes' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=notes' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerNote 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerNote extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerNote extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerNote 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) { @@ -281,29 +287,29 @@ class GetbibleControllerNote 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerNote 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/notes.php b/admin/controllers/notes.php index 66e535e..d32f287 100644 --- a/admin/controllers/notes.php +++ b/admin/controllers/notes.php @@ -18,8 +18,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; /** * Notes Admin Controller diff --git a/admin/controllers/open_ai_message.php b/admin/controllers/open_ai_message.php index f641f7b..82b4585 100644 --- a/admin/controllers/open_ai_message.php +++ b/admin/controllers/open_ai_message.php @@ -18,8 +18,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; /** * Open_ai_message Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerOpen_ai_message extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Open_ai_messages'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerOpen_ai_message 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('open_ai_message.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerOpen_ai_message 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; @@ -156,12 +162,12 @@ class GetbibleControllerOpen_ai_message 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; @@ -178,13 +184,13 @@ class GetbibleControllerOpen_ai_message 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('Open_ai_message', '', array()); + $model = $this->getModel('Open_ai_message', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=open_ai_messages' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=open_ai_messages' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerOpen_ai_message 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerOpen_ai_message extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerOpen_ai_message extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerOpen_ai_message 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) { @@ -281,29 +287,29 @@ class GetbibleControllerOpen_ai_message 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerOpen_ai_message 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/open_ai_messages.php b/admin/controllers/open_ai_messages.php index 5a00145..8bd56da 100644 --- a/admin/controllers/open_ai_messages.php +++ b/admin/controllers/open_ai_messages.php @@ -18,8 +18,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; /** * Open_ai_messages Admin Controller diff --git a/admin/controllers/open_ai_response.php b/admin/controllers/open_ai_response.php index 1897c33..82f1d03 100644 --- a/admin/controllers/open_ai_response.php +++ b/admin/controllers/open_ai_response.php @@ -18,8 +18,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; /** * Open_ai_response Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerOpen_ai_response extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Open_ai_responses'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerOpen_ai_response 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('open_ai_response.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerOpen_ai_response 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; @@ -156,12 +162,12 @@ class GetbibleControllerOpen_ai_response 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; @@ -178,13 +184,13 @@ class GetbibleControllerOpen_ai_response 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('Open_ai_response', '', array()); + $model = $this->getModel('Open_ai_response', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=open_ai_responses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=open_ai_responses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerOpen_ai_response 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerOpen_ai_response extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerOpen_ai_response extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerOpen_ai_response 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) { @@ -281,29 +287,29 @@ class GetbibleControllerOpen_ai_response 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerOpen_ai_response 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/open_ai_responses.php b/admin/controllers/open_ai_responses.php index 998b78d..e060ae0 100644 --- a/admin/controllers/open_ai_responses.php +++ b/admin/controllers/open_ai_responses.php @@ -18,8 +18,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; /** * Open_ai_responses Admin Controller diff --git a/admin/controllers/password.php b/admin/controllers/password.php index 8e2d035..c4a428f 100644 --- a/admin/controllers/password.php +++ b/admin/controllers/password.php @@ -18,8 +18,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; /** * Password Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerPassword extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Passwords'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerPassword 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('password.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerPassword 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; @@ -156,12 +162,12 @@ class GetbibleControllerPassword 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; @@ -178,13 +184,13 @@ class GetbibleControllerPassword 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('Password', '', array()); + $model = $this->getModel('Password', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=passwords' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=passwords' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerPassword 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerPassword extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerPassword extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerPassword 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) { @@ -281,29 +287,29 @@ class GetbibleControllerPassword 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerPassword 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/passwords.php b/admin/controllers/passwords.php index f2b08f9..ea0d466 100644 --- a/admin/controllers/passwords.php +++ b/admin/controllers/passwords.php @@ -18,8 +18,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; /** * Passwords Admin Controller diff --git a/admin/controllers/prompt.php b/admin/controllers/prompt.php index fd204dd..182387b 100644 --- a/admin/controllers/prompt.php +++ b/admin/controllers/prompt.php @@ -18,8 +18,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; /** * Prompt Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerPrompt extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Prompts'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerPrompt 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('prompt.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerPrompt 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; @@ -156,12 +162,12 @@ class GetbibleControllerPrompt 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; @@ -178,13 +184,13 @@ class GetbibleControllerPrompt 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('Prompt', '', array()); + $model = $this->getModel('Prompt', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=prompts' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=prompts' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerPrompt 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerPrompt extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerPrompt extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerPrompt 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) { @@ -281,29 +287,29 @@ class GetbibleControllerPrompt 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerPrompt 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/prompts.php b/admin/controllers/prompts.php index 38bc0f0..2d393c3 100644 --- a/admin/controllers/prompts.php +++ b/admin/controllers/prompts.php @@ -18,8 +18,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; /** * Prompts Admin Controller diff --git a/admin/controllers/tag.php b/admin/controllers/tag.php index 37b97fc..b348481 100644 --- a/admin/controllers/tag.php +++ b/admin/controllers/tag.php @@ -18,8 +18,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; /** * Tag Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTag extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Tags'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerTag 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('tag.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTag 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; @@ -156,12 +162,12 @@ class GetbibleControllerTag 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; @@ -178,13 +184,13 @@ class GetbibleControllerTag 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('Tag', '', array()); + $model = $this->getModel('Tag', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=tags' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=tags' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTag 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTag extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTag extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTag 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) { @@ -281,29 +287,29 @@ class GetbibleControllerTag 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTag 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/tagged_verse.php b/admin/controllers/tagged_verse.php index 7c0cf72..0dca6a9 100644 --- a/admin/controllers/tagged_verse.php +++ b/admin/controllers/tagged_verse.php @@ -18,8 +18,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; /** * Tagged_verse Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTagged_verse extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Tagged_verses'; // 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. @@ -57,10 +63,10 @@ class GetbibleControllerTagged_verse 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('tagged_verse.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTagged_verse 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; @@ -156,12 +162,12 @@ class GetbibleControllerTagged_verse 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; @@ -178,13 +184,13 @@ class GetbibleControllerTagged_verse 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('Tagged_verse', '', array()); + $model = $this->getModel('Tagged_verse', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=tagged_verses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=tagged_verses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTagged_verse 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTagged_verse extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTagged_verse extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTagged_verse 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) { @@ -281,29 +287,29 @@ class GetbibleControllerTagged_verse 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTagged_verse 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/tagged_verses.php b/admin/controllers/tagged_verses.php index 30713a1..c9da6b0 100644 --- a/admin/controllers/tagged_verses.php +++ b/admin/controllers/tagged_verses.php @@ -18,8 +18,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; /** * Tagged_verses Admin Controller diff --git a/admin/controllers/tags.php b/admin/controllers/tags.php index a07ced8..3e89d2b 100644 --- a/admin/controllers/tags.php +++ b/admin/controllers/tags.php @@ -18,8 +18,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; /** * Tags Admin Controller diff --git a/admin/controllers/translation.php b/admin/controllers/translation.php index a5a5051..f60ceb6 100644 --- a/admin/controllers/translation.php +++ b/admin/controllers/translation.php @@ -18,8 +18,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; /** * Translation Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerTranslation extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Translations'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerTranslation 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('translation.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerTranslation 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; @@ -156,12 +162,12 @@ class GetbibleControllerTranslation 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; @@ -178,13 +184,13 @@ class GetbibleControllerTranslation 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('Translation', '', array()); + $model = $this->getModel('Translation', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerTranslation 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerTranslation extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerTranslation extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerTranslation 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) { @@ -281,29 +287,29 @@ class GetbibleControllerTranslation 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerTranslation 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/translations.php b/admin/controllers/translations.php index ab6151f..5f8b446 100644 --- a/admin/controllers/translations.php +++ b/admin/controllers/translations.php @@ -18,9 +18,13 @@ // 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 VDM\Joomla\GetBible\Factory; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** @@ -55,86 +59,86 @@ class GetbibleControllerTranslations extends AdminController public function updateTranslationsDetails() { // Check for request forgeries - JSession::checkToken() or die(Text::_('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('translation.update_translations_details', 'com_getbible')) { - if (Factory::_('GetBible.Watcher.Translation')->translations()) + if (GetBibleFactory::_('GetBible.Watcher.Translation')->translations()) { // Redirect to the list screen with success. $message = array(); - $message[] = '

' . JText::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; - $message[] = '

' . JText::_('COM_GETBIBLE_ALL_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); + $message[] = '

' . Text::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_ALL_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } public function updateBookNames() { // Check for request forgeries - JSession::checkToken() or die(Text::_('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('translation.update_book_names', 'com_getbible')) { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - JArrayHelper::toInteger($pks); + ArrayHelper::toInteger($pks); // check if there is any selections $number = UtilitiesArrayHelper::check($pks); if (!$number) { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_NO_TRANSLATION_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_NO_TRANSLATION_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } - elseif (Factory::_('GetBible.Watcher.Book')->translations($pks)) + elseif (GetBibleFactory::_('GetBible.Watcher.Book')->translations($pks)) { // Redirect to the list screen with success. $message = array(); - $message[] = '

' . JText::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_UPDATE_COMPLETED') . '

'; // get the data to export if ($number == 1) { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_TRANSLATION_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_TRANSLATION_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; } else { - $message[] = '

' . JText::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_SELECTED_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; + $message[] = '

' . Text::_('COM_GETBIBLE_THE_BOOK_NAMES_OF_THE_SELECTED_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API') . '

'; } - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), implode('', $message), 'Success'); return; } } else { // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } // Redirect to the list screen with error. - $message = JText::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $message = Text::_('COM_GETBIBLE_UPDATE_FAILED_PLEASE_TRY_AGAIN_LATTER'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } } \ No newline at end of file diff --git a/admin/controllers/verse.php b/admin/controllers/verse.php index 88d939f..c8ce1df 100644 --- a/admin/controllers/verse.php +++ b/admin/controllers/verse.php @@ -18,8 +18,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; /** * Verse Form Controller @@ -42,13 +48,13 @@ class GetbibleControllerVerse extends FormController * * @since 1.6 */ - public function __construct($config = array()) + public function __construct($config = []) { $this->view_list = 'Verses'; // safeguard for setting the return view listing to the main view. parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_CONTROLLER### - /** + /** * Method override to check if you can add a new record. * * @param array $data An array of input data. @@ -57,10 +63,10 @@ class GetbibleControllerVerse 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('verse.access', 'com_getbible'); if (!$access) @@ -82,10 +88,10 @@ class GetbibleControllerVerse 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; @@ -156,12 +162,12 @@ class GetbibleControllerVerse 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; @@ -178,13 +184,13 @@ class GetbibleControllerVerse 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('Verse', '', array()); + $model = $this->getModel('Verse', '', []); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_getbible&view=verses' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=verses' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } @@ -209,13 +215,13 @@ class GetbibleControllerVerse 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 ) ); @@ -226,7 +232,7 @@ class GetbibleControllerVerse extends FormController // Redirect to the item screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -237,7 +243,7 @@ class GetbibleControllerVerse extends FormController // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . $redirect, false ) ); @@ -263,7 +269,7 @@ class GetbibleControllerVerse 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) { @@ -281,29 +287,29 @@ class GetbibleControllerVerse 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 ) ); @@ -315,16 +321,15 @@ class GetbibleControllerVerse 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/verses.php b/admin/controllers/verses.php index e422a44..51afd0f 100644 --- a/admin/controllers/verses.php +++ b/admin/controllers/verses.php @@ -18,8 +18,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; /** * Verses Admin Controller diff --git a/admin/getbible.php b/admin/getbible.php index 9d98ca8..f83f9bc 100644 --- a/admin/getbible.php +++ b/admin/getbible.php @@ -64,27 +64,31 @@ spl_autoload_register(function ($class) { } }); - +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_getbible')) +if (!Factory::getUser()->authorise('core.manage', 'com_getbible')) { - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); +} // Add CSS file for all pages -JHtml::_('stylesheet', 'components/com_getbible/assets/css/admin.css', ['version' => 'auto']); -JHtml::_('script', 'components/com_getbible/assets/js/admin.js', ['version' => 'auto']); +Html::_('stylesheet', 'components/com_getbible/assets/css/admin.css', ['version' => 'auto']); +Html::_('script', 'components/com_getbible/assets/js/admin.js', ['version' => 'auto']); // require helper files JLoader::register('GetbibleHelper', __DIR__ . '/helpers/getbible.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); // Get an instance of the controller prefixed by Getbible -$controller = JControllerLegacy::getInstance('Getbible'); +$controller = BaseController::getInstance('Getbible'); // 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/helpers/getbible.php b/admin/helpers/getbible.php index da66c81..00e144d 100644 --- a/admin/helpers/getbible.php +++ b/admin/helpers/getbible.php @@ -64,12 +64,22 @@ spl_autoload_register(function ($class) { } }); +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 VDM\Joomla\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use VDM\Joomla\Utilities\ObjectHelper; use VDM\Joomla\Utilities\GetHelper; @@ -87,7 +97,7 @@ abstract class GetbibleHelper * * @var array */ - protected static $composer = array(); + protected static $composer = []; /** * The Main Active Language @@ -116,7 +126,7 @@ abstract class GetbibleHelper return; } - Factory::_('GetBible.Loader')->set($row, $plugin); + GetBibleFactory::_('GetBible.Loader')->set($row, $plugin); } /** @@ -161,7 +171,7 @@ abstract class GetbibleHelper // check if set if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -172,9 +182,9 @@ abstract class GetbibleHelper public static function getContributors() { // get params - $params = JComponentHelper::getParams('com_getbible'); + $params = ComponentHelper::getParams('com_getbible'); // start contributors array - $contributors = array(); + $contributors = []; // get all Contributors (max 20) $searchArray = range('0','20'); foreach($searchArray as $nr) @@ -218,48 +228,48 @@ abstract class GetbibleHelper 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_GETBIBLE_SUBMENU_DASHBOARD'), 'index.php?option=com_getbible&view=getbible', $submenu === 'getbible'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_DASHBOARD'), 'index.php?option=com_getbible&view=getbible', $submenu === 'getbible'); if ($user->authorise('linker.access', 'com_getbible') && $user->authorise('linker.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_LINKERS'), 'index.php?option=com_getbible&view=linkers', $submenu === 'linkers'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_LINKERS'), 'index.php?option=com_getbible&view=linkers', $submenu === 'linkers'); } if ($user->authorise('note.access', 'com_getbible') && $user->authorise('note.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_NOTES'), 'index.php?option=com_getbible&view=notes', $submenu === 'notes'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_NOTES'), 'index.php?option=com_getbible&view=notes', $submenu === 'notes'); } if ($user->authorise('tagged_verse.access', 'com_getbible') && $user->authorise('tagged_verse.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TAGGED_VERSES'), 'index.php?option=com_getbible&view=tagged_verses', $submenu === 'tagged_verses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TAGGED_VERSES'), 'index.php?option=com_getbible&view=tagged_verses', $submenu === 'tagged_verses'); } if ($user->authorise('prompt.access', 'com_getbible') && $user->authorise('prompt.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_PROMPTS'), 'index.php?option=com_getbible&view=prompts', $submenu === 'prompts'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_PROMPTS'), 'index.php?option=com_getbible&view=prompts', $submenu === 'prompts'); } if ($user->authorise('open_ai_response.access', 'com_getbible') && $user->authorise('open_ai_response.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_OPEN_AI_RESPONSES'), 'index.php?option=com_getbible&view=open_ai_responses', $submenu === 'open_ai_responses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_OPEN_AI_RESPONSES'), 'index.php?option=com_getbible&view=open_ai_responses', $submenu === 'open_ai_responses'); } if ($user->authorise('tag.access', 'com_getbible') && $user->authorise('tag.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TAGS'), 'index.php?option=com_getbible&view=tags', $submenu === 'tags'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TAGS'), 'index.php?option=com_getbible&view=tags', $submenu === 'tags'); } if ($user->authorise('translation.access', 'com_getbible') && $user->authorise('translation.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_TRANSLATIONS'), 'index.php?option=com_getbible&view=translations', $submenu === 'translations'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_TRANSLATIONS'), 'index.php?option=com_getbible&view=translations', $submenu === 'translations'); } if ($user->authorise('book.access', 'com_getbible') && $user->authorise('book.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_BOOKS'), 'index.php?option=com_getbible&view=books', $submenu === 'books'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_BOOKS'), 'index.php?option=com_getbible&view=books', $submenu === 'books'); } if ($user->authorise('chapter.access', 'com_getbible') && $user->authorise('chapter.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_CHAPTERS'), 'index.php?option=com_getbible&view=chapters', $submenu === 'chapters'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_CHAPTERS'), 'index.php?option=com_getbible&view=chapters', $submenu === 'chapters'); } if ($user->authorise('verse.access', 'com_getbible') && $user->authorise('verse.submenu', 'com_getbible')) { - JHtmlSidebar::addEntry(JText::_('COM_GETBIBLE_SUBMENU_VERSES'), 'index.php?option=com_getbible&view=verses', $submenu === 'verses'); + JHtmlSidebar::addEntry(Text::_('COM_GETBIBLE_SUBMENU_VERSES'), 'index.php?option=com_getbible&view=verses', $submenu === 'verses'); } } @@ -340,7 +350,7 @@ abstract class GetbibleHelper { $type = 'item'; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.published')); $query->from('#__getbible_'.$type.' AS a'); @@ -358,7 +368,7 @@ abstract class GetbibleHelper 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'); @@ -383,7 +393,7 @@ abstract class GetbibleHelper * @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 = 'getbible', $user = 'null') @@ -392,10 +402,10 @@ abstract class GetbibleHelper 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 = UtilitiesStringHelper::safe($view); if (UtilitiesStringHelper::check($views)) @@ -403,11 +413,11 @@ abstract class GetbibleHelper $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; @@ -574,14 +584,14 @@ abstract class GetbibleHelper /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Getbible', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Getbible', $config = []) { // fix the 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']) || !UtilitiesStringHelper::check($config['table_path'])) { @@ -589,7 +599,7 @@ abstract class GetbibleHelper $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) { @@ -624,14 +634,14 @@ abstract class GetbibleHelper */ public static function setAsset($id, $table, $inherit = true) { - $parent = JTable::getInstance('Asset'); + $parent = Table::getInstance('Asset'); $parent->loadByName('com_getbible'); $parentId = $parent->id; $name = 'com_getbible.'.$table.'.'.$id; $title = ''; - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName($name); // Check for an error. @@ -655,14 +665,14 @@ abstract class GetbibleHelper $asset->title = $title; // get the default asset rules $rules = self::getDefaultAssetRules('com_getbible', $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 @@ -675,7 +685,7 @@ abstract class GetbibleHelper $object->asset_id = (int) $asset->id; // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__getbible_'.$table, $object, 'id'); + return Factory::getDbo()->updateObject('#__getbible_'.$table, $object, 'id'); } } return false; @@ -692,7 +702,7 @@ abstract class GetbibleHelper 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')) @@ -707,8 +717,8 @@ abstract class GetbibleHelper } } // 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); @@ -723,7 +733,7 @@ abstract class GetbibleHelper elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -731,8 +741,8 @@ abstract class GetbibleHelper { $_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; } @@ -777,7 +787,7 @@ abstract class GetbibleHelper * @return null * @deprecated 3.3 Use FormHelper::attributes($xml, $attributes); */ - public static function xmlAddAttributes(&$xml, $attributes = array()) + public static function xmlAddAttributes(&$xml, $attributes = []) { FormHelper::attributes($xml, $attributes); } @@ -791,7 +801,7 @@ abstract class GetbibleHelper * @return void * @deprecated 3.3 Use FormHelper::options($xml, $options); */ - public static function xmlAddOptions(&$xml, $options = array()) + public static function xmlAddOptions(&$xml, $options = []) { FormHelper::options($xml, $options); } diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index 171cdbe..9018ba1 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -18,24 +18,36 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; + class getbibleHeaderCheck { + 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)) @@ -46,24 +58,30 @@ class getbibleHeaderCheck 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)) @@ -74,4 +92,4 @@ class getbibleHeaderCheck return false; } -} \ No newline at end of file +} diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 1abd495..8ec5c7e 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -31,7 +31,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/layouts/batchselection.php b/admin/layouts/batchselection.php index 8d8a328..abde6dc 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -18,6 +18,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; @@ -46,9 +47,9 @@ $counter = 0;
+ +
\ No newline at end of file diff --git a/admin/layouts/book/details_above.php b/admin/layouts/book/details_above.php index c896606..c71d840 100644 --- a/admin/layouts/book/details_above.php +++ b/admin/layouts/book/details_above.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'nr' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/book/details_left.php b/admin/layouts/book/details_left.php index 88f95d4..0e92e27 100644 --- a/admin/layouts/book/details_left.php +++ b/admin/layouts/book/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'abbreviation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/book/details_right.php b/admin/layouts/book/details_right.php index e4e14f4..e2edc8b 100644 --- a/admin/layouts/book/details_right.php +++ b/admin/layouts/book/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'sha' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/book/publishing.php b/admin/layouts/book/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/book/publishing.php +++ b/admin/layouts/book/publishing.php @@ -39,7 +39,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/book/publlshing.php b/admin/layouts/book/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/book/publlshing.php +++ b/admin/layouts/book/publlshing.php @@ -40,7 +40,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/chapter/details_above.php b/admin/layouts/chapter/details_above.php index a21caa4..55dc09f 100644 --- a/admin/layouts/chapter/details_above.php +++ b/admin/layouts/chapter/details_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'book_nr' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/chapter/details_left.php b/admin/layouts/chapter/details_left.php index 88f95d4..0e92e27 100644 --- a/admin/layouts/chapter/details_left.php +++ b/admin/layouts/chapter/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'abbreviation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/chapter/details_right.php b/admin/layouts/chapter/details_right.php index e4e14f4..e2edc8b 100644 --- a/admin/layouts/chapter/details_right.php +++ b/admin/layouts/chapter/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'sha' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/chapter/publishing.php b/admin/layouts/chapter/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/chapter/publishing.php +++ b/admin/layouts/chapter/publishing.php @@ -39,7 +39,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/chapter/publlshing.php b/admin/layouts/chapter/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/chapter/publlshing.php +++ b/admin/layouts/chapter/publlshing.php @@ -40,7 +40,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/linker/details_above.php b/admin/layouts/linker/details_above.php index 709476d..68f7be5 100644 --- a/admin/layouts/linker/details_above.php +++ b/admin/layouts/linker/details_above.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/linker/details_left.php b/admin/layouts/linker/details_left.php index b83f222..ed96808 100644 --- a/admin/layouts/linker/details_left.php +++ b/admin/layouts/linker/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'public_tagged_verses' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/linker/details_right.php b/admin/layouts/linker/details_right.php index f17d385..2d6a1ea 100644 --- a/admin/layouts/linker/details_right.php +++ b/admin/layouts/linker/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'public_notes' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/linker/notes_fullwidth.php b/admin/layouts/linker/notes_fullwidth.php index 9a079ad..109ddec 100644 --- a/admin/layouts/linker/notes_fullwidth.php +++ b/admin/layouts/linker/notes_fullwidth.php @@ -18,22 +18,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\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // set the defaults $items = $displayData->vvwnotes; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_getbible&view=notes&task=note.edit"; // set a return value $return = ($id) ? "index.php?option=com_getbible&view=linker&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 (GetbibleHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=linker&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -53,8 +58,8 @@ $can = GetbibleHelper::getActions('note');
get('note.create')): ?>
- - + +


@@ -62,19 +67,19 @@ $can = GetbibleHelper::getActions('note'); - + - + - + - + - + @@ -82,7 +87,7 @@ $can = GetbibleHelper::getActions('note'); $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 = GetbibleHelper::getActions('note',$item,'notes'); ?> @@ -90,7 +95,7 @@ $can = GetbibleHelper::getActions('note'); get('note.edit')): ?> escape($item->book_nr); ?> checked_out): ?> - name, $item->checked_out_time, 'notes.', $canCheckin); ?> + name, $item->checked_out_time, 'notes.', $canCheckin); ?> escape($item->book_nr); ?> @@ -100,30 +105,30 @@ $can = GetbibleHelper::getActions('note'); escape($item->linker_name); ?> - access); ?> + access); ?> published == 1): ?> - - + + published == 0): ?> - - + + published == 2): ?> - - + + published == -2): ?> - - + + @@ -136,7 +141,7 @@ $can = GetbibleHelper::getActions('note');
- +
diff --git a/admin/layouts/linker/passwords_fullwidth.php b/admin/layouts/linker/passwords_fullwidth.php index 49c723a..ba851c8 100644 --- a/admin/layouts/linker/passwords_fullwidth.php +++ b/admin/layouts/linker/passwords_fullwidth.php @@ -18,22 +18,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\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // set the defaults $items = $displayData->vvxpasswords; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_getbible&view=passwords&task=password.edit"; // set a return value $return = ($id) ? "index.php?option=com_getbible&view=linker&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 (GetbibleHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=linker&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -53,8 +58,8 @@ $can = GetbibleHelper::getActions('password');
get('password.create')): ?>
- - + +


@@ -62,19 +67,19 @@ $can = GetbibleHelper::getActions('password'); - + - + - + - + - + @@ -82,7 +87,7 @@ $can = GetbibleHelper::getActions('password'); $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 = GetbibleHelper::getActions('password',$item,'passwords'); ?> @@ -90,7 +95,7 @@ $can = GetbibleHelper::getActions('password'); get('password.edit')): ?> escape($item->name); ?> checked_out): ?> - name, $item->checked_out_time, 'passwords.', $canCheckin); ?> + name, $item->checked_out_time, 'passwords.', $canCheckin); ?> escape($item->name); ?> @@ -104,26 +109,26 @@ $can = GetbibleHelper::getActions('password'); published == 1): ?> - - + + published == 0): ?> - - + + published == 2): ?> - - + + published == -2): ?> - - + + @@ -136,7 +141,7 @@ $can = GetbibleHelper::getActions('password');
- +
diff --git a/admin/layouts/linker/publishing.php b/admin/layouts/linker/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/linker/publishing.php +++ b/admin/layouts/linker/publishing.php @@ -40,7 +40,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/linker/publlshing.php b/admin/layouts/linker/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/linker/publlshing.php +++ b/admin/layouts/linker/publlshing.php @@ -40,7 +40,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/linker/tags_fullwidth.php b/admin/layouts/linker/tags_fullwidth.php index 4984d16..1db2893 100644 --- a/admin/layouts/linker/tags_fullwidth.php +++ b/admin/layouts/linker/tags_fullwidth.php @@ -18,22 +18,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\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // set the defaults $items = $displayData->vvvtags; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_getbible&view=tagged_verses&task=tagged_verse.edit"; // set a return value $return = ($id) ? "index.php?option=com_getbible&view=linker&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 (GetbibleHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=linker&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -53,8 +58,8 @@ $can = GetbibleHelper::getActions('tagged_verse');
get('tagged_verse.create')): ?>
- - + +


@@ -62,25 +67,25 @@ $can = GetbibleHelper::getActions('tagged_verse'); - + - + - + - + - + - + - + @@ -88,7 +93,7 @@ $can = GetbibleHelper::getActions('tagged_verse'); $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 = GetbibleHelper::getActions('tagged_verse',$item,'tagged_verses'); ?> @@ -96,7 +101,7 @@ $can = GetbibleHelper::getActions('tagged_verse'); get('tagged_verse.edit')): ?> escape($item->book_nr); ?> checked_out): ?> - name, $item->checked_out_time, 'tagged_verses.', $canCheckin); ?> + name, $item->checked_out_time, 'tagged_verses.', $canCheckin); ?> escape($item->book_nr); ?> @@ -110,7 +115,7 @@ $can = GetbibleHelper::getActions('tagged_verse'); - access); ?> + access); ?> escape($item->linker_name); ?> @@ -124,26 +129,26 @@ $can = GetbibleHelper::getActions('tagged_verse'); published == 1): ?> - - + + published == 0): ?> - - + + published == 2): ?> - - + + published == -2): ?> - - + + @@ -156,7 +161,7 @@ $can = GetbibleHelper::getActions('tagged_verse');
- +
diff --git a/admin/layouts/note/details_above.php b/admin/layouts/note/details_above.php index 2c98398..4f43f69 100644 --- a/admin/layouts/note/details_above.php +++ b/admin/layouts/note/details_above.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'linker' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/note/details_left.php b/admin/layouts/note/details_left.php index 42b9831..5eb89a3 100644 --- a/admin/layouts/note/details_left.php +++ b/admin/layouts/note/details_left.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'verse' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/note/details_right.php b/admin/layouts/note/details_right.php index 118fdfe..b997322 100644 --- a/admin/layouts/note/details_right.php +++ b/admin/layouts/note/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'note' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/note/publishing.php b/admin/layouts/note/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/note/publishing.php +++ b/admin/layouts/note/publishing.php @@ -40,7 +40,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/note/publlshing.php b/admin/layouts/note/publlshing.php index 1c6d9d7..8501906 100644 --- a/admin/layouts/note/publlshing.php +++ b/admin/layouts/note/publlshing.php @@ -39,7 +39,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/open_ai_message/message_above.php b/admin/layouts/open_ai_message/message_above.php index b97d180..768add9 100644 --- a/admin/layouts/open_ai_message/message_above.php +++ b/admin/layouts/open_ai_message/message_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'prompt' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_message/message_fullwidth.php b/admin/layouts/open_ai_message/message_fullwidth.php index d78d9bc..2b3dae8 100644 --- a/admin/layouts/open_ai_message/message_fullwidth.php +++ b/admin/layouts/open_ai_message/message_fullwidth.php @@ -35,7 +35,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/open_ai_message/message_left.php b/admin/layouts/open_ai_message/message_left.php index 5269e14..4afdfbf 100644 --- a/admin/layouts/open_ai_message/message_left.php +++ b/admin/layouts/open_ai_message/message_left.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'index' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_message/message_right.php b/admin/layouts/open_ai_message/message_right.php index e867d90..18d0070 100644 --- a/admin/layouts/open_ai_message/message_right.php +++ b/admin/layouts/open_ai_message/message_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_message/publishing.php b/admin/layouts/open_ai_message/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/open_ai_message/publishing.php +++ b/admin/layouts/open_ai_message/publishing.php @@ -39,7 +39,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/open_ai_message/publlshing.php b/admin/layouts/open_ai_message/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/open_ai_message/publlshing.php +++ b/admin/layouts/open_ai_message/publlshing.php @@ -40,7 +40,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/open_ai_response/bible_left.php b/admin/layouts/open_ai_response/bible_left.php index e6c3c51..64cf483 100644 --- a/admin/layouts/open_ai_response/bible_left.php +++ b/admin/layouts/open_ai_response/bible_left.php @@ -38,7 +38,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'book' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/bible_right.php b/admin/layouts/open_ai_response/bible_right.php index 95d5418..f526c49 100644 --- a/admin/layouts/open_ai_response/bible_right.php +++ b/admin/layouts/open_ai_response/bible_right.php @@ -38,7 +38,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'selected_word' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/details_above.php b/admin/layouts/open_ai_response/details_above.php index e748888..c387f09 100644 --- a/admin/layouts/open_ai_response/details_above.php +++ b/admin/layouts/open_ai_response/details_above.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'prompt' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/details_left.php b/admin/layouts/open_ai_response/details_left.php index 551ca06..c8b5859 100644 --- a/admin/layouts/open_ai_response/details_left.php +++ b/admin/layouts/open_ai_response/details_left.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'response_created' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/details_right.php b/admin/layouts/open_ai_response/details_right.php index 3476e89..5090aaa 100644 --- a/admin/layouts/open_ai_response/details_right.php +++ b/admin/layouts/open_ai_response/details_right.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'total_tokens' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/message_fullwidth.php b/admin/layouts/open_ai_response/message_fullwidth.php index c650b2e..6b87433 100644 --- a/admin/layouts/open_ai_response/message_fullwidth.php +++ b/admin/layouts/open_ai_response/message_fullwidth.php @@ -18,22 +18,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\HTML\HTMLHelper as Html; +use VDM\Joomla\Utilities\StringHelper; + // set the defaults $items = $displayData->vvymessage; -$user = JFactory::getUser(); +$user = Factory::getUser(); $id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_getbible&view=open_ai_messages&task=open_ai_message.edit"; // set a return value $return = ($id) ? "index.php?option=com_getbible&view=open_ai_response&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 (GetbibleHelper::checkString($return)) +if (StringHelper::check($return)) { // set the referral values $ref = ($id) ? "&ref=open_ai_response&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); @@ -50,22 +55,22 @@ else - + - + - + - + - + - + @@ -73,18 +78,18 @@ 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 = GetbibleHelper::getActions('open_ai_message',$item,'open_ai_messages'); ?> get('open_ai_message.edit')): ?> - role); ?> + role); ?> checked_out): ?> - name, $item->checked_out_time, 'open_ai_messages.', $canCheckin); ?> + name, $item->checked_out_time, 'open_ai_messages.', $canCheckin); ?> - role); ?> + role); ?> @@ -98,30 +103,30 @@ else - source); ?> + source); ?> published == 1): ?> - - + + published == 0): ?> - - + + published == 2): ?> - - + + published == -2): ?> - - + + @@ -134,7 +139,7 @@ else
- +
diff --git a/admin/layouts/open_ai_response/prompt_left.php b/admin/layouts/open_ai_response/prompt_left.php index 5265614..04abae6 100644 --- a/admin/layouts/open_ai_response/prompt_left.php +++ b/admin/layouts/open_ai_response/prompt_left.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'top_p' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/prompt_right.php b/admin/layouts/open_ai_response/prompt_right.php index 7ff9ded..29ff0e2 100644 --- a/admin/layouts/open_ai_response/prompt_right.php +++ b/admin/layouts/open_ai_response/prompt_right.php @@ -38,7 +38,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'n' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/open_ai_response/publishing.php b/admin/layouts/open_ai_response/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/open_ai_response/publishing.php +++ b/admin/layouts/open_ai_response/publishing.php @@ -39,7 +39,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/open_ai_response/publlshing.php b/admin/layouts/open_ai_response/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/open_ai_response/publlshing.php +++ b/admin/layouts/open_ai_response/publlshing.php @@ -40,7 +40,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/password/details_above.php b/admin/layouts/password/details_above.php index c787fff..540c924 100644 --- a/admin/layouts/password/details_above.php +++ b/admin/layouts/password/details_above.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'linker' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/password/details_left.php b/admin/layouts/password/details_left.php index e867d90..18d0070 100644 --- a/admin/layouts/password/details_left.php +++ b/admin/layouts/password/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/password/details_right.php b/admin/layouts/password/details_right.php index e142f5b..bc5fb8f 100644 --- a/admin/layouts/password/details_right.php +++ b/admin/layouts/password/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'password' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/password/publishing.php b/admin/layouts/password/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/password/publishing.php +++ b/admin/layouts/password/publishing.php @@ -40,7 +40,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/password/publlshing.php b/admin/layouts/password/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/password/publlshing.php +++ b/admin/layouts/password/publlshing.php @@ -40,7 +40,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/prompt/open_ai_left.php b/admin/layouts/prompt/open_ai_left.php index 7edddf8..15735ef 100644 --- a/admin/layouts/prompt/open_ai_left.php +++ b/admin/layouts/prompt/open_ai_left.php @@ -17,6 +17,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; use VDM\Joomla\Utilities\Component\Helper; // get the form @@ -67,7 +72,7 @@ $hiddenFields = $displayData->get('hidden_fields') ?: array();
-

-

+

+

diff --git a/admin/layouts/prompt/open_ai_right.php b/admin/layouts/prompt/open_ai_right.php index 06e75fb..0faad60 100644 --- a/admin/layouts/prompt/open_ai_right.php +++ b/admin/layouts/prompt/open_ai_right.php @@ -17,6 +17,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; use VDM\Joomla\Utilities\Component\Helper; // get the form diff --git a/admin/layouts/prompt/prompt_above.php b/admin/layouts/prompt/prompt_above.php index 03d1854..d9c408b 100644 --- a/admin/layouts/prompt/prompt_above.php +++ b/admin/layouts/prompt/prompt_above.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'abbreviation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/prompt/prompt_fullwidth.php b/admin/layouts/prompt/prompt_fullwidth.php index 6059cd2..021fb18 100644 --- a/admin/layouts/prompt/prompt_fullwidth.php +++ b/admin/layouts/prompt/prompt_fullwidth.php @@ -38,7 +38,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'messages' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/prompt/prompt_left.php b/admin/layouts/prompt/prompt_left.php index 97ffcaf..b42537e 100644 --- a/admin/layouts/prompt/prompt_left.php +++ b/admin/layouts/prompt/prompt_left.php @@ -40,7 +40,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'cache_advance_note' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/prompt/prompt_right.php b/admin/layouts/prompt/prompt_right.php index f99214b..bd7aa95 100644 --- a/admin/layouts/prompt/prompt_right.php +++ b/admin/layouts/prompt/prompt_right.php @@ -38,7 +38,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'response_retrieval_note' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/prompt/publishing.php b/admin/layouts/prompt/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/prompt/publishing.php +++ b/admin/layouts/prompt/publishing.php @@ -40,7 +40,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/prompt/publlshing.php b/admin/layouts/prompt/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/prompt/publlshing.php +++ b/admin/layouts/prompt/publlshing.php @@ -40,7 +40,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/tag/details_above.php b/admin/layouts/tag/details_above.php index 2c98398..4f43f69 100644 --- a/admin/layouts/tag/details_above.php +++ b/admin/layouts/tag/details_above.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'linker' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/tag/details_fullwidth.php b/admin/layouts/tag/details_fullwidth.php index bb29c45..2cdb5e2 100644 --- a/admin/layouts/tag/details_fullwidth.php +++ b/admin/layouts/tag/details_fullwidth.php @@ -35,7 +35,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/tag/details_left.php b/admin/layouts/tag/details_left.php index e867d90..18d0070 100644 --- a/admin/layouts/tag/details_left.php +++ b/admin/layouts/tag/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/tag/publishing.php b/admin/layouts/tag/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/tag/publishing.php +++ b/admin/layouts/tag/publishing.php @@ -40,7 +40,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/tag/publlshing.php b/admin/layouts/tag/publlshing.php index 1c6d9d7..8501906 100644 --- a/admin/layouts/tag/publlshing.php +++ b/admin/layouts/tag/publlshing.php @@ -39,7 +39,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/tagged_verse/details_above.php b/admin/layouts/tagged_verse/details_above.php index a26fbde..45c96a1 100644 --- a/admin/layouts/tagged_verse/details_above.php +++ b/admin/layouts/tagged_verse/details_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'linker' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/tagged_verse/details_left.php b/admin/layouts/tagged_verse/details_left.php index 9871257..cd1ba0b 100644 --- a/admin/layouts/tagged_verse/details_left.php +++ b/admin/layouts/tagged_verse/details_left.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'book_nr' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/tagged_verse/details_right.php b/admin/layouts/tagged_verse/details_right.php index 558b01a..1a1a7a6 100644 --- a/admin/layouts/tagged_verse/details_right.php +++ b/admin/layouts/tagged_verse/details_right.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'verse' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/tagged_verse/publishing.php b/admin/layouts/tagged_verse/publishing.php index 72020c7..e7b0b9b 100644 --- a/admin/layouts/tagged_verse/publishing.php +++ b/admin/layouts/tagged_verse/publishing.php @@ -40,7 +40,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/tagged_verse/publlshing.php b/admin/layouts/tagged_verse/publlshing.php index 1c6d9d7..8501906 100644 --- a/admin/layouts/tagged_verse/publlshing.php +++ b/admin/layouts/tagged_verse/publlshing.php @@ -39,7 +39,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/translation/details_above.php b/admin/layouts/translation/details_above.php index fe171d8..5a6b83a 100644 --- a/admin/layouts/translation/details_above.php +++ b/admin/layouts/translation/details_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'direction' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/translation/details_fullwidth.php b/admin/layouts/translation/details_fullwidth.php index b430e43..1e86e6e 100644 --- a/admin/layouts/translation/details_fullwidth.php +++ b/admin/layouts/translation/details_fullwidth.php @@ -36,7 +36,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'distribution_history' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/translation/details_left.php b/admin/layouts/translation/details_left.php index 3593ad1..de96e91 100644 --- a/admin/layouts/translation/details_left.php +++ b/admin/layouts/translation/details_left.php @@ -41,7 +41,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'sha' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/translation/details_right.php b/admin/layouts/translation/details_right.php index b42845e..c4b22b0 100644 --- a/admin/layouts/translation/details_right.php +++ b/admin/layouts/translation/details_right.php @@ -39,7 +39,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'distribution_license' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/translation/publishing.php b/admin/layouts/translation/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/translation/publishing.php +++ b/admin/layouts/translation/publishing.php @@ -39,7 +39,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/translation/publlshing.php b/admin/layouts/translation/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/translation/publlshing.php +++ b/admin/layouts/translation/publlshing.php @@ -40,7 +40,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/trashhelper.php b/admin/layouts/trashhelper.php index 95bc7c9..7312627 100644 --- a/admin/layouts/trashhelper.php +++ b/admin/layouts/trashhelper.php @@ -18,6 +18,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; + ?> @@ -32,7 +37,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; @@ -40,7 +45,7 @@ defined('JPATH_BASE') or die('Restricted access'); } } else { // confirm deletion of those selected - if (confirm('')) { + if (confirm('')) { Joomla.submitbutton('get("name") ?>.delete'); }; } @@ -57,23 +62,23 @@ defined('JPATH_BASE') or die('Restricted access'); items)): ?>

- +

-

+

- +

-

+

diff --git a/admin/layouts/verse/details_above.php b/admin/layouts/verse/details_above.php index c662ca5..af05365 100644 --- a/admin/layouts/verse/details_above.php +++ b/admin/layouts/verse/details_above.php @@ -37,7 +37,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'verse' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_fullwidth.php b/admin/layouts/verse/details_fullwidth.php index fc8106f..940bf50 100644 --- a/admin/layouts/verse/details_fullwidth.php +++ b/admin/layouts/verse/details_fullwidth.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'text' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_left.php b/admin/layouts/verse/details_left.php index 88f95d4..0e92e27 100644 --- a/admin/layouts/verse/details_left.php +++ b/admin/layouts/verse/details_left.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'abbreviation' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/details_right.php b/admin/layouts/verse/details_right.php index e867d90..18d0070 100644 --- a/admin/layouts/verse/details_right.php +++ b/admin/layouts/verse/details_right.php @@ -35,7 +35,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/layouts/verse/publishing.php b/admin/layouts/verse/publishing.php index df756a0..79c70bb 100644 --- a/admin/layouts/verse/publishing.php +++ b/admin/layouts/verse/publishing.php @@ -39,7 +39,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/verse/publlshing.php b/admin/layouts/verse/publlshing.php index 171f8c2..ebe4ba7 100644 --- a/admin/layouts/verse/publlshing.php +++ b/admin/layouts/verse/publlshing.php @@ -40,7 +40,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'id' ); -$hiddenFields = $displayData->get('hidden_fields') ?: array(); +$hiddenFields = $displayData->get('hidden_fields') ?: []; ?> diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 1b2cd52..8ee23b6 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -18,12 +18,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\Registry\Registry; -use Joomla\CMS\Language\Text; use VDM\Joomla\Utilities\FileHelper; -use VDM\Joomla\Gitea\Factory; +use VDM\Joomla\Gitea\Factory as GiteaFactory; /** * Getbible Ajax List Model @@ -31,13 +34,13 @@ use VDM\Joomla\Gitea\Factory; class GetbibleModelAjax extends ListModel { protected $app_params; - + public function __construct() - { - parent::__construct(); + { + parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_getbible'); - + $this->app_params = ComponentHelper::getParams('com_getbible'); + } // Used in translation @@ -53,7 +56,7 @@ class GetbibleModelAjax extends ListModel public function isNew(?string $notice): bool { // first get the file path - $path_filename = FileHelper::getPath('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 = FileHelper::getContent($path_filename, FALSE)) !== FALSE) @@ -77,7 +80,7 @@ class GetbibleModelAjax extends ListModel public function isRead(?string $notice): bool { // first get the file path - $path_filename = FileHelper::getPath('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 = FileHelper::getContent($path_filename, FALSE)) !== FALSE) @@ -110,10 +113,10 @@ class GetbibleModelAjax extends ListModel try { // load the API details - Factory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token); + GiteaFactory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token); // get the repository tags - $tags = Factory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); + $tags = GiteaFactory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); } catch (DomainException $e) { @@ -208,13 +211,13 @@ class GetbibleModelAjax extends ListModel $token = $this->app_params->get('gitea_token'); // load the API details - Factory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', $token); + GiteaFactory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', $token); // get the gitea wiki page im markdown - $wiki = Factory::_('Gitea.Repository.Wiki')->get('getBible', 'support', $name); + $wiki = GiteaFactory::_('Gitea.Repository.Wiki')->get('getBible', 'support', $name); // now render the page in HTML - $page = Factory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true); + $page = GiteaFactory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true); } catch (DomainException $e) { diff --git a/admin/models/book.php b/admin/models/book.php index 8c4f7d5..96882a8 100644 --- a/admin/models/book.php +++ b/admin/models/book.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Book Admin Model @@ -69,18 +76,18 @@ class GetbibleModelBook 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 = 'book', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'book', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -125,7 +132,7 @@ class GetbibleModelBook 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; @@ -152,7 +159,7 @@ class GetbibleModelBook 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')) @@ -165,7 +172,7 @@ class GetbibleModelBook 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. @@ -302,7 +309,7 @@ class GetbibleModelBook extends AdminModel { return 'media/com_getbible/js/book.js'; } - + /** * Method to test whether a record can be deleted. * @@ -321,7 +328,7 @@ class GetbibleModelBook extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('book.delete', 'com_getbible.book.' . (int) $record->id); } @@ -339,7 +346,7 @@ class GetbibleModelBook extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -354,7 +361,7 @@ class GetbibleModelBook extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('book.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -364,18 +371,18 @@ class GetbibleModelBook extends AdminModel * @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('book.edit', 'com_getbible.book.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('book.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -383,19 +390,19 @@ class GetbibleModelBook 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(); @@ -407,7 +414,7 @@ class GetbibleModelBook 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('#__getbible_book')); @@ -422,7 +429,7 @@ class GetbibleModelBook extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -440,7 +447,7 @@ class GetbibleModelBook extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.book.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.book.data', []); if (empty($data)) { @@ -463,7 +470,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -479,7 +486,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; } @@ -499,10 +506,10 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -528,30 +535,30 @@ class GetbibleModelBook 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 = GetbibleHelper::getActions('book'); - $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 = GetbibleHelper::getActions('book'); + $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); } @@ -588,8 +595,7 @@ class GetbibleModelBook extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -615,7 +621,7 @@ class GetbibleModelBook 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 = GetbibleHelper::getActions('book'); @@ -654,7 +660,7 @@ class GetbibleModelBook extends AdminModel if (!$this->user->authorise('book.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; } @@ -670,7 +676,7 @@ class GetbibleModelBook 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; } } @@ -758,7 +764,7 @@ class GetbibleModelBook 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 = GetbibleHelper::getActions('book'); @@ -766,7 +772,7 @@ class GetbibleModelBook extends AdminModel if (!$this->canDo->get('book.edit') && !$this->canDo->get('book.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -783,7 +789,7 @@ class GetbibleModelBook extends AdminModel { if (!$this->user->authorise('book.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -799,7 +805,7 @@ class GetbibleModelBook 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; } } @@ -849,7 +855,7 @@ class GetbibleModelBook extends AdminModel return true; } - + /** * Method to save the form data. * @@ -861,23 +867,23 @@ class GetbibleModelBook 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; } @@ -887,7 +893,7 @@ class GetbibleModelBook extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -895,14 +901,14 @@ class GetbibleModelBook extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -915,7 +921,6 @@ class GetbibleModelBook extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/books.php b/admin/models/books.php index b61c155..ceb944d 100644 --- a/admin/models/books.php +++ b/admin/models/books.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Books List Model */ class GetbibleModelBooks extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -59,7 +66,7 @@ class GetbibleModelBooks 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')) @@ -116,7 +123,7 @@ class GetbibleModelBooks extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -131,12 +138,12 @@ class GetbibleModelBooks extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -150,11 +157,11 @@ class GetbibleModelBooks extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * @@ -163,9 +170,9 @@ class GetbibleModelBooks extends ListModel 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 @@ -291,7 +298,7 @@ class GetbibleModelBooks extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -306,13 +313,13 @@ class GetbibleModelBooks extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -335,13 +342,13 @@ class GetbibleModelBooks extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -353,7 +360,7 @@ class GetbibleModelBooks 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); diff --git a/admin/models/chapter.php b/admin/models/chapter.php index 3ec0a9a..1867590 100644 --- a/admin/models/chapter.php +++ b/admin/models/chapter.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Chapter Admin Model @@ -70,18 +77,18 @@ class GetbibleModelChapter 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 = 'chapter', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'chapter', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -126,7 +133,7 @@ class GetbibleModelChapter 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; @@ -153,7 +160,7 @@ class GetbibleModelChapter 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')) @@ -166,7 +173,7 @@ class GetbibleModelChapter 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. @@ -320,7 +327,7 @@ class GetbibleModelChapter extends AdminModel { return 'media/com_getbible/js/chapter.js'; } - + /** * Method to test whether a record can be deleted. * @@ -339,7 +346,7 @@ class GetbibleModelChapter extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('chapter.delete', 'com_getbible.chapter.' . (int) $record->id); } @@ -357,7 +364,7 @@ class GetbibleModelChapter extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -372,7 +379,7 @@ class GetbibleModelChapter extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('chapter.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -382,18 +389,18 @@ class GetbibleModelChapter extends AdminModel * @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('chapter.edit', 'com_getbible.chapter.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('chapter.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -401,19 +408,19 @@ class GetbibleModelChapter 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(); @@ -425,7 +432,7 @@ class GetbibleModelChapter 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('#__getbible_chapter')); @@ -440,7 +447,7 @@ class GetbibleModelChapter extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -458,7 +465,7 @@ class GetbibleModelChapter extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.chapter.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.chapter.data', []); if (empty($data)) { @@ -481,7 +488,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -497,7 +504,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; } @@ -517,10 +524,10 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -546,30 +553,30 @@ class GetbibleModelChapter 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 = GetbibleHelper::getActions('chapter'); - $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 = GetbibleHelper::getActions('chapter'); + $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); } @@ -606,8 +613,7 @@ class GetbibleModelChapter extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -633,7 +639,7 @@ class GetbibleModelChapter 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 = GetbibleHelper::getActions('chapter'); @@ -672,7 +678,7 @@ class GetbibleModelChapter extends AdminModel if (!$this->user->authorise('chapter.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; } @@ -688,7 +694,7 @@ class GetbibleModelChapter 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; } } @@ -776,7 +782,7 @@ class GetbibleModelChapter 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 = GetbibleHelper::getActions('chapter'); @@ -784,7 +790,7 @@ class GetbibleModelChapter extends AdminModel if (!$this->canDo->get('chapter.edit') && !$this->canDo->get('chapter.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -801,7 +807,7 @@ class GetbibleModelChapter extends AdminModel { if (!$this->user->authorise('chapter.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -817,7 +823,7 @@ class GetbibleModelChapter 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; } } @@ -867,7 +873,7 @@ class GetbibleModelChapter extends AdminModel return true; } - + /** * Method to save the form data. * @@ -879,23 +885,23 @@ class GetbibleModelChapter 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; } @@ -905,7 +911,7 @@ class GetbibleModelChapter extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -913,14 +919,14 @@ class GetbibleModelChapter extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -933,7 +939,6 @@ class GetbibleModelChapter extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/chapters.php b/admin/models/chapters.php index c1dd668..c5b2390 100644 --- a/admin/models/chapters.php +++ b/admin/models/chapters.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Chapters List Model */ class GetbibleModelChapters extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -60,7 +67,7 @@ class GetbibleModelChapters 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')) @@ -124,7 +131,7 @@ class GetbibleModelChapters extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +146,12 @@ class GetbibleModelChapters extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -158,11 +165,11 @@ class GetbibleModelChapters extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * @@ -171,9 +178,9 @@ class GetbibleModelChapters extends ListModel 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 @@ -348,7 +355,7 @@ class GetbibleModelChapters extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -363,13 +370,13 @@ class GetbibleModelChapters extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -378,25 +385,25 @@ class GetbibleModelChapters extends ListModel $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_chapter = $this->getState('filter.chapter'); - if (GetbibleHelper::checkArray($_chapter)) + if (UtilitiesArrayHelper::check($_chapter)) { $id .= ':' . implode(':', $_chapter); } // Check if this is only an number or string elseif (is_numeric($_chapter) - || GetbibleHelper::checkString($_chapter)) + || StringHelper::check($_chapter)) { $id .= ':' . $_chapter; } // Check if the value is an array $_book_nr = $this->getState('filter.book_nr'); - if (GetbibleHelper::checkArray($_book_nr)) + if (UtilitiesArrayHelper::check($_book_nr)) { $id .= ':' . implode(':', $_book_nr); } // Check if this is only an number or string elseif (is_numeric($_book_nr) - || GetbibleHelper::checkString($_book_nr)) + || StringHelper::check($_book_nr)) { $id .= ':' . $_book_nr; } @@ -415,13 +422,13 @@ class GetbibleModelChapters extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -433,7 +440,7 @@ class GetbibleModelChapters 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); diff --git a/admin/models/fields/booksfiltername.php b/admin/models/fields/booksfiltername.php index 3684864..930421d 100644 --- a/admin/models/fields/booksfiltername.php +++ b/admin/models/fields/booksfiltername.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldBooksfiltername extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldBooksfiltername extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldBooksfiltername extends JFormFieldList foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/booksfilternr.php b/admin/models/fields/booksfilternr.php index 4276585..749f93e 100644 --- a/admin/models/fields/booksfilternr.php +++ b/admin/models/fields/booksfilternr.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldBooksfilternr extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldBooksfilternr extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NUMBER') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NUMBER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldBooksfilternr extends JFormFieldList foreach ($_results as $nr) { // Now add the nr and its text to the options array - $_filter[] = JHtml::_('select.option', $nr, $nr); + $_filter[] = Html::_('select.option', $nr, $nr); } } return $_filter; diff --git a/admin/models/fields/chaptersfilterbooknr.php b/admin/models/fields/chaptersfilterbooknr.php index cde748b..d509ae9 100644 --- a/admin/models/fields/chaptersfilterbooknr.php +++ b/admin/models/fields/chaptersfilterbooknr.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -64,7 +68,7 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList foreach ($_results as $book_nr) { // Now add the book_nr and its text to the options array - $_filter[] = JHtml::_('select.option', $book_nr, $book_nr); + $_filter[] = Html::_('select.option', $book_nr, $book_nr); } } return $_filter; diff --git a/admin/models/fields/chaptersfilterchapter.php b/admin/models/fields/chaptersfilterchapter.php index c6f366d..65e6f42 100644 --- a/admin/models/fields/chaptersfilterchapter.php +++ b/admin/models/fields/chaptersfilterchapter.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -64,7 +68,7 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList foreach ($_results as $chapter) { // Now add the chapter and its text to the options array - $_filter[] = JHtml::_('select.option', $chapter, $chapter); + $_filter[] = Html::_('select.option', $chapter, $chapter); } } return $_filter; diff --git a/admin/models/fields/linkers.php b/admin/models/fields/linkers.php index 353f9dd..64bbca3 100644 --- a/admin/models/fields/linkers.php +++ b/admin/models/fields/linkers.php @@ -18,6 +18,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'); @@ -54,7 +58,7 @@ class JFormFieldLinkers 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( @@ -83,12 +87,12 @@ class JFormFieldLinkers 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 linker if ($user->authorise('linker.create', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } @@ -96,7 +100,7 @@ class JFormFieldLinkers extends JFormFieldList if ($user->authorise('linker.edit', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -129,7 +133,7 @@ class JFormFieldLinkers 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).'
'; diff --git a/admin/models/fields/linkersfiltername.php b/admin/models/fields/linkersfiltername.php index 61be658..e938497 100644 --- a/admin/models/fields/linkersfiltername.php +++ b/admin/models/fields/linkersfiltername.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldLinkersfiltername extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldLinkersfiltername extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldLinkersfiltername extends JFormFieldList foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/linkersfilterpublicnotes.php b/admin/models/fields/linkersfilterpublicnotes.php index 46a0573..84a4b7b 100644 --- a/admin/models/fields/linkersfilterpublicnotes.php +++ b/admin/models/fields/linkersfilterpublicnotes.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldLinkersfilterpublicnotes extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldLinkersfilterpublicnotes extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_NOTES') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_NOTES') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldLinkersfilterpublicnotes extends JFormFieldList // Translate the public_notes selection $_text = $_model->selectionTranslation($public_notes,'public_notes'); // Now add the public_notes and its text to the options array - $_filter[] = JHtml::_('select.option', $public_notes, JText::_($_text)); + $_filter[] = Html::_('select.option', $public_notes, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/linkersfilterpublictaggedverses.php b/admin/models/fields/linkersfilterpublictaggedverses.php index c6ae335..8e525df 100644 --- a/admin/models/fields/linkersfilterpublictaggedverses.php +++ b/admin/models/fields/linkersfilterpublictaggedverses.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldLinkersfilterpublictaggedverses extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldLinkersfilterpublictaggedverses extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_TAGGED_VERSES') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_TAGGED_VERSES') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldLinkersfilterpublictaggedverses extends JFormFieldList // Translate the public_tagged_verses selection $_text = $_model->selectionTranslation($public_tagged_verses,'public_tagged_verses'); // Now add the public_tagged_verses and its text to the options array - $_filter[] = JHtml::_('select.option', $public_tagged_verses, JText::_($_text)); + $_filter[] = Html::_('select.option', $public_tagged_verses, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/notesfilteraccess.php b/admin/models/fields/notesfilteraccess.php index bfd55ca..9f1481f 100644 --- a/admin/models/fields/notesfilteraccess.php +++ b/admin/models/fields/notesfilteraccess.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldNotesfilteraccess extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldNotesfilteraccess extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldNotesfilteraccess extends JFormFieldList // Translate the access selection $_text = $_model->selectionTranslation($access,'access'); // Now add the access and its text to the options array - $_filter[] = JHtml::_('select.option', $access, JText::_($_text)); + $_filter[] = Html::_('select.option', $access, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/notesfilterbooknr.php b/admin/models/fields/notesfilterbooknr.php index ed521db..d6c84e6 100644 --- a/admin/models/fields/notesfilterbooknr.php +++ b/admin/models/fields/notesfilterbooknr.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldNotesfilterbooknr extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldNotesfilterbooknr extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldNotesfilterbooknr extends JFormFieldList foreach ($_results as $book_nr) { // Now add the book_nr and its text to the options array - $_filter[] = JHtml::_('select.option', $book_nr, $book_nr); + $_filter[] = Html::_('select.option', $book_nr, $book_nr); } } return $_filter; diff --git a/admin/models/fields/notesfilterchapter.php b/admin/models/fields/notesfilterchapter.php index 406af4f..4efc73d 100644 --- a/admin/models/fields/notesfilterchapter.php +++ b/admin/models/fields/notesfilterchapter.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldNotesfilterchapter extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldNotesfilterchapter extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldNotesfilterchapter extends JFormFieldList foreach ($_results as $chapter) { // Now add the chapter and its text to the options array - $_filter[] = JHtml::_('select.option', $chapter, $chapter); + $_filter[] = Html::_('select.option', $chapter, $chapter); } } return $_filter; diff --git a/admin/models/fields/notesfilterverse.php b/admin/models/fields/notesfilterverse.php index 514fc29..0a5f119 100644 --- a/admin/models/fields/notesfilterverse.php +++ b/admin/models/fields/notesfilterverse.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldNotesfilterverse extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldNotesfilterverse extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldNotesfilterverse extends JFormFieldList foreach ($_results as $verse) { // Now add the verse and its text to the options array - $_filter[] = JHtml::_('select.option', $verse, $verse); + $_filter[] = Html::_('select.option', $verse, $verse); } } return $_filter; diff --git a/admin/models/fields/openaimessagesfilterrole.php b/admin/models/fields/openaimessagesfilterrole.php index b4f9067..4f13a97 100644 --- a/admin/models/fields/openaimessagesfilterrole.php +++ b/admin/models/fields/openaimessagesfilterrole.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldOpenaimessagesfilterrole extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldOpenaimessagesfilterrole extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ROLE') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_ROLE') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldOpenaimessagesfilterrole extends JFormFieldList // Translate the role selection $_text = $_model->selectionTranslation($role,'role'); // Now add the role and its text to the options array - $_filter[] = JHtml::_('select.option', $role, JText::_($_text)); + $_filter[] = Html::_('select.option', $role, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/openaimessagesfiltersource.php b/admin/models/fields/openaimessagesfiltersource.php index 6d1cd1f..77400c4 100644 --- a/admin/models/fields/openaimessagesfiltersource.php +++ b/admin/models/fields/openaimessagesfiltersource.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldOpenaimessagesfiltersource extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldOpenaimessagesfiltersource extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_SOURCE') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_SOURCE') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldOpenaimessagesfiltersource extends JFormFieldList // Translate the source selection $_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/openairesponses.php b/admin/models/fields/openairesponses.php index 8816b75..0a592d3 100644 --- a/admin/models/fields/openairesponses.php +++ b/admin/models/fields/openairesponses.php @@ -18,6 +18,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'); diff --git a/admin/models/fields/openairesponsesfilterresponseid.php b/admin/models/fields/openairesponsesfilterresponseid.php index 5e19576..2865746 100644 --- a/admin/models/fields/openairesponsesfilterresponseid.php +++ b/admin/models/fields/openairesponsesfilterresponseid.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldOpenairesponsesfilterresponseid extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldOpenairesponsesfilterresponseid extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_ID') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_ID') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldOpenairesponsesfilterresponseid extends JFormFieldList foreach ($_results as $response_id) { // Now add the response_id and its text to the options array - $_filter[] = JHtml::_('select.option', $response_id, $response_id); + $_filter[] = Html::_('select.option', $response_id, $response_id); } } return $_filter; diff --git a/admin/models/fields/openairesponsesfilterresponsemodel.php b/admin/models/fields/openairesponsesfilterresponsemodel.php index 13741ae..01cab9e 100644 --- a/admin/models/fields/openairesponsesfilterresponsemodel.php +++ b/admin/models/fields/openairesponsesfilterresponsemodel.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldOpenairesponsesfilterresponsemodel extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldOpenairesponsesfilterresponsemodel extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_MODEL') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_MODEL') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldOpenairesponsesfilterresponsemodel extends JFormFieldList foreach ($_results as $response_model) { // Now add the response_model and its text to the options array - $_filter[] = JHtml::_('select.option', $response_model, $response_model); + $_filter[] = Html::_('select.option', $response_model, $response_model); } } return $_filter; diff --git a/admin/models/fields/passwordsfiltername.php b/admin/models/fields/passwordsfiltername.php index bc0b3f8..2f8f85d 100644 --- a/admin/models/fields/passwordsfiltername.php +++ b/admin/models/fields/passwordsfiltername.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldPasswordsfiltername extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldPasswordsfiltername extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldPasswordsfiltername extends JFormFieldList foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/prompts.php b/admin/models/fields/prompts.php index dbfa2b2..9663eb6 100644 --- a/admin/models/fields/prompts.php +++ b/admin/models/fields/prompts.php @@ -18,6 +18,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'); diff --git a/admin/models/fields/promptsfiltercachebehaviour.php b/admin/models/fields/promptsfiltercachebehaviour.php index c3796fc..229db2b 100644 --- a/admin/models/fields/promptsfiltercachebehaviour.php +++ b/admin/models/fields/promptsfiltercachebehaviour.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldPromptsfiltercachebehaviour extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldPromptsfiltercachebehaviour extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CACHE_BEHAVIOUR') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_CACHE_BEHAVIOUR') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldPromptsfiltercachebehaviour extends JFormFieldList // Translate the cache_behaviour selection $_text = $_model->selectionTranslation($cache_behaviour,'cache_behaviour'); // Now add the cache_behaviour and its text to the options array - $_filter[] = JHtml::_('select.option', $cache_behaviour, JText::_($_text)); + $_filter[] = Html::_('select.option', $cache_behaviour, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/promptsfiltermodel.php b/admin/models/fields/promptsfiltermodel.php index fcd3556..eebfc14 100644 --- a/admin/models/fields/promptsfiltermodel.php +++ b/admin/models/fields/promptsfiltermodel.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldPromptsfiltermodel extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldPromptsfiltermodel extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_MODEL') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_MODEL') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldPromptsfiltermodel extends JFormFieldList // Translate the model selection $_text = $_model->selectionTranslation($model,'model'); // Now add the model and its text to the options array - $_filter[] = JHtml::_('select.option', $model, JText::_($_text)); + $_filter[] = Html::_('select.option', $model, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/promptsfiltername.php b/admin/models/fields/promptsfiltername.php index d116c01..b50e321 100644 --- a/admin/models/fields/promptsfiltername.php +++ b/admin/models/fields/promptsfiltername.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldPromptsfiltername extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldPromptsfiltername extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldPromptsfiltername extends JFormFieldList foreach ($_results as $name) { // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); + $_filter[] = Html::_('select.option', $name, $name); } } return $_filter; diff --git a/admin/models/fields/tagers.php b/admin/models/fields/tagers.php index 315797b..bf0e188 100644 --- a/admin/models/fields/tagers.php +++ b/admin/models/fields/tagers.php @@ -18,6 +18,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'); @@ -54,7 +58,7 @@ class JFormFieldTagers 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( @@ -83,12 +87,12 @@ class JFormFieldTagers 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 tag if ($user->authorise('tag.create', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } @@ -96,7 +100,7 @@ class JFormFieldTagers extends JFormFieldList if ($user->authorise('tag.edit', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. { // build edit button - $button[] = ''; // build script $script[] = " @@ -129,7 +133,7 @@ class JFormFieldTagers 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).'
'; diff --git a/admin/models/fields/taggedversesfilteraccess.php b/admin/models/fields/taggedversesfilteraccess.php index 98be0bd..e4f2945 100644 --- a/admin/models/fields/taggedversesfilteraccess.php +++ b/admin/models/fields/taggedversesfilteraccess.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTaggedversesfilteraccess extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldTaggedversesfilteraccess extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldTaggedversesfilteraccess extends JFormFieldList // Translate the access selection $_text = $_model->selectionTranslation($access,'access'); // Now add the access and its text to the options array - $_filter[] = JHtml::_('select.option', $access, JText::_($_text)); + $_filter[] = Html::_('select.option', $access, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/taggedversesfilterbooknr.php b/admin/models/fields/taggedversesfilterbooknr.php index d86ad5d..76944f5 100644 --- a/admin/models/fields/taggedversesfilterbooknr.php +++ b/admin/models/fields/taggedversesfilterbooknr.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTaggedversesfilterbooknr extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -64,7 +68,7 @@ class JFormFieldTaggedversesfilterbooknr extends JFormFieldList foreach ($_results as $book_nr) { // Now add the book_nr and its text to the options array - $_filter[] = JHtml::_('select.option', $book_nr, $book_nr); + $_filter[] = Html::_('select.option', $book_nr, $book_nr); } } return $_filter; diff --git a/admin/models/fields/taggedversesfilterchapter.php b/admin/models/fields/taggedversesfilterchapter.php index a1b3e19..086dc6a 100644 --- a/admin/models/fields/taggedversesfilterchapter.php +++ b/admin/models/fields/taggedversesfilterchapter.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTaggedversesfilterchapter extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -64,7 +68,7 @@ class JFormFieldTaggedversesfilterchapter extends JFormFieldList foreach ($_results as $chapter) { // Now add the chapter and its text to the options array - $_filter[] = JHtml::_('select.option', $chapter, $chapter); + $_filter[] = Html::_('select.option', $chapter, $chapter); } } return $_filter; diff --git a/admin/models/fields/taggedversesfilterverse.php b/admin/models/fields/taggedversesfilterverse.php index c6e1254..1dc7f6f 100644 --- a/admin/models/fields/taggedversesfilterverse.php +++ b/admin/models/fields/taggedversesfilterverse.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTaggedversesfilterverse extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -64,7 +68,7 @@ class JFormFieldTaggedversesfilterverse extends JFormFieldList foreach ($_results as $verse) { // Now add the verse and its text to the options array - $_filter[] = JHtml::_('select.option', $verse, $verse); + $_filter[] = Html::_('select.option', $verse, $verse); } } return $_filter; diff --git a/admin/models/fields/tagsfilteraccess.php b/admin/models/fields/tagsfilteraccess.php index 5bbc513..6c87148 100644 --- a/admin/models/fields/tagsfilteraccess.php +++ b/admin/models/fields/tagsfilteraccess.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTagsfilteraccess extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldTagsfilteraccess extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldTagsfilteraccess extends JFormFieldList // Translate the access selection $_text = $_model->selectionTranslation($access,'access'); // Now add the access and its text to the options array - $_filter[] = JHtml::_('select.option', $access, JText::_($_text)); + $_filter[] = Html::_('select.option', $access, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/targettranslations.php b/admin/models/fields/targettranslations.php index 29e9b34..a2e0bd0 100644 --- a/admin/models/fields/targettranslations.php +++ b/admin/models/fields/targettranslations.php @@ -18,6 +18,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'); diff --git a/admin/models/fields/translations.php b/admin/models/fields/translations.php index 5075914..1cc600c 100644 --- a/admin/models/fields/translations.php +++ b/admin/models/fields/translations.php @@ -18,6 +18,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'); diff --git a/admin/models/fields/translationsfilterdirection.php b/admin/models/fields/translationsfilterdirection.php index 23c3d5c..2cf7e6b 100644 --- a/admin/models/fields/translationsfilterdirection.php +++ b/admin/models/fields/translationsfilterdirection.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldTranslationsfilterdirection extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldTranslationsfilterdirection extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_DIRECTIONAL') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_DIRECTIONAL') . ' -'); if ($_results) { @@ -69,7 +73,7 @@ class JFormFieldTranslationsfilterdirection extends JFormFieldList // Translate the direction selection $_text = $_model->selectionTranslation($direction,'direction'); // Now add the direction and its text to the options array - $_filter[] = JHtml::_('select.option', $direction, JText::_($_text)); + $_filter[] = Html::_('select.option', $direction, Text::_($_text)); } } return $_filter; diff --git a/admin/models/fields/versesfilterbooknr.php b/admin/models/fields/versesfilterbooknr.php index 3a06f5b..dbc5e91 100644 --- a/admin/models/fields/versesfilterbooknr.php +++ b/admin/models/fields/versesfilterbooknr.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldVersesfilterbooknr extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldVersesfilterbooknr extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldVersesfilterbooknr extends JFormFieldList foreach ($_results as $book_nr) { // Now add the book_nr and its text to the options array - $_filter[] = JHtml::_('select.option', $book_nr, $book_nr); + $_filter[] = Html::_('select.option', $book_nr, $book_nr); } } return $_filter; diff --git a/admin/models/fields/versesfilterchapter.php b/admin/models/fields/versesfilterchapter.php index 757b747..1ffb7e8 100644 --- a/admin/models/fields/versesfilterchapter.php +++ b/admin/models/fields/versesfilterchapter.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldVersesfilterchapter extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldVersesfilterchapter extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldVersesfilterchapter extends JFormFieldList foreach ($_results as $chapter) { // Now add the chapter and its text to the options array - $_filter[] = JHtml::_('select.option', $chapter, $chapter); + $_filter[] = Html::_('select.option', $chapter, $chapter); } } return $_filter; diff --git a/admin/models/fields/versesfilterverse.php b/admin/models/fields/versesfilterverse.php index dc5bac4..f106b6f 100644 --- a/admin/models/fields/versesfilterverse.php +++ b/admin/models/fields/versesfilterverse.php @@ -18,6 +18,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'); @@ -42,7 +46,7 @@ class JFormFieldVersesfilterverse extends JFormFieldList protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -57,7 +61,7 @@ class JFormFieldVersesfilterverse extends JFormFieldList $_results = $db->loadColumn(); $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); + $_filter[] = Html::_('select.option', '', '- ' . Text::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); if ($_results) { @@ -65,7 +69,7 @@ class JFormFieldVersesfilterverse extends JFormFieldList foreach ($_results as $verse) { // Now add the verse and its text to the options array - $_filter[] = JHtml::_('select.option', $verse, $verse); + $_filter[] = Html::_('select.option', $verse, $verse); } } return $_filter; diff --git a/admin/models/getbible.php b/admin/models/getbible.php index 49b49d8..96d30df 100644 --- a/admin/models/getbible.php +++ b/admin/models/getbible.php @@ -18,9 +18,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\Registry\Registry; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible List Model @@ -30,9 +36,9 @@ class GetbibleModelGetbible 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.linkers', 'png.notes', 'png.tagged_verses', 'png.prompts', 'png.open_ai_responses', 'png.tags', 'png.translations', 'png.books', 'png.chapters', 'png.verses') @@ -100,7 +106,7 @@ class GetbibleModelGetbible extends ListModel foreach($viewGroups as $group => $views) { $i = 0; - if (GetbibleHelper::checkArray($views)) + if (UtilitiesArrayHelper::check($views)) { foreach($views as $view) { @@ -116,7 +122,7 @@ class GetbibleModelGetbible extends ListModel $alt = $name; $url = $url; $image = $name . '.' . $type; - $name = 'COM_GETBIBLE_DASHBOARD_' . GetbibleHelper::safeString($name,'U'); + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U'); } } // internal views @@ -141,7 +147,7 @@ class GetbibleModelGetbible extends ListModel $url = 'index.php?option=com_getbible&view=' . $name . '&layout=edit'; $image = $name . '_' . $action. '.' . $type; $alt = $name . ' ' . $action; - $name = 'COM_GETBIBLE_DASHBOARD_'.GetbibleHelper::safeString($name,'U').'_ADD'; + $name = 'COM_GETBIBLE_DASHBOARD_'.StringHelper::safe($name,'U').'_ADD'; $add = true; break; default: @@ -158,7 +164,7 @@ class GetbibleModelGetbible extends ListModel $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; $image = $name . '_' . $action . '.' . $type; $alt = $viewName . ' ' . $action; - $name = 'COM_GETBIBLE_DASHBOARD_' . GetbibleHelper::safeString($name,'U') . '_' . GetbibleHelper::safeString($action,'U'); + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U') . '_' . StringHelper::safe($action,'U'); break; } } @@ -168,7 +174,7 @@ class GetbibleModelGetbible extends ListModel $alt = $name; $url = 'index.php?option=com_getbible&view=' . $name; $image = $name . '.' . $type; - $name = 'COM_GETBIBLE_DASHBOARD_' . GetbibleHelper::safeString($name,'U'); + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U'); $hover = false; } } @@ -182,7 +188,7 @@ class GetbibleModelGetbible extends ListModel $hover = false; } // first make sure the view access is set - if (GetbibleHelper::checkArray($viewAccess)) + if (UtilitiesArrayHelper::check($viewAccess)) { // setup some defaults $dashboard_add = false; @@ -190,11 +196,11 @@ class GetbibleModelGetbible extends ListModel $accessTo = ''; $accessAdd = ''; // access checking start - $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? GetbibleHelper::checkString($viewAccess[$viewName.'.create']):false; - $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? GetbibleHelper::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'])) ? GetbibleHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; - $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? GetbibleHelper::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) { @@ -218,7 +224,7 @@ class GetbibleModelGetbible extends ListModel { $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_getbible'); } - if (GetbibleHelper::checkString($accessAdd) && GetbibleHelper::checkString($accessTo)) + if (StringHelper::check($accessAdd) && StringHelper::check($accessTo)) { // check access if($user->authorise($accessAdd, 'com_getbible') && $user->authorise($accessTo, 'com_getbible') && $dashboard_add) @@ -230,7 +236,7 @@ class GetbibleModelGetbible extends ListModel $icons[$group][$i]->alt = $alt; } } - elseif (GetbibleHelper::checkString($accessTo)) + elseif (StringHelper::check($accessTo)) { // check access if($user->authorise($accessTo, 'com_getbible') && $dashboard_list) @@ -242,7 +248,7 @@ class GetbibleModelGetbible extends ListModel $icons[$group][$i]->alt = $alt; } } - elseif (GetbibleHelper::checkString($accessAdd)) + elseif (StringHelper::check($accessAdd)) { // check access if($user->authorise($accessAdd, 'com_getbible') && $dashboard_add) @@ -287,7 +293,7 @@ class GetbibleModelGetbible extends ListModel { // the call URL $call_url = JUri::base() . 'index.php?option=com_getbible&task=ajax.getWiki&format=json&raw=true&' . JSession::getFormToken() . '=1&name=Home'; - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' function getWikiPage(){ @@ -305,14 +311,14 @@ class GetbibleModelGetbible extends ListModel } setTimeout(getWikiPage, 1000);'); - return '
'.JText::_('COM_GETBIBLE_THE_WIKI_IS_LOADING').'..
'; + return '
'.Text::_('COM_GETBIBLE_THE_WIKI_IS_LOADING').'..
'; } public function getNoticeboard() { // get the document to load the scripts - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScript(JURI::root() . "media/com_getbible/js/marked.js"); $document->addScriptDeclaration(' var token = "'.JSession::getFormToken().'"; @@ -341,11 +347,11 @@ class GetbibleModelGetbible extends ListModel } }); } else { - jQuery("#noticeboard-md").html("'.JText::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + jQuery("#noticeboard-md").html("'.Text::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); } }) .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#noticeboard-md").html("'.JText::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + jQuery("#noticeboard-md").html("'.Text::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); }); }); // to check is READ/NEW @@ -380,12 +386,12 @@ jQuery(document).ready( function($) { } , 500); });'); - return '
'.JText::_('COM_GETBIBLE_THE_NOTICE_BOARD_IS_LOADING').'..
'; + return '
'.Text::_('COM_GETBIBLE_THE_NOTICE_BOARD_IS_LOADING').'..
'; } public function getReadme() { - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' var getreadme = "'. JURI::root() . 'administrator/components/com_getbible/README.txt"; jQuery(document).ready(function () { @@ -394,11 +400,11 @@ jQuery(document).ready( function($) { jQuery("#readme-md").html(marked.parse(readme)); }) .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#readme-md").html("'.JText::_('COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATTER').'"); + jQuery("#readme-md").html("'.Text::_('COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATTER').'"); }); });'); - return '
'.JText::_('COM_GETBIBLE_THE_README_IS_LOADING').'..
'; + return '
'.Text::_('COM_GETBIBLE_THE_README_IS_LOADING').'..
'; } /** @@ -411,7 +417,7 @@ jQuery(document).ready( function($) { { // the call URL $call_url = JUri::base() . 'index.php?option=com_getbible&task=ajax.getVersion&format=json&raw=true&' . JSession::getFormToken() . '=1&version=1'; - $document = JFactory::getDocument(); + $document = Factory::getDocument(); $document->addScriptDeclaration(' function getComponentVersionStatus() { fetch("' . $call_url . '").then((response) => { diff --git a/admin/models/linker.php b/admin/models/linker.php index f404cff..1f977d6 100644 --- a/admin/models/linker.php +++ b/admin/models/linker.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; @@ -70,18 +79,18 @@ class GetbibleModelLinker 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 = 'linker', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'linker', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -126,9 +135,9 @@ class GetbibleModelLinker extends AdminModel public function getVvvtags() { // 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 @@ -186,12 +195,12 @@ class GetbibleModelLinker extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -208,7 +217,7 @@ class GetbibleModelLinker extends AdminModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -237,7 +246,7 @@ class GetbibleModelLinker extends AdminModel 0 => 'COM_GETBIBLE_TAGGED_VERSE_PRIVATE' ); // Now check if value is found in this array - if (isset($accessArray[$value]) && GetbibleHelper::checkString($accessArray[$value])) + if (isset($accessArray[$value]) && UtilitiesStringHelper::check($accessArray[$value])) { return $accessArray[$value]; } @@ -253,9 +262,9 @@ class GetbibleModelLinker extends AdminModel public function getVvwnotes() { // 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 @@ -305,12 +314,12 @@ class GetbibleModelLinker extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -327,7 +336,7 @@ class GetbibleModelLinker extends AdminModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -356,7 +365,7 @@ class GetbibleModelLinker extends AdminModel 0 => 'COM_GETBIBLE_NOTE_PRIVATE' ); // Now check if value is found in this array - if (isset($accessArray[$value]) && GetbibleHelper::checkString($accessArray[$value])) + if (isset($accessArray[$value]) && UtilitiesStringHelper::check($accessArray[$value])) { return $accessArray[$value]; } @@ -372,9 +381,9 @@ class GetbibleModelLinker extends AdminModel public function getVvxpasswords() { // 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 @@ -437,12 +446,12 @@ class GetbibleModelLinker extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -472,7 +481,7 @@ class GetbibleModelLinker 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; @@ -499,7 +508,7 @@ class GetbibleModelLinker 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')) @@ -512,7 +521,7 @@ class GetbibleModelLinker 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. @@ -662,7 +671,7 @@ class GetbibleModelLinker extends AdminModel { return 'media/com_getbible/js/linker.js'; } - + /** * Method to test whether a record can be deleted. * @@ -681,7 +690,7 @@ class GetbibleModelLinker extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('linker.delete', 'com_getbible.linker.' . (int) $record->id); } @@ -699,7 +708,7 @@ class GetbibleModelLinker extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -714,7 +723,7 @@ class GetbibleModelLinker extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('linker.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -724,18 +733,18 @@ class GetbibleModelLinker extends AdminModel * @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('linker.edit', 'com_getbible.linker.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('linker.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -743,19 +752,19 @@ class GetbibleModelLinker 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(); @@ -767,7 +776,7 @@ class GetbibleModelLinker 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('#__getbible_linker')); @@ -782,7 +791,7 @@ class GetbibleModelLinker extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -800,7 +809,7 @@ class GetbibleModelLinker extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.linker.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.linker.data', []); if (empty($data)) { @@ -823,7 +832,7 @@ class GetbibleModelLinker extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -839,7 +848,7 @@ class GetbibleModelLinker extends AdminModel { return false; } - + return true; } @@ -859,10 +868,10 @@ class GetbibleModelLinker extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -888,30 +897,30 @@ class GetbibleModelLinker 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 = GetbibleHelper::getActions('linker'); - $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 = GetbibleHelper::getActions('linker'); + $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); } @@ -948,8 +957,7 @@ class GetbibleModelLinker extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -975,7 +983,7 @@ class GetbibleModelLinker 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 = GetbibleHelper::getActions('linker'); @@ -1014,7 +1022,7 @@ class GetbibleModelLinker extends AdminModel if (!$this->user->authorise('linker.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; } @@ -1030,7 +1038,7 @@ class GetbibleModelLinker 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; } } @@ -1118,7 +1126,7 @@ class GetbibleModelLinker 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 = GetbibleHelper::getActions('linker'); @@ -1126,7 +1134,7 @@ class GetbibleModelLinker extends AdminModel if (!$this->canDo->get('linker.edit') && !$this->canDo->get('linker.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1143,7 +1151,7 @@ class GetbibleModelLinker extends AdminModel { if (!$this->user->authorise('linker.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1159,7 +1167,7 @@ class GetbibleModelLinker 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; } } @@ -1209,7 +1217,7 @@ class GetbibleModelLinker extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1221,15 +1229,15 @@ class GetbibleModelLinker 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; } @@ -1248,11 +1256,11 @@ class GetbibleModelLinker extends AdminModel // must always be set $data['guid'] = (string) GuidHelper::get(); } - + // 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; } @@ -1262,7 +1270,7 @@ class GetbibleModelLinker extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1270,14 +1278,14 @@ class GetbibleModelLinker extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1290,7 +1298,6 @@ class GetbibleModelLinker extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/linkers.php b/admin/models/linkers.php index 2d607a2..aaace2e 100644 --- a/admin/models/linkers.php +++ b/admin/models/linkers.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Linkers List Model */ class GetbibleModelLinkers extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -59,7 +66,7 @@ class GetbibleModelLinkers 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')) @@ -116,7 +123,7 @@ class GetbibleModelLinkers extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -131,12 +138,12 @@ class GetbibleModelLinkers extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -152,7 +159,7 @@ class GetbibleModelLinkers extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -163,7 +170,7 @@ class GetbibleModelLinkers extends ListModel } } - + // return items return $items; } @@ -183,7 +190,7 @@ class GetbibleModelLinkers extends ListModel 0 => 'COM_GETBIBLE_LINKER_NO' ); // Now check if value is found in this array - if (isset($public_tagged_versesArray[$value]) && GetbibleHelper::checkString($public_tagged_versesArray[$value])) + if (isset($public_tagged_versesArray[$value]) && StringHelper::check($public_tagged_versesArray[$value])) { return $public_tagged_versesArray[$value]; } @@ -196,14 +203,14 @@ class GetbibleModelLinkers extends ListModel 0 => 'COM_GETBIBLE_LINKER_NO' ); // Now check if value is found in this array - if (isset($public_notesArray[$value]) && GetbibleHelper::checkString($public_notesArray[$value])) + if (isset($public_notesArray[$value]) && StringHelper::check($public_notesArray[$value])) { return $public_notesArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -212,9 +219,9 @@ class GetbibleModelLinkers extends ListModel 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 @@ -333,7 +340,7 @@ class GetbibleModelLinkers extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -348,13 +355,13 @@ class GetbibleModelLinkers extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -377,13 +384,13 @@ class GetbibleModelLinkers extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -395,7 +402,7 @@ class GetbibleModelLinkers 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); diff --git a/admin/models/note.php b/admin/models/note.php index f5d7d1e..2f3eb4f 100644 --- a/admin/models/note.php +++ b/admin/models/note.php @@ -18,12 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Note Admin Model @@ -73,18 +80,18 @@ class GetbibleModelNote 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 = 'note', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'note', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -129,7 +136,7 @@ class GetbibleModelNote 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; @@ -156,7 +163,7 @@ class GetbibleModelNote 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')) @@ -169,7 +176,7 @@ class GetbibleModelNote 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. @@ -356,7 +363,7 @@ class GetbibleModelNote extends AdminModel { return 'media/com_getbible/js/note.js'; } - + /** * Method to test whether a record can be deleted. * @@ -375,7 +382,7 @@ class GetbibleModelNote extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('note.delete', 'com_getbible.note.' . (int) $record->id); } @@ -393,7 +400,7 @@ class GetbibleModelNote extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -408,7 +415,7 @@ class GetbibleModelNote extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('note.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -418,18 +425,18 @@ class GetbibleModelNote extends AdminModel * @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('note.edit', 'com_getbible.note.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('note.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -437,19 +444,19 @@ class GetbibleModelNote 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(); @@ -461,7 +468,7 @@ class GetbibleModelNote 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('#__getbible_note')); @@ -476,7 +483,7 @@ class GetbibleModelNote extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -494,7 +501,7 @@ class GetbibleModelNote extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.note.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.note.data', []); if (empty($data)) { @@ -517,7 +524,7 @@ class GetbibleModelNote extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -533,7 +540,7 @@ class GetbibleModelNote extends AdminModel { return false; } - + return true; } @@ -553,10 +560,10 @@ class GetbibleModelNote extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -582,30 +589,30 @@ class GetbibleModelNote 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 = GetbibleHelper::getActions('note'); - $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 = GetbibleHelper::getActions('note'); + $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); } @@ -642,8 +649,7 @@ class GetbibleModelNote extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -669,7 +675,7 @@ class GetbibleModelNote 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 = GetbibleHelper::getActions('note'); @@ -708,7 +714,7 @@ class GetbibleModelNote extends AdminModel if (!$this->user->authorise('note.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; } @@ -724,7 +730,7 @@ class GetbibleModelNote 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; } } @@ -806,7 +812,7 @@ class GetbibleModelNote 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 = GetbibleHelper::getActions('note'); @@ -814,7 +820,7 @@ class GetbibleModelNote extends AdminModel if (!$this->canDo->get('note.edit') && !$this->canDo->get('note.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -831,7 +837,7 @@ class GetbibleModelNote extends AdminModel { if (!$this->user->authorise('note.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -847,7 +853,7 @@ class GetbibleModelNote 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; } } @@ -897,7 +903,7 @@ class GetbibleModelNote extends AdminModel return true; } - + /** * Method to save the form data. * @@ -909,15 +915,15 @@ class GetbibleModelNote 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; } @@ -936,11 +942,11 @@ class GetbibleModelNote extends AdminModel // must always be set $data['guid'] = (string) GuidHelper::get(); } - + // 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; } @@ -950,7 +956,7 @@ class GetbibleModelNote extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -958,14 +964,14 @@ class GetbibleModelNote extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -978,7 +984,6 @@ class GetbibleModelNote extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/notes.php b/admin/models/notes.php index f41fa53..99d0aa3 100644 --- a/admin/models/notes.php +++ b/admin/models/notes.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Notes List Model */ class GetbibleModelNotes extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -60,7 +67,7 @@ class GetbibleModelNotes 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')) @@ -124,7 +131,7 @@ class GetbibleModelNotes extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +146,12 @@ class GetbibleModelNotes extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -161,7 +168,7 @@ class GetbibleModelNotes extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -170,7 +177,7 @@ class GetbibleModelNotes extends ListModel } } - + // return items return $items; } @@ -190,14 +197,14 @@ class GetbibleModelNotes extends ListModel 0 => 'COM_GETBIBLE_NOTE_PRIVATE' ); // Now check if value is found in this array - if (isset($accessArray[$value]) && GetbibleHelper::checkString($accessArray[$value])) + if (isset($accessArray[$value]) && StringHelper::check($accessArray[$value])) { return $accessArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -206,9 +213,9 @@ class GetbibleModelNotes extends ListModel 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 @@ -352,7 +359,7 @@ class GetbibleModelNotes extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -385,13 +392,13 @@ class GetbibleModelNotes extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -403,7 +410,7 @@ class GetbibleModelNotes 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); diff --git a/admin/models/open_ai_message.php b/admin/models/open_ai_message.php index f9a3159..b3091af 100644 --- a/admin/models/open_ai_message.php +++ b/admin/models/open_ai_message.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Open_ai_message Admin Model @@ -74,18 +81,18 @@ class GetbibleModelOpen_ai_message 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 = 'open_ai_message', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'open_ai_message', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -130,7 +137,7 @@ class GetbibleModelOpen_ai_message 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; @@ -157,7 +164,7 @@ class GetbibleModelOpen_ai_message 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')) @@ -170,7 +177,7 @@ class GetbibleModelOpen_ai_message 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. @@ -361,7 +368,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { return 'media/com_getbible/js/open_ai_message.js'; } - + /** * Method to test whether a record can be deleted. * @@ -380,7 +387,7 @@ class GetbibleModelOpen_ai_message extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('open_ai_message.delete', 'com_getbible.open_ai_message.' . (int) $record->id); } @@ -398,7 +405,7 @@ class GetbibleModelOpen_ai_message extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -413,7 +420,7 @@ class GetbibleModelOpen_ai_message extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('open_ai_message.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -423,18 +430,18 @@ class GetbibleModelOpen_ai_message extends AdminModel * @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('open_ai_message.edit', 'com_getbible.open_ai_message.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('open_ai_message.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -442,19 +449,19 @@ class GetbibleModelOpen_ai_message 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(); @@ -466,7 +473,7 @@ class GetbibleModelOpen_ai_message 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('#__getbible_open_ai_message')); @@ -481,7 +488,7 @@ class GetbibleModelOpen_ai_message extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -499,7 +506,7 @@ class GetbibleModelOpen_ai_message extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.open_ai_message.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.open_ai_message.data', []); if (empty($data)) { @@ -522,7 +529,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -538,7 +545,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { return false; } - + return true; } @@ -558,10 +565,10 @@ class GetbibleModelOpen_ai_message extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -587,30 +594,30 @@ class GetbibleModelOpen_ai_message 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 = GetbibleHelper::getActions('open_ai_message'); - $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 = GetbibleHelper::getActions('open_ai_message'); + $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); } @@ -647,8 +654,7 @@ class GetbibleModelOpen_ai_message extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -674,7 +680,7 @@ class GetbibleModelOpen_ai_message 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 = GetbibleHelper::getActions('open_ai_message'); @@ -713,7 +719,7 @@ class GetbibleModelOpen_ai_message extends AdminModel if (!$this->user->authorise('open_ai_message.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; } @@ -729,7 +735,7 @@ class GetbibleModelOpen_ai_message 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; } } @@ -817,7 +823,7 @@ class GetbibleModelOpen_ai_message 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 = GetbibleHelper::getActions('open_ai_message'); @@ -825,7 +831,7 @@ class GetbibleModelOpen_ai_message extends AdminModel if (!$this->canDo->get('open_ai_message.edit') && !$this->canDo->get('open_ai_message.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -842,7 +848,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { if (!$this->user->authorise('open_ai_message.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -858,7 +864,7 @@ class GetbibleModelOpen_ai_message 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; } } @@ -908,7 +914,7 @@ class GetbibleModelOpen_ai_message extends AdminModel return true; } - + /** * Method to save the form data. * @@ -920,23 +926,23 @@ class GetbibleModelOpen_ai_message 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; } @@ -946,7 +952,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -954,14 +960,14 @@ class GetbibleModelOpen_ai_message extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -974,7 +980,6 @@ class GetbibleModelOpen_ai_message extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/open_ai_messages.php b/admin/models/open_ai_messages.php index 2023545..f6f3fd7 100644 --- a/admin/models/open_ai_messages.php +++ b/admin/models/open_ai_messages.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Open_ai_messages List Model */ class GetbibleModelOpen_ai_messages extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -60,7 +67,7 @@ class GetbibleModelOpen_ai_messages 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')) @@ -124,7 +131,7 @@ class GetbibleModelOpen_ai_messages extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +146,12 @@ class GetbibleModelOpen_ai_messages extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -160,7 +167,7 @@ class GetbibleModelOpen_ai_messages extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -171,7 +178,7 @@ class GetbibleModelOpen_ai_messages extends ListModel } } - + // return items return $items; } @@ -193,7 +200,7 @@ class GetbibleModelOpen_ai_messages extends ListModel 'function' => 'COM_GETBIBLE_OPEN_AI_MESSAGE_FUNCTION' ); // Now check if value is found in this array - if (isset($roleArray[$value]) && GetbibleHelper::checkString($roleArray[$value])) + if (isset($roleArray[$value]) && StringHelper::check($roleArray[$value])) { return $roleArray[$value]; } @@ -206,14 +213,14 @@ class GetbibleModelOpen_ai_messages extends ListModel 2 => 'COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI' ); // Now check if value is found in this array - if (isset($sourceArray[$value]) && GetbibleHelper::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. * @@ -222,9 +229,9 @@ class GetbibleModelOpen_ai_messages extends ListModel 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 @@ -368,7 +375,7 @@ class GetbibleModelOpen_ai_messages extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -383,13 +390,13 @@ class GetbibleModelOpen_ai_messages extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -413,13 +420,13 @@ class GetbibleModelOpen_ai_messages extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -431,7 +438,7 @@ class GetbibleModelOpen_ai_messages 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); diff --git a/admin/models/open_ai_response.php b/admin/models/open_ai_response.php index 9a0890d..b5003d8 100644 --- a/admin/models/open_ai_response.php +++ b/admin/models/open_ai_response.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Getbible Open_ai_response Admin Model @@ -100,18 +109,18 @@ class GetbibleModelOpen_ai_response 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 = 'open_ai_response', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'open_ai_response', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -154,9 +163,9 @@ class GetbibleModelOpen_ai_response extends AdminModel public function getVvymessage() { // 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 @@ -223,12 +232,12 @@ class GetbibleModelOpen_ai_response extends AdminModel $items = $db->loadObjectList(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -244,7 +253,7 @@ class GetbibleModelOpen_ai_response extends AdminModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -277,7 +286,7 @@ class GetbibleModelOpen_ai_response extends AdminModel 'function' => 'COM_GETBIBLE_OPEN_AI_MESSAGE_FUNCTION' ); // Now check if value is found in this array - if (isset($roleArray[$value]) && GetbibleHelper::checkString($roleArray[$value])) + if (isset($roleArray[$value]) && UtilitiesStringHelper::check($roleArray[$value])) { return $roleArray[$value]; } @@ -290,7 +299,7 @@ class GetbibleModelOpen_ai_response extends AdminModel 2 => 'COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI' ); // Now check if value is found in this array - if (isset($sourceArray[$value]) && GetbibleHelper::checkString($sourceArray[$value])) + if (isset($sourceArray[$value]) && UtilitiesStringHelper::check($sourceArray[$value])) { return $sourceArray[$value]; } @@ -309,7 +318,7 @@ class GetbibleModelOpen_ai_response 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; @@ -336,7 +345,7 @@ class GetbibleModelOpen_ai_response 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')) @@ -349,7 +358,7 @@ class GetbibleModelOpen_ai_response 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. @@ -809,7 +818,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { return 'media/com_getbible/js/open_ai_response.js'; } - + /** * Method to test whether a record can be deleted. * @@ -828,7 +837,7 @@ class GetbibleModelOpen_ai_response extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('open_ai_response.delete', 'com_getbible.open_ai_response.' . (int) $record->id); } @@ -846,7 +855,7 @@ class GetbibleModelOpen_ai_response extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -861,7 +870,7 @@ class GetbibleModelOpen_ai_response extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('open_ai_response.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -871,18 +880,18 @@ class GetbibleModelOpen_ai_response extends AdminModel * @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('open_ai_response.edit', 'com_getbible.open_ai_response.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('open_ai_response.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -890,19 +899,19 @@ class GetbibleModelOpen_ai_response 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(); @@ -914,7 +923,7 @@ class GetbibleModelOpen_ai_response 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('#__getbible_open_ai_response')); @@ -929,7 +938,7 @@ class GetbibleModelOpen_ai_response extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -947,7 +956,7 @@ class GetbibleModelOpen_ai_response extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.open_ai_response.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.open_ai_response.data', []); if (empty($data)) { @@ -970,7 +979,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -986,7 +995,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { return false; } - + return true; } @@ -1006,10 +1015,10 @@ class GetbibleModelOpen_ai_response extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -1035,30 +1044,30 @@ class GetbibleModelOpen_ai_response 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 = GetbibleHelper::getActions('open_ai_response'); - $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 = GetbibleHelper::getActions('open_ai_response'); + $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); } @@ -1095,8 +1104,7 @@ class GetbibleModelOpen_ai_response extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -1122,7 +1130,7 @@ class GetbibleModelOpen_ai_response 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 = GetbibleHelper::getActions('open_ai_response'); @@ -1161,7 +1169,7 @@ class GetbibleModelOpen_ai_response extends AdminModel if (!$this->user->authorise('open_ai_response.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; } @@ -1177,7 +1185,7 @@ class GetbibleModelOpen_ai_response 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; } } @@ -1265,7 +1273,7 @@ class GetbibleModelOpen_ai_response 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 = GetbibleHelper::getActions('open_ai_response'); @@ -1273,7 +1281,7 @@ class GetbibleModelOpen_ai_response extends AdminModel if (!$this->canDo->get('open_ai_response.edit') && !$this->canDo->get('open_ai_response.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1290,7 +1298,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { if (!$this->user->authorise('open_ai_response.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1306,7 +1314,7 @@ class GetbibleModelOpen_ai_response 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; } } @@ -1356,7 +1364,7 @@ class GetbibleModelOpen_ai_response extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1368,23 +1376,23 @@ class GetbibleModelOpen_ai_response 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; } @@ -1394,7 +1402,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1402,14 +1410,14 @@ class GetbibleModelOpen_ai_response extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1422,7 +1430,6 @@ class GetbibleModelOpen_ai_response extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/open_ai_responses.php b/admin/models/open_ai_responses.php index bc2fe45..10254cb 100644 --- a/admin/models/open_ai_responses.php +++ b/admin/models/open_ai_responses.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Open_ai_responses List Model */ class GetbibleModelOpen_ai_responses extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -61,7 +68,7 @@ class GetbibleModelOpen_ai_responses 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')) @@ -132,7 +139,7 @@ class GetbibleModelOpen_ai_responses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -147,12 +154,12 @@ class GetbibleModelOpen_ai_responses extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -166,11 +173,11 @@ class GetbibleModelOpen_ai_responses extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * @@ -179,9 +186,9 @@ class GetbibleModelOpen_ai_responses extends ListModel 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 @@ -304,7 +311,7 @@ class GetbibleModelOpen_ai_responses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -319,13 +326,13 @@ class GetbibleModelOpen_ai_responses extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -350,13 +357,13 @@ class GetbibleModelOpen_ai_responses extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -368,7 +375,7 @@ class GetbibleModelOpen_ai_responses 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); diff --git a/admin/models/password.php b/admin/models/password.php index d5177d0..dd3293f 100644 --- a/admin/models/password.php +++ b/admin/models/password.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; @@ -70,18 +77,18 @@ class GetbibleModelPassword 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 = 'password', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'password', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -126,7 +133,7 @@ class GetbibleModelPassword 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; @@ -153,7 +160,7 @@ class GetbibleModelPassword 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')) @@ -166,7 +173,7 @@ class GetbibleModelPassword 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. @@ -297,7 +304,7 @@ class GetbibleModelPassword extends AdminModel // Make sure $form->setValue('password', null, ''); } - elseif (GetbibleHelper::checkArray($val)) + elseif (UtilitiesArrayHelper::check($val)) { // We have to unset then (TODO) // Hiddend field can not handel array value @@ -341,7 +348,7 @@ class GetbibleModelPassword extends AdminModel { return 'media/com_getbible/js/password.js'; } - + /** * Method to test whether a record can be deleted. * @@ -360,7 +367,7 @@ class GetbibleModelPassword extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('password.delete', 'com_getbible.password.' . (int) $record->id); } @@ -378,7 +385,7 @@ class GetbibleModelPassword extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -393,7 +400,7 @@ class GetbibleModelPassword extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('password.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -403,18 +410,18 @@ class GetbibleModelPassword extends AdminModel * @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('password.edit', 'com_getbible.password.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('password.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -422,19 +429,19 @@ class GetbibleModelPassword 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(); @@ -446,7 +453,7 @@ class GetbibleModelPassword 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('#__getbible_password')); @@ -461,7 +468,7 @@ class GetbibleModelPassword extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -479,7 +486,7 @@ class GetbibleModelPassword extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.password.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.password.data', []); if (empty($data)) { @@ -502,7 +509,7 @@ class GetbibleModelPassword extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -518,7 +525,7 @@ class GetbibleModelPassword extends AdminModel { return false; } - + return true; } @@ -538,10 +545,10 @@ class GetbibleModelPassword extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -567,30 +574,30 @@ class GetbibleModelPassword 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 = GetbibleHelper::getActions('password'); - $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 = GetbibleHelper::getActions('password'); + $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); } @@ -627,8 +634,7 @@ class GetbibleModelPassword extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -654,7 +660,7 @@ class GetbibleModelPassword 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 = GetbibleHelper::getActions('password'); @@ -693,7 +699,7 @@ class GetbibleModelPassword extends AdminModel if (!$this->user->authorise('password.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; } @@ -709,7 +715,7 @@ class GetbibleModelPassword 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; } } @@ -797,7 +803,7 @@ class GetbibleModelPassword 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 = GetbibleHelper::getActions('password'); @@ -805,7 +811,7 @@ class GetbibleModelPassword extends AdminModel if (!$this->canDo->get('password.edit') && !$this->canDo->get('password.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -822,7 +828,7 @@ class GetbibleModelPassword extends AdminModel { if (!$this->user->authorise('password.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -838,7 +844,7 @@ class GetbibleModelPassword 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; } } @@ -888,7 +894,7 @@ class GetbibleModelPassword extends AdminModel return true; } - + /** * Method to save the form data. * @@ -900,15 +906,15 @@ class GetbibleModelPassword 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; } @@ -927,11 +933,11 @@ class GetbibleModelPassword extends AdminModel // must always be set $data['guid'] = (string) GuidHelper::get(); } - + // 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; } @@ -941,7 +947,7 @@ class GetbibleModelPassword extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -949,14 +955,14 @@ class GetbibleModelPassword extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -969,7 +975,6 @@ class GetbibleModelPassword extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/passwords.php b/admin/models/passwords.php index 2eadcbb..a45f9ed 100644 --- a/admin/models/passwords.php +++ b/admin/models/passwords.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Passwords List Model */ class GetbibleModelPasswords extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -58,7 +65,7 @@ class GetbibleModelPasswords 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')) @@ -108,7 +115,7 @@ class GetbibleModelPasswords extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -123,12 +130,12 @@ class GetbibleModelPasswords extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -142,11 +149,11 @@ class GetbibleModelPasswords extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * @@ -155,9 +162,9 @@ class GetbibleModelPasswords extends ListModel 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 @@ -263,7 +270,7 @@ class GetbibleModelPasswords extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -278,13 +285,13 @@ class GetbibleModelPasswords extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -306,13 +313,13 @@ class GetbibleModelPasswords extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -324,7 +331,7 @@ class GetbibleModelPasswords 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); diff --git a/admin/models/prompt.php b/admin/models/prompt.php index 0bfcf7b..ba79778 100644 --- a/admin/models/prompt.php +++ b/admin/models/prompt.php @@ -18,12 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Prompt Admin Model @@ -115,18 +122,18 @@ class GetbibleModelPrompt 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 = 'prompt', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'prompt', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -179,7 +186,7 @@ class GetbibleModelPrompt 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 +213,7 @@ class GetbibleModelPrompt 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 +226,7 @@ class GetbibleModelPrompt 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. @@ -717,7 +724,7 @@ class GetbibleModelPrompt extends AdminModel { return 'media/com_getbible/js/prompt.js'; } - + /** * Method to test whether a record can be deleted. * @@ -736,7 +743,7 @@ class GetbibleModelPrompt extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('prompt.delete', 'com_getbible.prompt.' . (int) $record->id); } @@ -754,7 +761,7 @@ class GetbibleModelPrompt extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -769,7 +776,7 @@ class GetbibleModelPrompt extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('prompt.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -779,18 +786,18 @@ class GetbibleModelPrompt extends AdminModel * @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('prompt.edit', 'com_getbible.prompt.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('prompt.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -798,19 +805,19 @@ class GetbibleModelPrompt 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(); @@ -822,7 +829,7 @@ class GetbibleModelPrompt 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('#__getbible_prompt')); @@ -837,7 +844,7 @@ class GetbibleModelPrompt extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -855,7 +862,7 @@ class GetbibleModelPrompt extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.prompt.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.prompt.data', []); if (empty($data)) { @@ -878,7 +885,7 @@ class GetbibleModelPrompt extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -894,7 +901,7 @@ class GetbibleModelPrompt extends AdminModel { return false; } - + return true; } @@ -914,10 +921,10 @@ class GetbibleModelPrompt extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -943,30 +950,30 @@ class GetbibleModelPrompt 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 = GetbibleHelper::getActions('prompt'); - $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 = GetbibleHelper::getActions('prompt'); + $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); } @@ -1003,8 +1010,7 @@ class GetbibleModelPrompt extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -1030,7 +1036,7 @@ class GetbibleModelPrompt 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 = GetbibleHelper::getActions('prompt'); @@ -1069,7 +1075,7 @@ class GetbibleModelPrompt extends AdminModel if (!$this->user->authorise('prompt.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; } @@ -1085,7 +1091,7 @@ class GetbibleModelPrompt 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; } } @@ -1173,7 +1179,7 @@ class GetbibleModelPrompt 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 = GetbibleHelper::getActions('prompt'); @@ -1181,7 +1187,7 @@ class GetbibleModelPrompt extends AdminModel if (!$this->canDo->get('prompt.edit') && !$this->canDo->get('prompt.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1198,7 +1204,7 @@ class GetbibleModelPrompt extends AdminModel { if (!$this->user->authorise('prompt.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1214,7 +1220,7 @@ class GetbibleModelPrompt 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; } } @@ -1264,7 +1270,7 @@ class GetbibleModelPrompt extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1276,15 +1282,15 @@ class GetbibleModelPrompt 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; } @@ -1314,16 +1320,16 @@ class GetbibleModelPrompt extends AdminModel // Also check permission since the value may be removed due to permissions // Then we do not want to clear it out, but simple ignore the empty messages elseif (!isset($data['messages']) - && JFactory::getUser()->authorise('prompt.edit.messages', 'com_getbible')) + && Factory::getUser()->authorise('prompt.edit.messages', 'com_getbible')) { // Set the empty messages to data $data['messages'] = ''; } - + // 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; } @@ -1333,7 +1339,7 @@ class GetbibleModelPrompt extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1341,14 +1347,14 @@ class GetbibleModelPrompt extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1361,7 +1367,6 @@ class GetbibleModelPrompt extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/prompts.php b/admin/models/prompts.php index 84776e3..270fd47 100644 --- a/admin/models/prompts.php +++ b/admin/models/prompts.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Prompts List Model */ class GetbibleModelPrompts extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -61,7 +68,7 @@ class GetbibleModelPrompts 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')) @@ -132,7 +139,7 @@ class GetbibleModelPrompts extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -147,12 +154,12 @@ class GetbibleModelPrompts extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -168,7 +175,7 @@ class GetbibleModelPrompts extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -181,7 +188,7 @@ class GetbibleModelPrompts extends ListModel } } - + // return items return $items; } @@ -202,7 +209,7 @@ class GetbibleModelPrompts extends ListModel 3 => 'COM_GETBIBLE_PROMPT_SELECTIONBASED' ); // Now check if value is found in this array - if (isset($integrationArray[$value]) && GetbibleHelper::checkString($integrationArray[$value])) + if (isset($integrationArray[$value]) && StringHelper::check($integrationArray[$value])) { return $integrationArray[$value]; } @@ -216,7 +223,7 @@ class GetbibleModelPrompts extends ListModel 2 => 'COM_GETBIBLE_PROMPT_ADVANCED_CACHING_VERSECONTEX' ); // Now check if value is found in this array - if (isset($cache_behaviourArray[$value]) && GetbibleHelper::checkString($cache_behaviourArray[$value])) + if (isset($cache_behaviourArray[$value]) && StringHelper::check($cache_behaviourArray[$value])) { return $cache_behaviourArray[$value]; } @@ -236,14 +243,14 @@ class GetbibleModelPrompts extends ListModel 'gpt-3.5-turbo-16k-0613' => 'COM_GETBIBLE_PROMPT_GPT35TURBO16K0613' ); // Now check if value is found in this array - if (isset($modelArray[$value]) && GetbibleHelper::checkString($modelArray[$value])) + if (isset($modelArray[$value]) && StringHelper::check($modelArray[$value])) { return $modelArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -252,9 +259,9 @@ class GetbibleModelPrompts extends ListModel 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 @@ -394,7 +401,7 @@ class GetbibleModelPrompts extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -409,13 +416,13 @@ class GetbibleModelPrompts extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -440,13 +447,13 @@ class GetbibleModelPrompts extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -458,7 +465,7 @@ class GetbibleModelPrompts 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); diff --git a/admin/models/rules/guid.php b/admin/models/rules/guid.php index 41b1d73..6d7886e 100644 --- a/admin/models/rules/guid.php +++ b/admin/models/rules/guid.php @@ -18,9 +18,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Guid) class for the Joomla Platform. diff --git a/admin/models/rules/int.php b/admin/models/rules/int.php index daac7f5..4a8a228 100644 --- a/admin/models/rules/int.php +++ b/admin/models/rules/int.php @@ -18,9 +18,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Int) class for the Joomla Platform. diff --git a/admin/models/rules/numbershyphens.php b/admin/models/rules/numbershyphens.php index fd20cce..d98d100 100644 --- a/admin/models/rules/numbershyphens.php +++ b/admin/models/rules/numbershyphens.php @@ -18,9 +18,12 @@ // No direct access to this file defined('JPATH_PLATFORM') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormRule; use Joomla\Registry\Registry; +use Joomla\CMS\HTML\HTMLHelper as Html; /** * Form Rule (Numbershyphens) class for the Joomla Platform. diff --git a/admin/models/tag.php b/admin/models/tag.php index 52a18df..8c1c873 100644 --- a/admin/models/tag.php +++ b/admin/models/tag.php @@ -18,12 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Tag Admin Model @@ -71,18 +78,18 @@ class GetbibleModelTag 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 = 'tag', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'tag', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -127,7 +134,7 @@ class GetbibleModelTag 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; @@ -154,7 +161,7 @@ class GetbibleModelTag 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')) @@ -167,7 +174,7 @@ class GetbibleModelTag 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. @@ -320,7 +327,7 @@ class GetbibleModelTag extends AdminModel { return 'media/com_getbible/js/tag.js'; } - + /** * Method to test whether a record can be deleted. * @@ -339,7 +346,7 @@ class GetbibleModelTag extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('tag.delete', 'com_getbible.tag.' . (int) $record->id); } @@ -357,7 +364,7 @@ class GetbibleModelTag extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -372,7 +379,7 @@ class GetbibleModelTag extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('tag.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -382,18 +389,18 @@ class GetbibleModelTag extends AdminModel * @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('tag.edit', 'com_getbible.tag.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('tag.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -401,19 +408,19 @@ class GetbibleModelTag 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(); @@ -425,7 +432,7 @@ class GetbibleModelTag 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('#__getbible_tag')); @@ -440,7 +447,7 @@ class GetbibleModelTag extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -458,7 +465,7 @@ class GetbibleModelTag extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.tag.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.tag.data', []); if (empty($data)) { @@ -481,7 +488,7 @@ class GetbibleModelTag extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -497,7 +504,7 @@ class GetbibleModelTag extends AdminModel { return false; } - + return true; } @@ -517,10 +524,10 @@ class GetbibleModelTag extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -546,30 +553,30 @@ class GetbibleModelTag 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 = GetbibleHelper::getActions('tag'); - $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 = GetbibleHelper::getActions('tag'); + $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); } @@ -606,8 +613,7 @@ class GetbibleModelTag extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -633,7 +639,7 @@ class GetbibleModelTag 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 = GetbibleHelper::getActions('tag'); @@ -672,7 +678,7 @@ class GetbibleModelTag extends AdminModel if (!$this->user->authorise('tag.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; } @@ -688,7 +694,7 @@ class GetbibleModelTag 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; } } @@ -776,7 +782,7 @@ class GetbibleModelTag 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 = GetbibleHelper::getActions('tag'); @@ -784,7 +790,7 @@ class GetbibleModelTag extends AdminModel if (!$this->canDo->get('tag.edit') && !$this->canDo->get('tag.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -801,7 +807,7 @@ class GetbibleModelTag extends AdminModel { if (!$this->user->authorise('tag.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -817,7 +823,7 @@ class GetbibleModelTag 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; } } @@ -867,7 +873,7 @@ class GetbibleModelTag extends AdminModel return true; } - + /** * Method to save the form data. * @@ -879,15 +885,15 @@ class GetbibleModelTag 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; } @@ -906,11 +912,11 @@ class GetbibleModelTag extends AdminModel // must always be set $data['guid'] = (string) GuidHelper::get(); } - + // 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; } @@ -920,7 +926,7 @@ class GetbibleModelTag extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -928,14 +934,14 @@ class GetbibleModelTag extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -948,7 +954,6 @@ class GetbibleModelTag extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/tagged_verse.php b/admin/models/tagged_verse.php index 12762a6..d894fa0 100644 --- a/admin/models/tagged_verse.php +++ b/admin/models/tagged_verse.php @@ -18,12 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Tagged_verse Admin Model @@ -74,18 +81,18 @@ class GetbibleModelTagged_verse 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 = 'tagged_verse', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'tagged_verse', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } - + /** * Method to get a single record. * @@ -130,7 +137,7 @@ class GetbibleModelTagged_verse 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; @@ -157,7 +164,7 @@ class GetbibleModelTagged_verse 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')) @@ -170,7 +177,7 @@ class GetbibleModelTagged_verse 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. @@ -374,7 +381,7 @@ class GetbibleModelTagged_verse extends AdminModel { return 'media/com_getbible/js/tagged_verse.js'; } - + /** * Method to test whether a record can be deleted. * @@ -393,7 +400,7 @@ class GetbibleModelTagged_verse extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('tagged_verse.delete', 'com_getbible.tagged_verse.' . (int) $record->id); } @@ -411,7 +418,7 @@ class GetbibleModelTagged_verse extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -426,7 +433,7 @@ class GetbibleModelTagged_verse extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('tagged_verse.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -436,18 +443,18 @@ class GetbibleModelTagged_verse extends AdminModel * @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('tagged_verse.edit', 'com_getbible.tagged_verse.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('tagged_verse.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -455,19 +462,19 @@ class GetbibleModelTagged_verse 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(); @@ -479,7 +486,7 @@ class GetbibleModelTagged_verse 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('#__getbible_tagged_verse')); @@ -494,7 +501,7 @@ class GetbibleModelTagged_verse extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -512,7 +519,7 @@ class GetbibleModelTagged_verse extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.tagged_verse.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.tagged_verse.data', []); if (empty($data)) { @@ -535,7 +542,7 @@ class GetbibleModelTagged_verse extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -551,7 +558,7 @@ class GetbibleModelTagged_verse extends AdminModel { return false; } - + return true; } @@ -571,10 +578,10 @@ class GetbibleModelTagged_verse extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -600,30 +607,30 @@ class GetbibleModelTagged_verse 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 = GetbibleHelper::getActions('tagged_verse'); - $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 = GetbibleHelper::getActions('tagged_verse'); + $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); } @@ -660,8 +667,7 @@ class GetbibleModelTagged_verse extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -687,7 +693,7 @@ class GetbibleModelTagged_verse 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 = GetbibleHelper::getActions('tagged_verse'); @@ -726,7 +732,7 @@ class GetbibleModelTagged_verse extends AdminModel if (!$this->user->authorise('tagged_verse.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; } @@ -742,7 +748,7 @@ class GetbibleModelTagged_verse 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; } } @@ -824,7 +830,7 @@ class GetbibleModelTagged_verse 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 = GetbibleHelper::getActions('tagged_verse'); @@ -832,7 +838,7 @@ class GetbibleModelTagged_verse extends AdminModel if (!$this->canDo->get('tagged_verse.edit') && !$this->canDo->get('tagged_verse.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -849,7 +855,7 @@ class GetbibleModelTagged_verse extends AdminModel { if (!$this->user->authorise('tagged_verse.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -865,7 +871,7 @@ class GetbibleModelTagged_verse 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; } } @@ -915,7 +921,7 @@ class GetbibleModelTagged_verse extends AdminModel return true; } - + /** * Method to save the form data. * @@ -927,15 +933,15 @@ class GetbibleModelTagged_verse 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; } @@ -954,11 +960,11 @@ class GetbibleModelTagged_verse extends AdminModel // must always be set $data['guid'] = (string) GuidHelper::get(); } - + // 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; } @@ -968,7 +974,7 @@ class GetbibleModelTagged_verse extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -976,14 +982,14 @@ class GetbibleModelTagged_verse extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -996,7 +1002,6 @@ class GetbibleModelTagged_verse extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/tagged_verses.php b/admin/models/tagged_verses.php index a99de09..6d56c7b 100644 --- a/admin/models/tagged_verses.php +++ b/admin/models/tagged_verses.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Tagged_verses List Model */ class GetbibleModelTagged_verses extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -62,7 +69,7 @@ class GetbibleModelTagged_verses 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')) @@ -140,7 +147,7 @@ class GetbibleModelTagged_verses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -155,12 +162,12 @@ class GetbibleModelTagged_verses extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -177,7 +184,7 @@ class GetbibleModelTagged_verses extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -186,7 +193,7 @@ class GetbibleModelTagged_verses extends ListModel } } - + // return items return $items; } @@ -206,14 +213,14 @@ class GetbibleModelTagged_verses extends ListModel 0 => 'COM_GETBIBLE_TAGGED_VERSE_PRIVATE' ); // Now check if value is found in this array - if (isset($accessArray[$value]) && GetbibleHelper::checkString($accessArray[$value])) + if (isset($accessArray[$value]) && StringHelper::check($accessArray[$value])) { return $accessArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -222,9 +229,9 @@ class GetbibleModelTagged_verses extends ListModel 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 @@ -502,7 +509,7 @@ class GetbibleModelTagged_verses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -520,25 +527,25 @@ class GetbibleModelTagged_verses extends ListModel $id .= ':' . $this->getState('filter.modified_by'); // Check if the value is an array $_book_nr = $this->getState('filter.book_nr'); - if (GetbibleHelper::checkArray($_book_nr)) + if (UtilitiesArrayHelper::check($_book_nr)) { $id .= ':' . implode(':', $_book_nr); } // Check if this is only an number or string elseif (is_numeric($_book_nr) - || GetbibleHelper::checkString($_book_nr)) + || StringHelper::check($_book_nr)) { $id .= ':' . $_book_nr; } // Check if the value is an array $_abbreviation = $this->getState('filter.abbreviation'); - if (GetbibleHelper::checkArray($_abbreviation)) + if (UtilitiesArrayHelper::check($_abbreviation)) { $id .= ':' . implode(':', $_abbreviation); } // Check if this is only an number or string elseif (is_numeric($_abbreviation) - || GetbibleHelper::checkString($_abbreviation)) + || StringHelper::check($_abbreviation)) { $id .= ':' . $_abbreviation; } @@ -546,25 +553,25 @@ class GetbibleModelTagged_verses extends ListModel $id .= ':' . $this->getState('filter.tag'); // Check if the value is an array $_verse = $this->getState('filter.verse'); - if (GetbibleHelper::checkArray($_verse)) + if (UtilitiesArrayHelper::check($_verse)) { $id .= ':' . implode(':', $_verse); } // Check if this is only an number or string elseif (is_numeric($_verse) - || GetbibleHelper::checkString($_verse)) + || StringHelper::check($_verse)) { $id .= ':' . $_verse; } // Check if the value is an array $_chapter = $this->getState('filter.chapter'); - if (GetbibleHelper::checkArray($_chapter)) + if (UtilitiesArrayHelper::check($_chapter)) { $id .= ':' . implode(':', $_chapter); } // Check if this is only an number or string elseif (is_numeric($_chapter) - || GetbibleHelper::checkString($_chapter)) + || StringHelper::check($_chapter)) { $id .= ':' . $_chapter; } @@ -581,13 +588,13 @@ class GetbibleModelTagged_verses extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -599,7 +606,7 @@ class GetbibleModelTagged_verses 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); diff --git a/admin/models/tags.php b/admin/models/tags.php index c607b79..bacd9ac 100644 --- a/admin/models/tags.php +++ b/admin/models/tags.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Tags List Model */ class GetbibleModelTags extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -58,7 +65,7 @@ class GetbibleModelTags 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')) @@ -108,7 +115,7 @@ class GetbibleModelTags extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -123,12 +130,12 @@ class GetbibleModelTags extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -144,7 +151,7 @@ class GetbibleModelTags extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -153,7 +160,7 @@ class GetbibleModelTags extends ListModel } } - + // return items return $items; } @@ -173,14 +180,14 @@ class GetbibleModelTags extends ListModel 0 => 'COM_GETBIBLE_TAG_PRIVATE' ); // Now check if value is found in this array - if (isset($accessArray[$value]) && GetbibleHelper::checkString($accessArray[$value])) + if (isset($accessArray[$value]) && StringHelper::check($accessArray[$value])) { return $accessArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -189,9 +196,9 @@ class GetbibleModelTags extends ListModel 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 @@ -284,7 +291,7 @@ class GetbibleModelTags extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -315,13 +322,13 @@ class GetbibleModelTags extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -333,7 +340,7 @@ class GetbibleModelTags 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); diff --git a/admin/models/translation.php b/admin/models/translation.php index 97c4391..cfa245f 100644 --- a/admin/models/translation.php +++ b/admin/models/translation.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Translation Admin Model @@ -84,18 +91,18 @@ class GetbibleModelTranslation 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 = 'translation', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'translation', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -148,7 +155,7 @@ class GetbibleModelTranslation 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; @@ -175,7 +182,7 @@ class GetbibleModelTranslation 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')) @@ -188,7 +195,7 @@ class GetbibleModelTranslation 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. @@ -549,7 +556,7 @@ class GetbibleModelTranslation extends AdminModel { return 'media/com_getbible/js/translation.js'; } - + /** * Method to test whether a record can be deleted. * @@ -568,7 +575,7 @@ class GetbibleModelTranslation extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('translation.delete', 'com_getbible.translation.' . (int) $record->id); } @@ -586,7 +593,7 @@ class GetbibleModelTranslation extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -601,7 +608,7 @@ class GetbibleModelTranslation extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('translation.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -611,18 +618,18 @@ class GetbibleModelTranslation extends AdminModel * @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('translation.edit', 'com_getbible.translation.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('translation.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -630,19 +637,19 @@ class GetbibleModelTranslation 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(); @@ -654,7 +661,7 @@ class GetbibleModelTranslation 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('#__getbible_translation')); @@ -669,7 +676,7 @@ class GetbibleModelTranslation extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -687,7 +694,7 @@ class GetbibleModelTranslation extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.translation.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.translation.data', []); if (empty($data)) { @@ -710,7 +717,7 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -726,7 +733,7 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + return true; } @@ -746,10 +753,10 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -775,30 +782,30 @@ class GetbibleModelTranslation 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 = GetbibleHelper::getActions('translation'); - $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 = GetbibleHelper::getActions('translation'); + $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); } @@ -835,8 +842,7 @@ class GetbibleModelTranslation extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -862,7 +868,7 @@ class GetbibleModelTranslation 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 = GetbibleHelper::getActions('translation'); @@ -901,7 +907,7 @@ class GetbibleModelTranslation extends AdminModel if (!$this->user->authorise('translation.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; } @@ -917,7 +923,7 @@ class GetbibleModelTranslation 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; } } @@ -1005,7 +1011,7 @@ class GetbibleModelTranslation 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 = GetbibleHelper::getActions('translation'); @@ -1013,7 +1019,7 @@ class GetbibleModelTranslation extends AdminModel if (!$this->canDo->get('translation.edit') && !$this->canDo->get('translation.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1030,7 +1036,7 @@ class GetbibleModelTranslation extends AdminModel { if (!$this->user->authorise('translation.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -1046,7 +1052,7 @@ class GetbibleModelTranslation 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; } } @@ -1096,7 +1102,7 @@ class GetbibleModelTranslation extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1108,15 +1114,15 @@ class GetbibleModelTranslation 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; } @@ -1131,16 +1137,16 @@ class GetbibleModelTranslation extends AdminModel // Also check permission since the value may be removed due to permissions // Then we do not want to clear it out, but simple ignore the empty distribution_history elseif (!isset($data['distribution_history']) - && JFactory::getUser()->authorise('translation.edit.distribution_history', 'com_getbible')) + && Factory::getUser()->authorise('translation.edit.distribution_history', 'com_getbible')) { // Set the empty distribution_history to data $data['distribution_history'] = ''; } - + // 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; } @@ -1150,7 +1156,7 @@ class GetbibleModelTranslation extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -1158,14 +1164,14 @@ class GetbibleModelTranslation extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1178,7 +1184,6 @@ class GetbibleModelTranslation extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/translations.php b/admin/models/translations.php index ae17540..5058003 100644 --- a/admin/models/translations.php +++ b/admin/models/translations.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Translations List Model */ class GetbibleModelTranslations extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -60,7 +67,7 @@ class GetbibleModelTranslations 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')) @@ -124,7 +131,7 @@ class GetbibleModelTranslations extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +146,12 @@ class GetbibleModelTranslations extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -160,7 +167,7 @@ class GetbibleModelTranslations extends ListModel } // set selection value to a translatable value - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -169,7 +176,7 @@ class GetbibleModelTranslations extends ListModel } } - + // return items return $items; } @@ -189,14 +196,14 @@ class GetbibleModelTranslations extends ListModel 'RTL' => 'COM_GETBIBLE_TRANSLATION_DEXTROSINISTRAL_RTL' ); // Now check if value is found in this array - if (isset($directionArray[$value]) && GetbibleHelper::checkString($directionArray[$value])) + if (isset($directionArray[$value]) && StringHelper::check($directionArray[$value])) { return $directionArray[$value]; } } return $value; } - + /** * Method to build an SQL query to load the list data. * @@ -205,9 +212,9 @@ class GetbibleModelTranslations extends ListModel 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 @@ -295,7 +302,7 @@ class GetbibleModelTranslations extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -310,13 +317,13 @@ class GetbibleModelTranslations extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -340,13 +347,13 @@ class GetbibleModelTranslations extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -358,7 +365,7 @@ class GetbibleModelTranslations 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); diff --git a/admin/models/verse.php b/admin/models/verse.php index 2061b02..16169b7 100644 --- a/admin/models/verse.php +++ b/admin/models/verse.php @@ -18,10 +18,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\Filter\InputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; +use Joomla\Filter\OutputFilter; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Verse Admin Model @@ -73,18 +80,18 @@ class GetbibleModelVerse 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 = 'verse', $prefix = 'GetbibleTable', $config = array()) + public function getTable($type = 'verse', $prefix = 'GetbibleTable', $config = []) { // add table path for when model gets used from other component $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_getbible/tables'); // get instance of the table - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); }###ADMIN_CUSTOM_BUTTONS_METHOD### - + /** * Method to get a single record. * @@ -129,7 +136,7 @@ class GetbibleModelVerse 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; @@ -156,7 +163,7 @@ class GetbibleModelVerse 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')) @@ -169,7 +176,7 @@ class GetbibleModelVerse 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. @@ -340,7 +347,7 @@ class GetbibleModelVerse extends AdminModel { return 'media/com_getbible/js/verse.js'; } - + /** * Method to test whether a record can be deleted. * @@ -359,7 +366,7 @@ class GetbibleModelVerse extends AdminModel return; } - $user = JFactory::getUser(); + $user = Factory::getUser(); // The record has been set. Check the record permissions. return $user->authorise('verse.delete', 'com_getbible.verse.' . (int) $record->id); } @@ -377,7 +384,7 @@ class GetbibleModelVerse extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $recordId = (!empty($record->id)) ? $record->id : 0; if ($recordId) @@ -392,7 +399,7 @@ class GetbibleModelVerse extends AdminModel // In the absence of better information, revert to the component permissions. return $user->authorise('verse.edit.state', 'com_getbible'); } - + /** * Method override to check if you can edit an existing record. * @@ -402,18 +409,18 @@ class GetbibleModelVerse extends AdminModel * @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('verse.edit', 'com_getbible.verse.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('verse.edit', 'com_getbible'); } - + /** * Prepare and sanitise the table data prior to saving. * - * @param JTable $table A JTable object. + * @param Table $table A Table object. * * @return void * @@ -421,19 +428,19 @@ class GetbibleModelVerse 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(); @@ -445,7 +452,7 @@ class GetbibleModelVerse 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('#__getbible_verse')); @@ -460,7 +467,7 @@ class GetbibleModelVerse extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -478,7 +485,7 @@ class GetbibleModelVerse extends AdminModel protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_getbible.edit.verse.data', array()); + $data = Factory::getApplication()->getUserState('com_getbible.edit.verse.data', []); if (empty($data)) { @@ -501,7 +508,7 @@ class GetbibleModelVerse extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -517,7 +524,7 @@ class GetbibleModelVerse extends AdminModel { return false; } - + return true; } @@ -537,10 +544,10 @@ class GetbibleModelVerse extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -566,30 +573,30 @@ class GetbibleModelVerse 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 = GetbibleHelper::getActions('verse'); - $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 = GetbibleHelper::getActions('verse'); + $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); } @@ -626,8 +633,7 @@ class GetbibleModelVerse extends AdminModel if (!$done) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - + $this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); return false; } @@ -653,7 +659,7 @@ class GetbibleModelVerse 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 = GetbibleHelper::getActions('verse'); @@ -692,7 +698,7 @@ class GetbibleModelVerse extends AdminModel if (!$this->user->authorise('verse.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; } @@ -708,7 +714,7 @@ class GetbibleModelVerse 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; } } @@ -796,7 +802,7 @@ class GetbibleModelVerse 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 = GetbibleHelper::getActions('verse'); @@ -804,7 +810,7 @@ class GetbibleModelVerse extends AdminModel if (!$this->canDo->get('verse.edit') && !$this->canDo->get('verse.batch')) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -821,7 +827,7 @@ class GetbibleModelVerse extends AdminModel { if (!$this->user->authorise('verse.edit', $contexts[$pk])) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } @@ -837,7 +843,7 @@ class GetbibleModelVerse 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; } } @@ -887,7 +893,7 @@ class GetbibleModelVerse extends AdminModel return true; } - + /** * Method to save the form data. * @@ -899,23 +905,23 @@ class GetbibleModelVerse 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; } @@ -925,7 +931,7 @@ class GetbibleModelVerse extends AdminModel { // Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (GetbibleHelper::checkArray($uniqueFields)) + if (UtilitiesArrayHelper::check($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -933,14 +939,14 @@ class GetbibleModelVerse extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -953,7 +959,6 @@ class GetbibleModelVerse extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); diff --git a/admin/models/verses.php b/admin/models/verses.php index 579b547..a540b66 100644 --- a/admin/models/verses.php +++ b/admin/models/verses.php @@ -18,15 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Verses List Model */ class GetbibleModelVerses extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) { @@ -60,7 +67,7 @@ class GetbibleModelVerses 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')) @@ -124,7 +131,7 @@ class GetbibleModelVerses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +146,12 @@ class GetbibleModelVerses extends ListModel $items = parent::getItems(); // Set values to display correctly. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { // Get the user object if not set. - if (!isset($user) || !GetbibleHelper::checkObject($user)) + if (!isset($user) || !ObjectHelper::check($user)) { - $user = JFactory::getUser(); + $user = Factory::getUser(); } foreach ($items as $nr => &$item) { @@ -158,11 +165,11 @@ class GetbibleModelVerses extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * @@ -171,9 +178,9 @@ class GetbibleModelVerses extends ListModel 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 @@ -322,7 +329,7 @@ class GetbibleModelVerses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -337,13 +344,13 @@ class GetbibleModelVerses extends ListModel $id .= ':' . $this->getState('filter.published'); // Check if the value is an array $_access = $this->getState('filter.access'); - if (GetbibleHelper::checkArray($_access)) + if (UtilitiesArrayHelper::check($_access)) { $id .= ':' . implode(':', $_access); } // Check if this is only an number or string elseif (is_numeric($_access) - || GetbibleHelper::checkString($_access)) + || StringHelper::check($_access)) { $id .= ':' . $_access; } @@ -367,13 +374,13 @@ class GetbibleModelVerses extends ListModel protected function checkInNow() { // Get set check in time - $time = JComponentHelper::getParams('com_getbible')->get('check_in'); + $time = ComponentHelper::getParams('com_getbible')->get('check_in'); if ($time) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Reset query. $query = $db->getQuery(true); $query->select('*'); @@ -385,7 +392,7 @@ class GetbibleModelVerses 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); diff --git a/admin/sql/updates/mysql/2.0.32.sql b/admin/sql/updates/mysql/2.0.32.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/2.0.32.sql @@ -0,0 +1 @@ + diff --git a/admin/tables/book.php b/admin/tables/book.php index 6a2e1f9..0e0b1eb 100644 --- a/admin/tables/book.php +++ b/admin/tables/book.php @@ -18,10 +18,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; /** * Books Table class @@ -51,14 +58,14 @@ class GetbibleTableBook extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTableBook extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTableBook extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTableBook extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('book', 'GetbibleTable'); + $table = Table::getInstance('book', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_BOOK_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_BOOK_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTableBook extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTableBook extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('book', 'getbibleTable'); + $table = Table::getInstance('book', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTableBook extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTableBook 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_getbible.book.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTableBook 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')) @@ -226,14 +233,14 @@ class GetbibleTableBook 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTableBook extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTableBook 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; @@ -268,7 +275,7 @@ class GetbibleTableBook extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTableBook extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/chapter.php b/admin/tables/chapter.php index 41a17bd..ae57058 100644 --- a/admin/tables/chapter.php +++ b/admin/tables/chapter.php @@ -18,10 +18,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; /** * Chapters Table class @@ -51,14 +58,14 @@ class GetbibleTableChapter extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTableChapter extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTableChapter extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTableChapter extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('chapter', 'GetbibleTable'); + $table = Table::getInstance('chapter', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_CHAPTER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_CHAPTER_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTableChapter extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTableChapter extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('chapter', 'getbibleTable'); + $table = Table::getInstance('chapter', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTableChapter extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTableChapter 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_getbible.chapter.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTableChapter 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')) @@ -226,14 +233,14 @@ class GetbibleTableChapter 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTableChapter extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTableChapter 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; @@ -268,7 +275,7 @@ class GetbibleTableChapter extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTableChapter extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/linker.php b/admin/tables/linker.php index d9e9b66..c6b4381 100644 --- a/admin/tables/linker.php +++ b/admin/tables/linker.php @@ -18,10 +18,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; /** * Linkers Table class @@ -51,14 +58,14 @@ class GetbibleTableLinker extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTableLinker extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTableLinker extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTableLinker extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('linker', 'GetbibleTable'); + $table = Table::getInstance('linker', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_LINKER_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_LINKER_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTableLinker extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTableLinker extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('linker', 'getbibleTable'); + $table = Table::getInstance('linker', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTableLinker extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTableLinker 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_getbible.linker.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTableLinker 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')) @@ -226,14 +233,14 @@ class GetbibleTableLinker 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTableLinker extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTableLinker 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; @@ -268,7 +275,7 @@ class GetbibleTableLinker extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTableLinker extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/note.php b/admin/tables/note.php index 45296be..e29ac7d 100644 --- a/admin/tables/note.php +++ b/admin/tables/note.php @@ -18,10 +18,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; /** * Notes Table class @@ -46,7 +53,7 @@ class GetbibleTableNote extends Table parent::__construct('#__getbible_note', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.note')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.note')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTableNote extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTableNote extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTableNote extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTableNote extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('note', 'GetbibleTable'); + $table = Table::getInstance('note', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_NOTE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_NOTE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTableNote extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTableNote extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('note', 'getbibleTable'); + $table = Table::getInstance('note', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTableNote extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTableNote 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_getbible.note.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTableNote 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')) @@ -229,14 +236,14 @@ class GetbibleTableNote 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTableNote extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTableNote 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; @@ -271,7 +278,7 @@ class GetbibleTableNote extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTableNote extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/open_ai_message.php b/admin/tables/open_ai_message.php index bfde711..6094fbf 100644 --- a/admin/tables/open_ai_message.php +++ b/admin/tables/open_ai_message.php @@ -18,10 +18,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; /** * Open_ai_messages Table class @@ -46,7 +53,7 @@ class GetbibleTableOpen_ai_message extends Table parent::__construct('#__getbible_open_ai_message', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.open_ai_message')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.open_ai_message')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTableOpen_ai_message extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTableOpen_ai_message extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTableOpen_ai_message extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTableOpen_ai_message extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('open_ai_message', 'GetbibleTable'); + $table = Table::getInstance('open_ai_message', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTableOpen_ai_message extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTableOpen_ai_message extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('open_ai_message', 'getbibleTable'); + $table = Table::getInstance('open_ai_message', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTableOpen_ai_message extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTableOpen_ai_message 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_getbible.open_ai_message.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTableOpen_ai_message 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')) @@ -229,14 +236,14 @@ class GetbibleTableOpen_ai_message 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTableOpen_ai_message extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTableOpen_ai_message 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; @@ -271,7 +278,7 @@ class GetbibleTableOpen_ai_message extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTableOpen_ai_message extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/open_ai_response.php b/admin/tables/open_ai_response.php index f4ec262..4c87c4e 100644 --- a/admin/tables/open_ai_response.php +++ b/admin/tables/open_ai_response.php @@ -18,10 +18,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; /** * Open_ai_responses Table class @@ -46,7 +53,7 @@ class GetbibleTableOpen_ai_response extends Table parent::__construct('#__getbible_open_ai_response', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.open_ai_response')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.open_ai_response')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTableOpen_ai_response extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTableOpen_ai_response extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTableOpen_ai_response extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTableOpen_ai_response extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('open_ai_response', 'GetbibleTable'); + $table = Table::getInstance('open_ai_response', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTableOpen_ai_response extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTableOpen_ai_response extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('open_ai_response', 'getbibleTable'); + $table = Table::getInstance('open_ai_response', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTableOpen_ai_response extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTableOpen_ai_response 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_getbible.open_ai_response.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTableOpen_ai_response 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')) @@ -229,14 +236,14 @@ class GetbibleTableOpen_ai_response 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTableOpen_ai_response extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTableOpen_ai_response 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; @@ -271,7 +278,7 @@ class GetbibleTableOpen_ai_response extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTableOpen_ai_response extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/password.php b/admin/tables/password.php index 1fe8aed..cc8cb45 100644 --- a/admin/tables/password.php +++ b/admin/tables/password.php @@ -18,10 +18,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; /** * Passwords Table class @@ -51,14 +58,14 @@ class GetbibleTablePassword extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTablePassword extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTablePassword extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTablePassword extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('password', 'GetbibleTable'); + $table = Table::getInstance('password', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_PASSWORD_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_PASSWORD_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTablePassword extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTablePassword extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('password', 'getbibleTable'); + $table = Table::getInstance('password', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTablePassword extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTablePassword 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_getbible.password.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTablePassword 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')) @@ -226,14 +233,14 @@ class GetbibleTablePassword 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTablePassword extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTablePassword 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; @@ -268,7 +275,7 @@ class GetbibleTablePassword extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTablePassword extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/prompt.php b/admin/tables/prompt.php index c1ee6ed..3f4bbdf 100644 --- a/admin/tables/prompt.php +++ b/admin/tables/prompt.php @@ -18,10 +18,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; /** * Prompts Table class @@ -46,7 +53,7 @@ class GetbibleTablePrompt extends Table parent::__construct('#__getbible_prompt', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.prompt')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.prompt')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTablePrompt extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTablePrompt extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTablePrompt extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTablePrompt extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('prompt', 'GetbibleTable'); + $table = Table::getInstance('prompt', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_PROMPT_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_PROMPT_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTablePrompt extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTablePrompt extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('prompt', 'getbibleTable'); + $table = Table::getInstance('prompt', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTablePrompt extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTablePrompt 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_getbible.prompt.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTablePrompt 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')) @@ -229,14 +236,14 @@ class GetbibleTablePrompt 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTablePrompt extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTablePrompt 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; @@ -271,7 +278,7 @@ class GetbibleTablePrompt extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTablePrompt extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/tag.php b/admin/tables/tag.php index 65617a0..7da97fd 100644 --- a/admin/tables/tag.php +++ b/admin/tables/tag.php @@ -18,10 +18,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; /** * Tags Table class @@ -46,7 +53,7 @@ class GetbibleTableTag extends Table parent::__construct('#__getbible_tag', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.tag')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.tag')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTableTag extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTableTag extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTableTag extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTableTag extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('tag', 'GetbibleTable'); + $table = Table::getInstance('tag', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_TAG_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_TAG_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTableTag extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTableTag extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('tag', 'getbibleTable'); + $table = Table::getInstance('tag', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTableTag extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTableTag 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_getbible.tag.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTableTag 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')) @@ -229,14 +236,14 @@ class GetbibleTableTag 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTableTag extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTableTag 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; @@ -271,7 +278,7 @@ class GetbibleTableTag extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTableTag extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/tagged_verse.php b/admin/tables/tagged_verse.php index 5208774..045626e 100644 --- a/admin/tables/tagged_verse.php +++ b/admin/tables/tagged_verse.php @@ -18,10 +18,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; /** * Tagged_verses Table class @@ -46,7 +53,7 @@ class GetbibleTableTagged_verse extends Table parent::__construct('#__getbible_tagged_verse', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.tagged_verse')); + TableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_getbible.tagged_verse')); } public function bind($array, $ignore = '') @@ -54,14 +61,14 @@ class GetbibleTableTagged_verse extends Table 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; } @@ -69,7 +76,7 @@ class GetbibleTableTagged_verse extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -84,8 +91,8 @@ class GetbibleTableTagged_verse extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -110,11 +117,11 @@ class GetbibleTableTagged_verse extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('tagged_verse', 'GetbibleTable'); + $table = Table::getInstance('tagged_verse', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_TAGGED_VERSE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_TAGGED_VERSE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -122,12 +129,12 @@ class GetbibleTableTagged_verse extends Table 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); @@ -145,7 +152,7 @@ class GetbibleTableTagged_verse extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('tagged_verse', 'getbibleTable'); + $table = Table::getInstance('tagged_verse', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -168,7 +175,7 @@ class GetbibleTableTagged_verse extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -191,7 +198,7 @@ class GetbibleTableTagged_verse 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_getbible.tagged_verse.'.$this->id); @@ -213,12 +220,12 @@ class GetbibleTableTagged_verse 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')) @@ -229,14 +236,14 @@ class GetbibleTableTagged_verse 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 Access::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])) { @@ -253,7 +260,7 @@ class GetbibleTableTagged_verse extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -261,8 +268,8 @@ class GetbibleTableTagged_verse 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; @@ -271,7 +278,7 @@ class GetbibleTableTagged_verse extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -309,9 +316,9 @@ class GetbibleTableTagged_verse extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/translation.php b/admin/tables/translation.php index 6113407..82d28fc 100644 --- a/admin/tables/translation.php +++ b/admin/tables/translation.php @@ -18,10 +18,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; /** * Translations Table class @@ -51,14 +58,14 @@ class GetbibleTableTranslation extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTableTranslation extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTableTranslation extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTableTranslation extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('translation', 'GetbibleTable'); + $table = Table::getInstance('translation', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_TRANSLATION_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_TRANSLATION_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTableTranslation extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTableTranslation extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('translation', 'getbibleTable'); + $table = Table::getInstance('translation', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTableTranslation extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTableTranslation 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_getbible.translation.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTableTranslation 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')) @@ -226,14 +233,14 @@ class GetbibleTableTranslation 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTableTranslation extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTableTranslation 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; @@ -268,7 +275,7 @@ class GetbibleTableTranslation extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTableTranslation extends Table * @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_getbible'); return $asset->id; diff --git a/admin/tables/verse.php b/admin/tables/verse.php index 5ca405b..7438e4d 100644 --- a/admin/tables/verse.php +++ b/admin/tables/verse.php @@ -18,10 +18,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; /** * Verses Table class @@ -51,14 +58,14 @@ class GetbibleTableVerse extends Table 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; } @@ -66,7 +73,7 @@ class GetbibleTableVerse extends Table // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) { - $rules = new JAccessRules($array['rules']); + $rules = new AccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); @@ -81,8 +88,8 @@ class GetbibleTableVerse extends Table */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { @@ -107,11 +114,11 @@ class GetbibleTableVerse extends Table if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('verse', 'GetbibleTable'); + $table = Table::getInstance('verse', 'GetbibleTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_GETBIBLE_VERSE_ERROR_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_GETBIBLE_VERSE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -119,12 +126,12 @@ class GetbibleTableVerse extends Table 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); @@ -142,7 +149,7 @@ class GetbibleTableVerse extends Table // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('verse', 'getbibleTable'); + $table = Table::getInstance('verse', 'getbibleTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -165,7 +172,7 @@ class GetbibleTableVerse extends Table // Create array using commas as delimiter. $keys = explode(',', $after_clean); - $clean_keys = array(); + $clean_keys = []; foreach ($keys as $key) { @@ -188,7 +195,7 @@ class GetbibleTableVerse 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_getbible.verse.'.$this->id); @@ -210,12 +217,12 @@ class GetbibleTableVerse 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')) @@ -226,14 +233,14 @@ class GetbibleTableVerse 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 Access::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])) { @@ -250,7 +257,7 @@ class GetbibleTableVerse extends Table else { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -258,8 +265,8 @@ class GetbibleTableVerse 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; @@ -268,7 +275,7 @@ class GetbibleTableVerse extends Table return $result; } } - return JAccess::getAssetRules(0); + return Access::getAssetRules(0); } /** @@ -306,9 +313,9 @@ class GetbibleTableVerse extends Table * @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_getbible'); return $asset->id; diff --git a/admin/views/book/tmpl/edit.php b/admin/views/book/tmpl/edit.php index 96da247..140a500 100644 --- a/admin/views/book/tmpl/edit.php +++ b/admin/views/book/tmpl/edit.php @@ -18,10 +18,16 @@ // 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/site/layouts/rows.php b/site/layouts/rows.php index dde2ad8..86a2359 100644 --- a/site/layouts/rows.php +++ b/site/layouts/rows.php @@ -18,6 +18,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; + $headers = $displayData['headers']; $items = $displayData['items']; diff --git a/site/layouts/select.php b/site/layouts/select.php index da509cd..28cc51e 100644 --- a/site/layouts/select.php +++ b/site/layouts/select.php @@ -18,6 +18,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; + $id = (isset($displayData['id'])) ? $displayData['id'] : ''; $name = (isset($displayData['name'])) ? $displayData['name'] : $id; $class = (isset($displayData['class'])) ? $displayData['class'] : 'uk-select'; @@ -47,6 +52,6 @@ $onkeydown = (isset($displayData['onkeydown'])) ? ' onkeydown="' . $displayData[ - + diff --git a/site/layouts/selectbox.php b/site/layouts/selectbox.php index b1620ad..53a0846 100644 --- a/site/layouts/selectbox.php +++ b/site/layouts/selectbox.php @@ -18,10 +18,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; + $id = (isset($displayData['id'])) ? $displayData['id'] : ''; $name = (isset($displayData['name'])) ? $displayData['name'] : $id; $name = str_replace('-', '_', $name); -$label = (isset($displayData['label'])) ? $displayData['label'] : JText::_('COM_GETBIBLE_LABEL'); +$label = (isset($displayData['label'])) ? $displayData['label'] : Text::_('COM_GETBIBLE_LABEL'); $margin = (isset($displayData['margin'])) ? $displayData['margin'] : 'uk-margin-small'; ?> diff --git a/site/layouts/table.php b/site/layouts/table.php index edbeb2a..bd838b0 100644 --- a/site/layouts/table.php +++ b/site/layouts/table.php @@ -17,12 +17,17 @@ // 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\StringHelper; $table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7); $name = (isset($displayData['name'])) ? $displayData['name'] : false; $table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table'; -$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [JText::_('COM_GETBIBLE_NO'), JText::_('COM_GETBIBLE_HEADERS'), JText::_('COM_GETBIBLE_FOUND')]; +$headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_GETBIBLE_NO'), Text::_('COM_GETBIBLE_HEADERS'), Text::_('COM_GETBIBLE_FOUND')]; $items = (isset($displayData['items'])) ? $displayData['items'] : 6; ?> diff --git a/site/layouts/textarea.php b/site/layouts/textarea.php index 1dd34f4..cbc3898 100644 --- a/site/layouts/textarea.php +++ b/site/layouts/textarea.php @@ -18,6 +18,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; + $id = (isset($displayData['id'])) ? $displayData['id'] : ''; $name = (isset($displayData['name'])) ? $displayData['name'] : $id; $name = str_replace('-', '_', $name); diff --git a/site/layouts/textareabox.php b/site/layouts/textareabox.php index 2f653ea..7bc7839 100644 --- a/site/layouts/textareabox.php +++ b/site/layouts/textareabox.php @@ -18,10 +18,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; + $id = (isset($displayData['id'])) ? $displayData['id'] : ''; $name = (isset($displayData['name'])) ? $displayData['name'] : $id; $name = str_replace('-', '_', $name); -$label = (isset($displayData['label'])) ? $displayData['label'] : JText::_('COM_GETBIBLE_LABEL'); +$label = (isset($displayData['label'])) ? $displayData['label'] : Text::_('COM_GETBIBLE_LABEL'); $margin = (isset($displayData['margin'])) ? $displayData['margin'] : 'uk-margin-small'; ?> diff --git a/site/models/ajax.php b/site/models/ajax.php index 7975e67..733faba 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -18,9 +18,13 @@ // 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\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\JsonHelper; use VDM\Joomla\Utilities\GuidHelper; @@ -35,7 +39,7 @@ class GetbibleModelAjax extends ListModel { parent::__construct(); // get params - $this->app_params = JComponentHelper::getParams('com_getbible'); + $this->app_params = ComponentHelper::getParams('com_getbible'); } @@ -59,12 +63,12 @@ class GetbibleModelAjax extends ListModel { $linker = trim($linker); // we check if this is a valid linker value - if (Factory::_('GetBible.Linker')->valid($linker)) + if (GetBibleFactory::_('GetBible.Linker')->valid($linker)) { return ['url' => trim(trim(JUri::base(), '/') . JRoute::_('index.php?option=com_getbible&view=app&translation=' . $translation . '&Itemid=' . $this->app_params->get('app_menu', 0) . '&book=' . $book . '&chapter=' . $chapter . '&Share_His_Word=' . $linker))]; } - return ['error' => JText::_('COM_GETBIBLE_THIS_SESSION_KEY_IS_NOT_YET_ELIGIBLE_FOR_SHARING_AS_NO_ACTIONS_HAVE_BEEN_PERFORMED_WITHIN_IT')]; + return ['error' => Text::_('COM_GETBIBLE_THIS_SESSION_KEY_IS_NOT_YET_ELIGIBLE_FOR_SHARING_AS_NO_ACTIONS_HAVE_BEEN_PERFORMED_WITHIN_IT')]; } /** @@ -82,16 +86,16 @@ class GetbibleModelAjax extends ListModel { $linker = trim($linker); // we check if this is a valid linker value - if (Factory::_('GetBible.Linker')->valid($linker) - && Factory::_('GetBible.Linker')->set($linker)) + if (GetBibleFactory::_('GetBible.Linker')->valid($linker) + && GetBibleFactory::_('GetBible.Linker')->set($linker)) { return [ - 'success' => JText::_('COM_GETBIBLE_YOU_HAVE_ENTERED_A_VALID_SESSION_KEY'), - 'old' => Factory::_('GetBible.Linker')->valid($oldLinker) + 'success' => Text::_('COM_GETBIBLE_YOU_HAVE_ENTERED_A_VALID_SESSION_KEY'), + 'old' => GetBibleFactory::_('GetBible.Linker')->valid($oldLinker) ]; } - return ['error' => JText::_('COM_GETBIBLE_THIS_IS_NOT_A_VALID_SESSION_KEY')]; + return ['error' => Text::_('COM_GETBIBLE_THIS_IS_NOT_A_VALID_SESSION_KEY')]; } /** @@ -110,7 +114,7 @@ class GetbibleModelAjax extends ListModel try { $_force = ($force == 1) ? true:false; - Factory::_('GetBible.Watcher')->sync($translation, $book, $chapter, $_force); + GetBibleFactory::_('GetBible.Watcher')->sync($translation, $book, $chapter, $_force); } catch(Exception $error) { @@ -118,8 +122,8 @@ class GetbibleModelAjax extends ListModel } return [ - 'success' => JText::sprintf('COM_GETBIBLE_THE_CHAPTERS_OF_BOOKS_WAS_SUCCESSFULLY_INSTALLED_FOR_S_TRANSLATION', $chapter, $book, $translation), - 'total' => Factory::_('GetBible.Watcher')->totalVerses($translation) + 'success' => Text::sprintf('COM_GETBIBLE_THE_CHAPTERS_OF_BOOKS_WAS_SUCCESSFULLY_INSTALLED_FOR_S_TRANSLATION', $chapter, $book, $translation), + 'total' => GetBibleFactory::_('GetBible.Watcher')->totalVerses($translation) ]; } @@ -153,12 +157,12 @@ class GetbibleModelAjax extends ListModel **/ public function setLinker(string $linker): array { - if (Factory::_('GetBible.Linker')->set(trim($linker))) + if (GetBibleFactory::_('GetBible.Linker')->set(trim($linker))) { - return ['success' => JText::_('COM_GETBIBLE_THE_SESSION_IS_SET')]; + return ['success' => Text::_('COM_GETBIBLE_THE_SESSION_IS_SET')]; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -172,12 +176,12 @@ class GetbibleModelAjax extends ListModel public function setLinkerName(string $name): array { $name = trim($name); - if (($result = Factory::_('GetBible.Linker')->setName($name)) !== null) + if (($result = GetBibleFactory::_('GetBible.Linker')->setName($name)) !== null) { return $result; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -190,12 +194,12 @@ class GetbibleModelAjax extends ListModel **/ public function isLinkerAuthenticated(string $linker): array { - if (($authenticated = Factory::_('GetBible.Linker')->authenticated(trim($linker))) !== null) + if (($authenticated = GetBibleFactory::_('GetBible.Linker')->authenticated(trim($linker))) !== null) { return $authenticated; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -210,12 +214,12 @@ class GetbibleModelAjax extends ListModel **/ public function setLinkerAccess(string $linker, string $pass, ?string $oldPass): array { - if (($access = Factory::_('GetBible.Linker')->access(trim($linker), $pass, $oldPass)) !== null) + if (($access = GetBibleFactory::_('GetBible.Linker')->access(trim($linker), $pass, $oldPass)) !== null) { return $access; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -228,12 +232,12 @@ class GetbibleModelAjax extends ListModel **/ public function revokeLinkerAccess(string $linker): array { - if (($revoked = Factory::_('GetBible.Linker')->revoke(trim($linker))) !== null) + if (($revoked = GetBibleFactory::_('GetBible.Linker')->revoke(trim($linker))) !== null) { return $revoked; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -246,12 +250,12 @@ class GetbibleModelAjax extends ListModel **/ public function revokeLinkerSession(string $linker): array { - if (($revoked = Factory::_('GetBible.Linker')->revokeSession(trim($linker))) !== null) + if (($revoked = GetBibleFactory::_('GetBible.Linker')->revokeSession(trim($linker))) !== null) { return $revoked; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -265,12 +269,12 @@ class GetbibleModelAjax extends ListModel **/ public function createTag(string $name, ?string $description): array { - if (($tag = Factory::_('GetBible.Tag')->create($name, $description)) !== null) + if (($tag = GetBibleFactory::_('GetBible.Tag')->create($name, $description)) !== null) { return $tag; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; } /** @@ -285,12 +289,12 @@ class GetbibleModelAjax extends ListModel **/ public function updateTag(string $tag, string $name, ?string $description): array { - if (($tag = Factory::_('GetBible.Tag')->update($tag, $name, $description)) !== null) + if (($tag = GetBibleFactory::_('GetBible.Tag')->update($tag, $name, $description)) !== null) { return $tag; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; } /** @@ -303,12 +307,12 @@ class GetbibleModelAjax extends ListModel **/ public function deleteTag(string $tag): array { - if (($result = Factory::_('GetBible.Tag')->delete($tag)) !== null) + if (($result = GetBibleFactory::_('GetBible.Tag')->delete($tag)) !== null) { return $result; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; } /** @@ -329,7 +333,7 @@ class GetbibleModelAjax extends ListModel ?string $note ): array { - if (($note = Factory::_('GetBible.Note')->set( + if (($note = GetBibleFactory::_('GetBible.Note')->set( $book, $chapter, $verse, @@ -339,7 +343,7 @@ class GetbibleModelAjax extends ListModel return $note; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -362,7 +366,7 @@ class GetbibleModelAjax extends ListModel string $tag ): array { - if (($tag = Factory::_('GetBible.Tagged')->set( + if (($tag = GetBibleFactory::_('GetBible.Tagged')->set( $translation, $book, $chapter, @@ -373,7 +377,7 @@ class GetbibleModelAjax extends ListModel return $tag; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR_PLEASE_TRY_AGAIN')]; } /** @@ -386,12 +390,12 @@ class GetbibleModelAjax extends ListModel **/ public function removeTagFromVerse(string $tag): array { - if (($_tag = Factory::_('GetBible.Tagged')->delete($tag)) !== null) + if (($_tag = GetBibleFactory::_('GetBible.Tagged')->delete($tag)) !== null) { return $_tag; } - return ['error' => JText::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; + return ['error' => Text::_('COM_GETBIBLE_THERE_HAS_BEEN_AN_ERROR')]; } /** diff --git a/site/models/api.php b/site/models/api.php index 0a5fd9f..d6eefa0 100644 --- a/site/models/api.php +++ b/site/models/api.php @@ -18,8 +18,13 @@ // 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\ArrayHelper as UtilitiesArrayHelper; /** * Getbible List Model for Api @@ -48,19 +53,19 @@ class GetbibleModelApi 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); @@ -86,15 +91,15 @@ class GetbibleModelApi 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_getbible', true); + $globalParams = ComponentHelper::getParams('com_getbible', true); // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { diff --git a/site/models/app.php b/site/models/app.php index 55ce95c..43b110f 100644 --- a/site/models/app.php +++ b/site/models/app.php @@ -18,10 +18,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\MVC\Model\ItemModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; use Joomla\Utilities\ArrayHelper; -use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; use VDM\Joomla\Utilities\Component\Helper; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible App Item Model @@ -65,7 +73,7 @@ class GetbibleModelApp 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); @@ -86,7 +94,7 @@ class GetbibleModelApp extends ItemModel */ public function getItem($pk = null) { - $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'); @@ -98,9 +106,9 @@ class GetbibleModelApp extends ItemModel // we add a Share_His_Word option to set the session key if (($linker = $this->input->getString('Share_His_Word', null)) !== null - && Factory::_('GetBible.Linker')->valid($linker)) + && GetBibleFactory::_('GetBible.Linker')->valid($linker)) { - Factory::_('GetBible.Linker')->trigger($linker); + GetBibleFactory::_('GetBible.Linker')->trigger($linker); } // we get all the Scripture Details @@ -113,19 +121,19 @@ class GetbibleModelApp extends ItemModel // set daily verse (STUFF) if (empty($this->book) && ($ref = $this->input->getString('ref')) !== null) { - Factory::_('DailyScripture')->load($ref); + GetBibleFactory::_('DailyScripture')->load($ref); } else { - Factory::_('DailyScripture')->setActive($this->book, $this->chapter, $this->verses); + GetBibleFactory::_('DailyScripture')->setActive($this->book, $this->chapter, $this->verses); } // load Daily Scripture if no book value was found if (empty($this->book)) { - $this->book = Factory::_('DailyScripture')->book(); - $this->chapter = $this->chapter ?? Factory::_('DailyScripture')->chapter(); - $this->verses = $this->verses?? Factory::_('DailyScripture')->verses(); + $this->book = GetBibleFactory::_('DailyScripture')->book(); + $this->chapter = $this->chapter ?? GetBibleFactory::_('DailyScripture')->chapter(); + $this->verses = $this->verses?? GetBibleFactory::_('DailyScripture')->verses(); } // if we still have nothing... were done here! @@ -139,10 +147,10 @@ class GetbibleModelApp extends ItemModel { $this->chapter = 1; } - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; } if (!isset($this->_item[$pk])) @@ -150,21 +158,21 @@ class GetbibleModelApp extends ItemModel try { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); // Get data // we load the queried chapter - if (!Factory::_('GetBible.Watcher')->sync($this->translation, $this->book, $this->chapter)) + if (!GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $this->book, $this->chapter)) { - $book = Factory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book); + $book = GetBibleFactory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book); $this->chapter = 1; $this->verses = null; // so we try to load this one last time - if (empty($book) || !Factory::_('GetBible.Watcher')->sync($this->translation, $book, $this->chapter)) + if (empty($book) || !GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $book, $this->chapter)) { return false; } @@ -173,13 +181,13 @@ class GetbibleModelApp extends ItemModel $this->book = $book; // since we could not find the book we where looking for, we redirect to what we found - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // get the book name $name = $this->getBookName($this->book, $this->translation) ?? $book; // we state this obvious result to the user - $app->enqueueMessage(JText::sprintf("COM_GETBIBLE_WERE_SORRY_THE_TRANSLATION_YOU_SELECTED_DOES_NOT_INCLUDE_THE_BOOK_YOU_WERE_IN_PREVIOUSLY_HOWEVER_WE_HAVE_LOCATED_BSB_WHICH_MIGHT_BE_OF_INTEREST_TO_YOU", $name), 'warning'); + $app->enqueueMessage(Text::sprintf("COM_GETBIBLE_WERE_SORRY_THE_TRANSLATION_YOU_SELECTED_DOES_NOT_INCLUDE_THE_BOOK_YOU_WERE_IN_PREVIOUSLY_HOWEVER_WE_HAVE_LOCATED_BSB_WHICH_MIGHT_BE_OF_INTEREST_TO_YOU", $name), 'warning'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app&t=' . $this->translation . '&ref=' . $name)); @@ -187,15 +195,15 @@ class GetbibleModelApp extends ItemModel } // [or] we load the next chapter - if (($chapter_next = Factory::_('GetBible.Watcher')->getNextChapter($this->translation, $this->book, $this->chapter)) !== null) + if (($chapter_next = GetBibleFactory::_('GetBible.Watcher')->getNextChapter($this->translation, $this->book, $this->chapter)) !== null) { - Factory::_('GetBible.Watcher')->sync($this->translation, $this->book, $chapter_next); + GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $this->book, $chapter_next); } // [or] we load the previous chapter - if (($chapter_previous = Factory::_('GetBible.Watcher')->getPreviousChapter($this->chapter)) !== null) + if (($chapter_previous = GetBibleFactory::_('GetBible.Watcher')->getPreviousChapter($this->chapter)) !== null) { - Factory::_('GetBible.Watcher')->sync($this->translation, $this->book, $chapter_previous); + GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $this->book, $chapter_previous); } $data = (object) [ @@ -203,15 +211,15 @@ class GetbibleModelApp extends ItemModel 'book' => $this->book, 'chapter' => $this->chapter, 'verses' => $this->verses, - 'daily' => Factory::_('DailyScripture')->isDaily() + 'daily' => GetBibleFactory::_('DailyScripture')->isDaily() ]; 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_GETBIBLE_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); - $app->redirect(JURI::root()); + $app->enqueueMessage(Text::_('COM_GETBIBLE_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); + $app->redirect(Uri::root()); return false; } @@ -223,7 +231,7 @@ class GetbibleModelApp 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 { @@ -247,7 +255,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -256,7 +264,7 @@ class GetbibleModelApp extends ItemModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -280,7 +288,7 @@ class GetbibleModelApp extends ItemModel $query->join('LEFT', ($db->quoteName('#__getbible_book', 'c')) . ' ON (' . $db->quoteName('a.book_nr') . ' = ' . $db->quoteName('c.nr') . ')'); // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -294,7 +302,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->chapter is a string or numeric value. $checkValue = $this->chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -308,7 +316,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -322,7 +330,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('c.abbreviation = ' . $db->quote($checkValue)); } @@ -371,7 +379,7 @@ class GetbibleModelApp extends ItemModel public function getChapterChapterVerseAadf_V($chapter) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -384,7 +392,7 @@ class GetbibleModelApp extends ItemModel $query->where('v.chapter = ' . $db->quote($chapter)); // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('v.book_nr = ' . $db->quote($checkValue)); } @@ -398,7 +406,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('v.abbreviation = ' . $db->quote($checkValue)); } @@ -419,15 +427,15 @@ class GetbibleModelApp extends ItemModel if ($db->getNumRows()) { // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JFactory::getApplication(); + PluginHelper::importPlugin('content'); + $this->_dispatcher = Factory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. foreach ($items as $nr => &$item) { // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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 text $_text = new stdClass(); $_text->text =& $item->text; // value must be in text @@ -451,7 +459,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -463,7 +471,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -489,11 +497,11 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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 @@ -515,7 +523,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -527,7 +535,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -539,7 +547,7 @@ class GetbibleModelApp extends ItemModel $query->from($db->quoteName('#__getbible_book', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -563,7 +571,7 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -586,7 +594,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -598,7 +606,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -616,7 +624,7 @@ class GetbibleModelApp extends ItemModel $query->join('LEFT', ($db->quoteName('#__getbible_book', 'b')) . ' ON (' . $db->quoteName('a.book_nr') . ' = ' . $db->quoteName('b.nr') . ')'); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -630,7 +638,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -644,7 +652,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('b.abbreviation = ' . $db->quote($checkValue)); } @@ -670,7 +678,7 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -693,7 +701,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -705,19 +713,19 @@ class GetbibleModelApp extends ItemModel $book = $this->book; // get the next chapter - if (($chapter = Factory::_('GetBible.Watcher')->getNextChapter($this->translation, $this->book, $this->chapter, true)) === null) + if (($chapter = GetBibleFactory::_('GetBible.Watcher')->getNextChapter($this->translation, $this->book, $this->chapter, true)) === null) { - $book = Factory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book); + $book = GetBibleFactory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book); $chapter = 1; // make sure its loaded - if (empty($book) || !Factory::_('GetBible.Watcher')->sync($this->translation, $book, $chapter)) + if (empty($book) || !GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $book, $chapter)) { return false; } } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -735,7 +743,7 @@ class GetbibleModelApp extends ItemModel $query->join('LEFT', ($db->quoteName('#__getbible_book', 'b')) . ' ON (' . $db->quoteName('a.book_nr') . ' = ' . $db->quoteName('b.nr') . ')'); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -749,7 +757,7 @@ class GetbibleModelApp extends ItemModel } // Check if $book is a string or numeric value. $checkValue = $book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -763,7 +771,7 @@ class GetbibleModelApp extends ItemModel } // Check if $chapter is a string or numeric value. $checkValue = $chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -777,7 +785,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('b.abbreviation = ' . $db->quote($checkValue)); } @@ -815,7 +823,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -827,20 +835,20 @@ class GetbibleModelApp extends ItemModel $book = $this->book; // get the next chapter - if (($chapter = Factory::_('GetBible.Watcher')->getPreviousChapter($this->chapter, true)) === null) + if (($chapter = GetBibleFactory::_('GetBible.Watcher')->getPreviousChapter($this->chapter, true)) === null) { - $book = Factory::_('GetBible.Watcher')->getPreviousBook($this->translation, $this->book); + $book = GetBibleFactory::_('GetBible.Watcher')->getPreviousBook($this->translation, $this->book); // make sure its loaded - if (empty($book) || !Factory::_('GetBible.Watcher')->sync($this->translation, $book, 1)) + if (empty($book) || !GetBibleFactory::_('GetBible.Watcher')->sync($this->translation, $book, 1)) { return false; } - $chapter = Factory::_('GetBible.Watcher')->getLastChapter($this->translation, $book); + $chapter = GetBibleFactory::_('GetBible.Watcher')->getLastChapter($this->translation, $book); } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -858,7 +866,7 @@ class GetbibleModelApp extends ItemModel $query->join('LEFT', ($db->quoteName('#__getbible_book', 'b')) . ' ON (' . $db->quoteName('a.book_nr') . ' = ' . $db->quoteName('b.nr') . ')'); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -872,7 +880,7 @@ class GetbibleModelApp extends ItemModel } // Check if $book is a string or numeric value. $checkValue = $book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -886,7 +894,7 @@ class GetbibleModelApp extends ItemModel } // Check if $chapter is a string or numeric value. $checkValue = $chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -900,7 +908,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('b.abbreviation = ' . $db->quote($checkValue)); } @@ -938,7 +946,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -947,7 +955,7 @@ class GetbibleModelApp extends ItemModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -959,7 +967,7 @@ class GetbibleModelApp extends ItemModel $query->from($db->quoteName('#__getbible_translation', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -982,16 +990,16 @@ class GetbibleModelApp extends ItemModel 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 distribution_history - if (isset($data->distribution_history) && GetbibleHelper::checkJson($data->distribution_history)) + if (isset($data->distribution_history) && JsonHelper::check($data->distribution_history)) { // Decode distribution_history $data->distribution_history = json_decode($data->distribution_history, true); } // Check if item has params, or pass whole item. - $params = (isset($data->params) && GetbibleHelper::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 distribution_about $_distribution_about = new stdClass(); $_distribution_about->text =& $data->distribution_about; // value must be in text @@ -1018,7 +1026,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1030,7 +1038,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1042,7 +1050,7 @@ class GetbibleModelApp extends ItemModel $query->from($db->quoteName('#__getbible_note', 'a')); // Check if $this->chapter is a string or numeric value. $checkValue = $this->chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -1056,7 +1064,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -1083,17 +1091,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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 note $_note = new stdClass(); $_note->text =& $item->note; // value must be in text @@ -1116,7 +1124,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1128,7 +1136,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1138,9 +1146,9 @@ class GetbibleModelApp extends ItemModel array('a.id','a.verse','a.book_nr','a.chapter','a.note','a.linker','a.guid'), array('id','verse','book_nr','chapter','note','linker','guid'))); $query->from($db->quoteName('#__getbible_note', 'a')); - // Check if Factory::_('GetBible.Linker')->active(true) is a string or numeric value. - $checkValue = Factory::_('GetBible.Linker')->active(true); - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + // Check if GetBibleFactory::_('GetBible.Linker')->active(true) is a string or numeric value. + $checkValue = GetBibleFactory::_('GetBible.Linker')->active(true); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.linker = ' . $db->quote($checkValue)); } @@ -1154,7 +1162,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -1168,7 +1176,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->chapter is a string or numeric value. $checkValue = $this->chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -1195,17 +1203,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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 note $_note = new stdClass(); $_note->text =& $item->note; // value must be in text @@ -1228,7 +1236,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1240,7 +1248,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1265,17 +1273,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -1298,7 +1306,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1310,7 +1318,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1328,7 +1336,7 @@ class GetbibleModelApp extends ItemModel $query->join('LEFT', ($db->quoteName('#__getbible_tag', 't')) . ' ON (' . $db->quoteName('a.tag') . ' = ' . $db->quoteName('t.guid') . ')'); // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -1342,7 +1350,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->chapter is a string or numeric value. $checkValue = $this->chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -1371,17 +1379,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -1404,7 +1412,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1416,7 +1424,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1428,7 +1436,7 @@ class GetbibleModelApp extends ItemModel $query->from($db->quoteName('#__getbible_prompt', 'a')); // Check if ($globalParams->get('enable_open_ai') == 1) ? ($this->translation ? [$db->quote('all'), $db->quote($this->translation)] : [$db->quote('all')]) : null is an array with values. $array = ($globalParams->get('enable_open_ai') == 1) ? ($this->translation ? [$db->quote('all'), $db->quote($this->translation)] : [$db->quote('all')]) : null; - if (isset($array) && GetbibleHelper::checkArray($array)) + if (isset($array) && UtilitiesArrayHelper::check($array)) { $query->where('a.abbreviation IN (' . implode(',', $array) . ')'); } @@ -1450,7 +1458,7 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -1473,7 +1481,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1485,7 +1493,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1507,9 +1515,9 @@ class GetbibleModelApp extends ItemModel array('t.guid'), array('tag'))); $query->join('LEFT', ($db->quoteName('#__getbible_tag', 't')) . ' ON (' . $db->quoteName('a.tag') . ' = ' . $db->quoteName('t.guid') . ')'); - // Check if Factory::_('GetBible.Linker')->active(true) is a string or numeric value. - $checkValue = Factory::_('GetBible.Linker')->active(true); - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + // Check if GetBibleFactory::_('GetBible.Linker')->active(true) is a string or numeric value. + $checkValue = GetBibleFactory::_('GetBible.Linker')->active(true); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.linker = ' . $db->quote($checkValue)); } @@ -1523,7 +1531,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->book is a string or numeric value. $checkValue = $this->book; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.book_nr = ' . $db->quote($checkValue)); } @@ -1537,7 +1545,7 @@ class GetbibleModelApp extends ItemModel } // Check if $this->chapter is a string or numeric value. $checkValue = $this->chapter; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.chapter = ' . $db->quote($checkValue)); } @@ -1569,17 +1577,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -1602,7 +1610,7 @@ class GetbibleModelApp extends ItemModel 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'); @@ -1614,7 +1622,7 @@ class GetbibleModelApp extends ItemModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1624,9 +1632,9 @@ class GetbibleModelApp extends ItemModel array('a.id','a.linker','a.name','a.description','a.published','a.guid'), array('id','linker','name','description','published','guid'))); $query->from($db->quoteName('#__getbible_tag', 'a')); - // Check if Factory::_('GetBible.Linker')->active(true) is a string or numeric value. - $checkValue = Factory::_('GetBible.Linker')->active(true); - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + // Check if GetBibleFactory::_('GetBible.Linker')->active(true) is a string or numeric value. + $checkValue = GetBibleFactory::_('GetBible.Linker')->active(true); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.linker = ' . $db->quote($checkValue)); } @@ -1651,17 +1659,17 @@ class GetbibleModelApp extends ItemModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -1683,7 +1691,7 @@ class GetbibleModelApp extends ItemModel protected function getBookName(int $book, string $translation): ?string { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -1762,7 +1770,7 @@ class GetbibleModelApp extends ItemModel */ protected function splitSentence(string $text): array { - return Factory::_('GetBible.Utilities.String')->split($text); + return GetBibleFactory::_('GetBible.Utilities.String')->split($text); } /** @@ -1774,6 +1782,6 @@ class GetbibleModelApp extends ItemModel */ protected function hasLength(string $word): bool { - return Factory::_('GetBible.Utilities.String')->hasLength($word); + return GetBibleFactory::_('GetBible.Utilities.String')->hasLength($word); } } diff --git a/site/models/openai.php b/site/models/openai.php index 443132f..de4778a 100644 --- a/site/models/openai.php +++ b/site/models/openai.php @@ -18,11 +18,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\MVC\Model\ItemModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\Component\Helper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\GetBible\Openai; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; /** * Getbible Openai Item Model @@ -66,7 +73,7 @@ class GetbibleModelOpenai 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); @@ -87,7 +94,7 @@ class GetbibleModelOpenai extends ItemModel */ public function getItem($pk = null) { - $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'); @@ -106,7 +113,7 @@ class GetbibleModelOpenai extends ItemModel // only continue if openai is activated if (Helper::getParams('com_getbible')->get('enable_open_ai') != 1) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('The Open AI feature has not been activated. Please contact the system administrator of this website to resolve this.', 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); @@ -115,7 +122,7 @@ class GetbibleModelOpenai extends ItemModel // validate that we have a valid prompt and we have a book, chapter and verse elseif (empty($this->book) || empty($this->chapter) || empty($this->verse) || empty($this->guid) || ($abbreviation = GuidHelper::item($this->guid, 'prompt', 'a.abbreviation', 'getbible')) === null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('There has been an error!', 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); @@ -124,16 +131,16 @@ class GetbibleModelOpenai extends ItemModel // validate that we have the correct translation elseif ($abbreviation !== 'all' && $abbreviation !== $this->translation) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('There has been an error: mismatch!', 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); return false; } - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; } if (!isset($this->_item[$pk])) @@ -141,7 +148,7 @@ class GetbibleModelOpenai extends ItemModel try { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -153,7 +160,7 @@ class GetbibleModelOpenai extends ItemModel } catch (DomainException $e) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage($e->getMessage(), 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); @@ -161,7 +168,7 @@ class GetbibleModelOpenai extends ItemModel } catch (InvalidArgumentException $e) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage($e->getMessage(), 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); @@ -169,7 +176,7 @@ class GetbibleModelOpenai extends ItemModel } catch (Exception $e) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage($e->getMessage(), 'error'); $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); @@ -178,10 +185,10 @@ class GetbibleModelOpenai 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_GETBIBLE_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); - $app->redirect(JRoute::_('index.php?option=com_getbible&view=app')); + $app->enqueueMessage(Text::_('COM_GETBIBLE_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); + $app->redirect(Route::_('index.php?option=com_getbible&view=app')); return false; } @@ -193,7 +200,7 @@ class GetbibleModelOpenai 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 { @@ -217,7 +224,7 @@ class GetbibleModelOpenai extends ItemModel 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'); @@ -226,7 +233,7 @@ class GetbibleModelOpenai extends ItemModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -238,7 +245,7 @@ class GetbibleModelOpenai extends ItemModel $query->from($db->quoteName('#__getbible_translation', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -261,16 +268,16 @@ class GetbibleModelOpenai extends ItemModel 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 distribution_history - if (isset($data->distribution_history) && GetbibleHelper::checkJson($data->distribution_history)) + if (isset($data->distribution_history) && JsonHelper::check($data->distribution_history)) { // Decode distribution_history $data->distribution_history = json_decode($data->distribution_history, true); } // Check if item has params, or pass whole item. - $params = (isset($data->params) && GetbibleHelper::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 distribution_about $_distribution_about = new stdClass(); $_distribution_about->text =& $data->distribution_about; // value must be in text diff --git a/site/models/search.php b/site/models/search.php index 947fc90..8d01b1e 100644 --- a/site/models/search.php +++ b/site/models/search.php @@ -18,11 +18,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\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\Component\Helper; use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; -use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; /** * Getbible List Model for Search @@ -51,19 +57,19 @@ class GetbibleModelSearch 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); @@ -159,7 +165,7 @@ class GetbibleModelSearch 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'); @@ -171,7 +177,7 @@ class GetbibleModelSearch extends ListModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -197,7 +203,7 @@ class GetbibleModelSearch extends ListModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -220,7 +226,7 @@ class GetbibleModelSearch 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'); @@ -232,7 +238,7 @@ class GetbibleModelSearch extends ListModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -244,7 +250,7 @@ class GetbibleModelSearch extends ListModel $query->from($db->quoteName('#__getbible_book', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -268,7 +274,7 @@ class GetbibleModelSearch extends ListModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::checkArray($items)) + if (UtilitiesArrayHelper::check($items)) { foreach ($items as $nr => &$item) { @@ -291,7 +297,7 @@ class GetbibleModelSearch 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'); @@ -300,7 +306,7 @@ class GetbibleModelSearch extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -312,7 +318,7 @@ class GetbibleModelSearch extends ListModel $query->from($db->quoteName('#__getbible_translation', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -335,16 +341,16 @@ class GetbibleModelSearch extends ListModel 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 distribution_history - if (isset($data->distribution_history) && GetbibleHelper::checkJson($data->distribution_history)) + if (isset($data->distribution_history) && JsonHelper::check($data->distribution_history)) { // Decode distribution_history $data->distribution_history = json_decode($data->distribution_history, true); } // Check if item has params, or pass whole item. - $params = (isset($data->params) && GetbibleHelper::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 distribution_about $_distribution_about = new stdClass(); $_distribution_about->text =& $data->distribution_about; // value must be in text @@ -644,7 +650,7 @@ class GetbibleModelSearch extends ListModel */ protected function splitSentence(string $text): array { - return Factory::_('GetBible.Utilities.String')->split($text); + return GetBibleFactory::_('GetBible.Utilities.String')->split($text); } /** @@ -656,6 +662,6 @@ class GetbibleModelSearch extends ListModel */ protected function hasLength(string $word): bool { - return Factory::_('GetBible.Utilities.String')->hasLength($word); + return GetBibleFactory::_('GetBible.Utilities.String')->hasLength($word); } } diff --git a/site/models/tag.php b/site/models/tag.php index 4239a7b..33ee914 100644 --- a/site/models/tag.php +++ b/site/models/tag.php @@ -18,11 +18,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\StringHelper; use VDM\Joomla\Utilities\Component\Helper; use VDM\Joomla\Utilities\GuidHelper; -use VDM\Joomla\GetBible\Factory; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\GetBible\Factory as GetBibleFactory; /** * Getbible List Model for Tag @@ -51,19 +58,19 @@ class GetbibleModelTag 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); @@ -93,7 +100,7 @@ class GetbibleModelTag extends ListModel $query->join('LEFT', ($db->quoteName('#__getbible_tag', 't')) . ' ON (' . $db->quoteName('a.tag') . ' = ' . $db->quoteName('t.guid') . ')'); // Check if $this->tag is a string or numeric value. $checkValue = $this->tag; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.tag = ' . $db->quote($checkValue)); } @@ -107,7 +114,7 @@ class GetbibleModelTag extends ListModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('v.abbreviation = ' . $db->quote($checkValue)); } @@ -150,10 +157,10 @@ class GetbibleModelTag extends ListModel */ public function getItems() { - $user = JFactory::getUser(); + $user = Factory::getUser(); - $this->input ??= JFactory::getApplication()->input; + $this->input ??= Factory::getApplication()->input; $this->translation = $this->input->getString('t') ?? $this->input->getString('translation', Helper::getParams('com_getbible')->get('default_translation', 'kjv')) ; $this->tag = $this->input->getString('guid') ?? ''; @@ -166,20 +173,20 @@ class GetbibleModelTag extends ListModel $items = parent::getItems(); // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::getParams('com_getbible', true); // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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 text $_text = new stdClass(); $_text->text =& $item->text; // value must be in text @@ -203,7 +210,7 @@ class GetbibleModelTag 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'); @@ -212,7 +219,7 @@ class GetbibleModelTag extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -224,7 +231,7 @@ class GetbibleModelTag extends ListModel $query->from($db->quoteName('#__getbible_translation', 'a')); // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.abbreviation = ' . $db->quote($checkValue)); } @@ -247,16 +254,16 @@ class GetbibleModelTag extends ListModel 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 distribution_history - if (isset($data->distribution_history) && GetbibleHelper::checkJson($data->distribution_history)) + if (isset($data->distribution_history) && JsonHelper::check($data->distribution_history)) { // Decode distribution_history $data->distribution_history = json_decode($data->distribution_history, true); } // Check if item has params, or pass whole item. - $params = (isset($data->params) && GetbibleHelper::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 distribution_about $_distribution_about = new stdClass(); $_distribution_about->text =& $data->distribution_about; // value must be in text @@ -283,7 +290,7 @@ class GetbibleModelTag 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'); @@ -295,7 +302,7 @@ class GetbibleModelTag extends ListModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -320,17 +327,17 @@ class GetbibleModelTag extends ListModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -353,7 +360,7 @@ class GetbibleModelTag 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'); @@ -365,7 +372,7 @@ class GetbibleModelTag extends ListModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -375,9 +382,9 @@ class GetbibleModelTag extends ListModel array('a.id','a.linker','a.name','a.description','a.published','a.guid'), array('id','linker','name','description','published','guid'))); $query->from($db->quoteName('#__getbible_tag', 'a')); - // Check if Factory::_('GetBible.Linker')->active(true) is a string or numeric value. - $checkValue = Factory::_('GetBible.Linker')->active(true); - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + // Check if GetBibleFactory::_('GetBible.Linker')->active(true) is a string or numeric value. + $checkValue = GetBibleFactory::_('GetBible.Linker')->active(true); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.linker = ' . $db->quote($checkValue)); } @@ -402,17 +409,17 @@ class GetbibleModelTag extends ListModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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->text =& $item->description; // value must be in text @@ -435,7 +442,7 @@ class GetbibleModelTag 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'); @@ -444,7 +451,7 @@ class GetbibleModelTag extends ListModel $this->initSet = true; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -456,7 +463,7 @@ class GetbibleModelTag extends ListModel $query->from($db->quoteName('#__getbible_tag', 'a')); // Check if $this->tag is a string or numeric value. $checkValue = $this->tag; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.guid = ' . $db->quote($checkValue)); } @@ -481,10 +488,10 @@ class GetbibleModelTag 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) && GetbibleHelper::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->text =& $data->description; // value must be in text @@ -506,7 +513,7 @@ class GetbibleModelTag 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'); @@ -518,7 +525,7 @@ class GetbibleModelTag extends ListModel // Get the global params $globalParams = JComponentHelper::getParams('com_getbible', true); // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -546,9 +553,9 @@ class GetbibleModelTag extends ListModel array('t.guid'), array('tag'))); $query->join('LEFT', ($db->quoteName('#__getbible_tag', 't')) . ' ON (' . $db->quoteName('a.tag') . ' = ' . $db->quoteName('t.guid') . ')'); - // Check if Factory::_('GetBible.Linker')->active(true) is a string or numeric value. - $checkValue = Factory::_('GetBible.Linker')->active(true); - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + // Check if GetBibleFactory::_('GetBible.Linker')->active(true) is a string or numeric value. + $checkValue = GetBibleFactory::_('GetBible.Linker')->active(true); + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.linker = ' . $db->quote($checkValue)); } @@ -562,7 +569,7 @@ class GetbibleModelTag extends ListModel } // Check if $this->tag is a string or numeric value. $checkValue = $this->tag; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('a.tag = ' . $db->quote($checkValue)); } @@ -576,7 +583,7 @@ class GetbibleModelTag extends ListModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('v.abbreviation = ' . $db->quote($checkValue)); } @@ -590,7 +597,7 @@ class GetbibleModelTag extends ListModel } // Check if $this->translation is a string or numeric value. $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + if (isset($checkValue) && StringHelper::check($checkValue)) { $query->where('b.abbreviation = ' . $db->quote($checkValue)); } @@ -625,17 +632,17 @@ class GetbibleModelTag extends ListModel } // Insure all item fields are adapted where needed. - if (GetbibleHelper::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; // Check if item has params, or pass whole item. - $params = (isset($item->params) && GetbibleHelper::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 text $_text = new stdClass(); $_text->text =& $item->text; // value must be in text diff --git a/site/router.php b/site/router.php index a875cb2..0414528 100644 --- a/site/router.php +++ b/site/router.php @@ -18,6 +18,9 @@ // 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_getbible * @@ -700,7 +703,7 @@ class GetbibleRouter extends JComponentRouterBase if (!empty($translation) && is_numeric($value) && $value > 0) { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -763,10 +766,10 @@ class GetbibleRouter extends JComponentRouterBase { if(!$where) { - $where = JFactory::getUser()->id; + $where = Factory::getUser()->id; } // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array($what))); diff --git a/site/views/api/tmpl/default.php b/site/views/api/tmpl/default.php index 9cb2d90..7083e76 100644 --- a/site/views/api/tmpl/default.php +++ b/site/views/api/tmpl/default.php @@ -18,7 +18,9 @@ // 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; ?> toolbar->render(); ?> -user->name); ?> +user->name); ?> diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index 672463c..4756b08 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -18,7 +18,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; /** * Getbible Html View class for the Api @@ -29,11 +38,11 @@ class GetbibleViewApi extends HtmlView 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'); @@ -61,7 +70,7 @@ class GetbibleViewApi extends HtmlView // Only load jQuery if needed. (default is true) if ($this->params->get('add_jquery_framework', 1) == 1) { - JHtml::_('jquery.framework'); + Html::_('jquery.framework'); } // Load the header checker class. require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' ); @@ -75,16 +84,16 @@ class GetbibleViewApi extends HtmlView // The uikit css. if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) { - JHtml::_('stylesheet', 'media/com_getbible/uikit-v3/css/uikit'.$size.'.css', ['version' => 'auto']); + Html::_('stylesheet', 'media/com_getbible/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_getbible/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); - JHtml::_('script', 'media/com_getbible/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_getbible/uikit-v3/js/uikit'.$size.'.js', ['version' => 'auto']); + Html::_('script', 'media/com_getbible/uikit-v3/js/uikit-icons'.$size.'.js', ['version' => 'auto']); } // add the document default css file - JHtml::_('stylesheet', 'components/com_getbible/assets/css/api.css', ['version' => 'auto']); + Html::_('stylesheet', 'components/com_getbible/assets/css/api.css', ['version' => 'auto']); } /** @@ -95,12 +104,12 @@ class GetbibleViewApi extends HtmlView // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('api'); - if (GetbibleHelper::checkString($this->help_url)) + if (StringHelper::check($this->help_url)) { - JToolbarHelper::help('COM_GETBIBLE_HELP_MANAGER', false, $this->help_url); + ToolbarHelper::help('COM_GETBIBLE_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + $this->toolbar = Toolbar::getInstance(); } /** @@ -113,6 +122,6 @@ class GetbibleViewApi extends HtmlView public function escape($var, $sorten = false, $length = 40) { // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset, $sorten, $length); + return StringHelper::html($var, $this->_charset, $sorten, $length); } } diff --git a/site/views/app/tmpl/default.php b/site/views/app/tmpl/default.php index 69aa710..7fd8797 100644 --- a/site/views/app/tmpl/default.php +++ b/site/views/app/tmpl/default.php @@ -18,15 +18,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\Router\Route; ?> item): ?> loadTemplate('getbibleapp'); ?>
-

-

+

+

params->get('debug') == 1): ?> diff --git a/site/views/app/tmpl/default_getbibleapp.php b/site/views/app/tmpl/default_getbibleapp.php index 30e1e15..71cc891 100644 --- a/site/views/app/tmpl/default_getbibleapp.php +++ b/site/views/app/tmpl/default_getbibleapp.php @@ -18,6 +18,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; + ?>