From 88104fd4830415c7aa751fed5dbf95afd8311a64 Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 22 Jan 2024 10:48:28 +0200 Subject: [PATCH] Stable release of v3.0.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/assets/css/dashboard.css | 202 ++++++------ admin/assets/images/import.gif | Bin 65516 -> 66680 bytes admin/controller.php | 34 +- admin/controllers/ajax.json.php | 18 +- 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 | 24 +- admin/helpers/getbible.php | 134 ++++---- admin/helpers/headercheck.php | 48 ++- admin/helpers/html/batch_.php | 2 +- admin/language/en-GB/en-GB.com_getbible.ini | 16 +- admin/layouts/batchselection.php | 19 +- 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 | 119 +++---- admin/models/book.php | 144 ++++---- admin/models/books.php | 44 ++- admin/models/chapter.php | 144 ++++---- admin/models/chapters.php | 52 +-- admin/models/fields/booksfiltername.php | 16 +- admin/models/fields/booksfilternr.php | 16 +- admin/models/fields/chaptersfilterbooknr.php | 14 +- admin/models/fields/chaptersfilterchapter.php | 14 +- admin/models/fields/linkers.php | 24 +- admin/models/fields/linkersfiltername.php | 16 +- .../fields/linkersfilterpublicnotes.php | 16 +- .../linkersfilterpublictaggedverses.php | 16 +- admin/models/fields/notesfilteraccess.php | 16 +- admin/models/fields/notesfilterbooknr.php | 16 +- admin/models/fields/notesfilterchapter.php | 16 +- admin/models/fields/notesfilterverse.php | 16 +- .../fields/openaimessagesfilterrole.php | 16 +- .../fields/openaimessagesfiltersource.php | 16 +- admin/models/fields/openairesponses.php | 8 +- .../openairesponsesfilterresponseid.php | 16 +- .../openairesponsesfilterresponsemodel.php | 16 +- admin/models/fields/passwordsfiltername.php | 16 +- admin/models/fields/prompts.php | 8 +- .../fields/promptsfiltercachebehaviour.php | 16 +- admin/models/fields/promptsfiltermodel.php | 16 +- admin/models/fields/promptsfiltername.php | 16 +- admin/models/fields/tagers.php | 24 +- .../fields/taggedversesfilteraccess.php | 16 +- .../fields/taggedversesfilterbooknr.php | 14 +- .../fields/taggedversesfilterchapter.php | 14 +- .../models/fields/taggedversesfilterverse.php | 14 +- admin/models/fields/tagsfilteraccess.php | 16 +- admin/models/fields/targettranslations.php | 8 +- admin/models/fields/translations.php | 8 +- .../fields/translationsfilterdirection.php | 16 +- admin/models/fields/versesfilterbooknr.php | 16 +- admin/models/fields/versesfilterchapter.php | 16 +- admin/models/fields/versesfilterverse.php | 16 +- admin/models/forms/book.xml | 2 +- admin/models/forms/chapter.xml | 2 +- admin/models/forms/linker.xml | 2 +- admin/models/forms/note.xml | 2 +- admin/models/forms/open_ai_message.xml | 2 +- admin/models/forms/open_ai_response.xml | 2 +- admin/models/forms/password.xml | 2 +- admin/models/forms/prompt.xml | 2 +- admin/models/forms/tag.xml | 2 +- admin/models/forms/tagged_verse.xml | 2 +- admin/models/forms/translation.xml | 2 +- admin/models/forms/verse.xml | 2 +- admin/models/getbible.php | 286 +++++++++------- admin/models/linker.php | 184 ++++++----- admin/models/linkers.php | 50 +-- admin/models/note.php | 142 ++++---- admin/models/notes.php | 44 ++- admin/models/open_ai_message.php | 144 ++++---- admin/models/open_ai_messages.php | 50 +-- admin/models/open_ai_response.php | 162 ++++----- admin/models/open_ai_responses.php | 44 ++- admin/models/password.php | 146 +++++---- admin/models/passwords.php | 44 ++- admin/models/prompt.php | 146 +++++---- admin/models/prompts.php | 52 +-- admin/models/rules/guid.php | 3 + admin/models/rules/int.php | 3 + admin/models/rules/numbershyphens.php | 3 + admin/models/tag.php | 144 ++++---- admin/models/tagged_verse.php | 142 ++++---- admin/models/tagged_verses.php | 60 ++-- admin/models/tags.php | 44 ++- admin/models/translation.php | 146 +++++---- admin/models/translations.php | 48 +-- admin/models/verse.php | 144 ++++---- admin/models/verses.php | 44 ++- admin/sql/updates/mysql/2.0.32.sql | 1 + admin/tables/book.php | 108 +++--- admin/tables/chapter.php | 108 +++--- admin/tables/linker.php | 108 +++--- admin/tables/note.php | 110 ++++--- admin/tables/open_ai_message.php | 110 ++++--- admin/tables/open_ai_response.php | 110 ++++--- admin/tables/password.php | 108 +++--- admin/tables/prompt.php | 110 ++++--- admin/tables/tag.php | 110 ++++--- admin/tables/tagged_verse.php | 110 ++++--- admin/tables/translation.php | 108 +++--- admin/tables/verse.php | 108 +++--- admin/views/book/submitbutton.js | 2 +- admin/views/book/tmpl/edit.php | 73 ++--- admin/views/book/view.html.php | 42 ++- 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 | 59 ++-- admin/views/books/view.html.php | 119 ++++--- admin/views/chapter/submitbutton.js | 2 +- admin/views/chapter/tmpl/edit.php | 73 ++--- admin/views/chapter/view.html.php | 42 ++- 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 | 59 ++-- admin/views/chapters/view.html.php | 117 ++++--- admin/views/getbible/tmpl/default.php | 64 ++-- admin/views/getbible/tmpl/default_main.php | 8 +- ...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 | 45 +-- admin/views/linker/submitbutton.js | 2 +- admin/views/linker/tmpl/edit.php | 91 +++--- admin/views/linker/view.html.php | 80 +++-- 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 | 59 ++-- admin/views/linkers/view.html.php | 115 ++++--- admin/views/note/submitbutton.js | 2 +- admin/views/note/tmpl/edit.php | 73 ++--- admin/views/note/view.html.php | 78 +++-- 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 | 59 ++-- admin/views/notes/view.html.php | 131 ++++---- admin/views/open_ai_message/submitbutton.js | 2 +- admin/views/open_ai_message/tmpl/edit.php | 75 +++-- admin/views/open_ai_message/view.html.php | 78 +++-- 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 | 59 ++-- admin/views/open_ai_messages/view.html.php | 127 +++---- admin/views/open_ai_response/submitbutton.js | 2 +- admin/views/open_ai_response/tmpl/edit.php | 95 +++--- admin/views/open_ai_response/view.html.php | 82 +++-- .../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 | 59 ++-- admin/views/open_ai_responses/view.html.php | 119 ++++--- admin/views/password/submitbutton.js | 2 +- admin/views/password/tmpl/edit.php | 73 ++--- admin/views/password/view.html.php | 76 +++-- 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 | 59 ++-- admin/views/passwords/view.html.php | 103 +++--- admin/views/prompt/submitbutton.js | 2 +- admin/views/prompt/tmpl/edit.php | 83 +++-- admin/views/prompt/view.html.php | 78 +++-- 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 | 59 ++-- admin/views/prompts/view.html.php | 127 +++---- admin/views/tag/submitbutton.js | 2 +- admin/views/tag/tmpl/edit.php | 73 ++--- admin/views/tag/view.html.php | 78 +++-- admin/views/tagged_verse/submitbutton.js | 2 +- admin/views/tagged_verse/tmpl/edit.php | 73 ++--- admin/views/tagged_verse/view.html.php | 78 +++-- 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 | 59 ++-- admin/views/tagged_verses/view.html.php | 155 +++++---- 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 | 59 ++-- admin/views/tags/view.html.php | 101 +++--- admin/views/translation/submitbutton.js | 2 +- admin/views/translation/tmpl/edit.php | 75 +++-- admin/views/translation/view.html.php | 44 ++- 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 | 59 ++-- admin/views/translations/view.html.php | 101 +++--- admin/views/verse/submitbutton.js | 2 +- admin/views/verse/tmpl/edit.php | 75 +++-- admin/views/verse/view.html.php | 42 ++- 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 | 59 ++-- admin/views/verses/view.html.php | 127 +++---- getbible.xml | 8 +- .../VDM.Joomla.Gitea/src/Utilities/Http.php | 4 +- .../VDM.Joomla/src/Abstraction/BaseConfig.php | 6 +- .../src/Utilities/Component/Helper.php | 89 ++++- .../VDM.Joomla/src/Utilities/FileHelper.php | 16 +- .../VDM.Joomla/src/Utilities/GuidHelper.php | 2 +- .../src/Utilities/String/NamespaceHelper.php | 78 +++++ media/js/book.js | 2 +- media/js/chapter.js | 2 +- media/js/linker.js | 2 +- media/js/note.js | 2 +- media/js/open_ai_message.js | 2 +- media/js/open_ai_response.js | 2 +- media/js/password.js | 2 +- media/js/prompt.js | 2 +- media/js/tag.js | 2 +- media/js/tagged_verse.js | 2 +- media/js/translation.js | 2 +- media/js/verse.js | 2 +- script.php | 251 +++++++------- site/controller.php | 11 +- site/controllers/ajax.json.php | 20 +- site/getbible.php | 17 +- site/helpers/getbible.php | 114 ++++--- site/helpers/headercheck.php | 46 ++- site/helpers/route.php | 66 ++-- 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 | 18 +- site/models/app.php | 309 +++++++++--------- site/models/openai.php | 52 +-- site/models/search.php | 51 +-- site/models/tag.php | 120 +++---- site/router.php | 13 +- site/views/api/tmpl/default.php | 6 +- site/views/api/view.html.php | 39 ++- 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 | 90 ++--- 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 | 64 ++-- 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 | 106 +++--- 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 | 72 ++-- update_server.xml | 18 + 459 files changed, 8086 insertions(+), 6116 deletions(-) create mode 100644 admin/sql/updates/mysql/2.0.32.sql create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f0f2ece..bf8b26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v3.0.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..11fadce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (3.0.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*: 22nd January, 2024 ++ *Version*: 3.0.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 - +**567 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*: **203297** ++ *File count*: **1750** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**375 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 @95hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**942 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..11fadce 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.32) +# Get Bible (3.0.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*: 22nd January, 2024 ++ *Version*: 3.0.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 - +**567 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*: **203297** ++ *File count*: **1750** + *Folder count*: **167** -**370 Hours** or **46 Eight Hour Days** (the actual time the author spent) +**375 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 @95hours** = codingtime / 6;) -**931 Hours** or **116 Eight Hour Days** +**942 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/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 10742d8..169d221 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -17,153 +17,153 @@ /* CSS Document */ .dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; + margin-left: 10px; + margin-top: 10px; + width: 100%; } .dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; + display: block; + float: none; + margin-left: 0; + width: auto; } .dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; + content: ""; + display: table; } .dashboard-container:after { - clear: both; + clear: both; } .dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; } .dashboard-container [class*="span"]:first-child { - margin-left: 0; + margin-left: 0; } .dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; } .dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; } .dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; } .dashboard-title { - display: block; - padding-top: 5px; + display: block; + padding-top: 5px; } .dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; } .dashboard-info span { - display: block; - text-align: center; + display: block; + text-align: center; } .dashboard-info img { - margin: 0 auto; + margin: 0 auto; } .dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; } .dashboard-info h5 { - font-size: 11px; - font-weight: bold; + font-size: 11px; + font-weight: bold; } .dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; } .dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; } .dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; } .dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; } .dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; } .dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; + margin-top: 0 !important; } .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; } .dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; } .dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/assets/images/import.gif b/admin/assets/images/import.gif index 4371cc618bdc1702aad69fc871a50182a01537ec..10bcb856924dbc48ac739332a40ce1617c88687b 100644 GIT binary patch delta 4162 zcmeHKYgm&<7S5MIE)Xuka1RiIcvnJE7O+;tsI<09tst#biMkbwNRYA?9xV|F0i-rK zRG?77T9sC$DFgJ8b=`u>qQYv?LKbg$tE`I))cRPeXfqf1g8koL=1TA|H z8%G|sPGV#z^1553X>X!OPV(#-Cch~++#&?F1DH`Ma26ngm+B9E#cn_?@F%JCf)ti5 z*v#ey-Gv)zs-2>B1a(_vAt=Z!$OGotSX0z)+XjMCi9cnz{$fUX0;7{H=v~W)BD+%* z{crnHg5K!x^4N3$W95IqM~-t{k;Z^rL!|Yt%*;ZGtmv}{J{kgN9otA0kUV8`1fv|# z=yZ*-Lns&Zfhkik{8MQMiweVfwa(kAf)STXgsaoFlSN^@@T6Nd` zgi#)@G&aF=s~d99GHF``ldTz!?=Xg-F`z7!0j;wL+RNez9433UGi;GXbuv&D>Inu+ zd{|Swo59s`p7JV&XNM1NSm%`M5dHuYE#3PgN$gu<$HqftsRI{}gYeJ(r9jATq18iY z)qeS!)B5=JQh)!o!Z-H67m+hmwiWXX`A4IFxiDV4eupBGFXbpNX)8A@R)i&NpWfe^ zi$U>|;>IMx!SXUHz2NgnwB~R3jj#Y?CyQO8xpYejf%jbzFh+^M{1ab* z?~nA5sPdX38a1<4KQ5|x4!mDGg-7(b)Fry3bbW`8{J*K+#nZ}i4PjAT0%MQdSC6Gh zduovdnfg1F_-;coON{mv-r-Q&_#IuCkYj5|mXc$8$La*^!aIPprW*vY>hDL0@x$UF zY`}-dB^HOmAF74(Pb?-nVD3L@ioNsKe+rV^t$X4M1~B{+T~ zeuDT(?BQ-7^a)nAD+wU4{jBBGy2GT7(M>Bjzkyb@`9kCPsytx$4=U=^b)Ljj@YRco zQT(OtmZYcx5x8(#1PnSc=(r_<6MuB3(6Fwrh>+V|uM%Tc_iMyR?_Nxd@4Ksrp*BTZ z>IiI7!KbD?%B1gkg`iq{s>P_t09jinF7|`V1;q30@)BY!xe~+*B*&!y#9a*{Uc=Qo zVn{aS5Tosy7dGHe*OpuCDzs@`p?6|AkpP=E2T(EhlH?@Pc1!E?nfRbC`8c6V);Q8o zZHlYKst=Z%1S?EcSbbXRWFP;Hn@|ED@CMQsu zzX=3v+eipXwk;>d-EBLF@z)Q(B!*48iWtk&DW)>rg^V<&`w*im-NzSYPVK0PJ*4sT zy{D-@Xn*dIbajbRY;a!Q_Wm5>el(C*x9J1Yy>W|xz z`TQK&9%%lEdRsEXaem0t?in{l-C#>r7LhiT>Rr2_PW)Uf<_yuw$T&T z>Rx9&km{Mg<(DzaD*qJ&S9EI4BApIzAYiXgB>Wlr>BKmspM}q9{=n9>Cxy1mWL)!g z{df4rU~pvIybQfn#bWuzZiYYg?QG>?45-PA#jUquDtI&04fx~>SV^M`)=DyX71Wbb zIt$j)QeG;gr_s7XEjv*~bv}^yv6f(9&Ta`8mlD`pm8Gt?9@k7cB!_o}2wpaXF%d{p z1CJXOBx#(<@7pzJTEqFt?ooDO?uxK>Q%r!t8Uak+L(^lIpQ_exsZ-YQ6)R3G6i8YMe7KfcUNqwu&G2|@ zR=yc{5#iRjFRkGE*-SiJrg*)stgQLArsJ*91;M4rx93sP*wVq|M`>I(n;*{hYmHZA0 Cx!!>Q delta 2752 zcmeHJ`&Z0q81Fl`dYjs2=r+@I9V()tqzh||R_^5zp{20OCY2RS*)Ehzp}eg`+F7hD z9c|u5II%@*J7{wkT1^htC0({XyOhg5&s6Ncu;=*Yb7nrz=lwj-dwbsR%gut8cl?|U zJVMH{EI0un29C5$YsIR$c^pTmJwFpUC2byV&d&4wfZHiNf|R#jc1ak^4Ixd|6B>5K z$T!A$4{1=kHe0I=#cf388aV#sstThi2Ym(OGmRb9?$Om!LSqe8;9F*xfF?d*V#_8P zMPaUTvItOatk38L8Re|TScs82u@*4XwldyB$kl} zTwMu$YhH(DDz$<}xLGiPrM|p4s~a#f$od+@n4?U?8I#SW;pM|8d?_I8s@w{TX|Y); zCGHKW=L}thoPpyjOyUbOQL?>?2oSJ$wwF2dF4Zb%RaQS*(rCsc4%;~?F?h=_eC4fb zU$UrQrkSdf(5~G#VZe4LQ~j=>i=6$e?8G$Pg}(x(Im-dRa}EU@U1SY7wOhp3IFB8tnUHbCA)e5LgAah6^TRnn+e3c6V&+r)nAbP( z^^sOS8BFLgZ$~h;E(twz}@;a>ewmqTE^`5|A3A@-c7uoTv z1z5qpYfG?#s_+v%6)0HKjX-2vZk>m4>n$hzQy-Cxi;FeLSzM$Sa?kJl2)O(1L_p2r zNr0`3#{;gvrvY?q3`N8CsqU<#QG@!B`=0_%jXEqM9*Wv)gmTeaf!Glp1Zc1GLV3?+ z3IHOZ`8c4D6V zDM8`NudMWAb64F1WqjgtKwYAffYc`tX0kdAU82`?{`UZ>X(6?sR@qDGsI^fLE?yf9 z*tK>&VA8sSfXbvmz?dZD&n8&{HYC{tcI(kDSq8rYlI6Y20Qb&?QfkBMlJ&JO|3-;f zX-dk6s*PAzssLGDI&>^HK7D6z)wgNI#&qCEXW)^TpRpQ6H#2el7H^u51}gP9MmA63 z%*oKMEd`vXX5fsr#*E1L&oVMh2#wnk1Je6j+yG6tx{HaZZDr!?Y%%9T=#;G$mLx~Q zS=;95G5=8{dsLr`1(kS-SR(c3{D_v%3-OYk7%F;_ zHDa)~-bEH->MwKhzuYj}BS%OY>^j`Sf@=^KwW*)ij$H4)a4XRq%X zAMWVK9tVf{V~_iv_PA25B^&*)2rpIBqgj9>A9ov*U&PY9E7c}KSDKbIfO*D{nLaJtDRSk*`|(ijE?Di zjU#>EKgBvBVe9_#$4Bkt-|+2147?y_&Q$+=j{5Ikx?2%0@29Ux=sBT6=@;g5L{&SP z2F8vewC&|qsFt3p3->0#R8`(#|sLoAI8_s^c(B5 zo6tqwv6#eL|6Fx;&*kAiC05B|-%f+CE@4fffsoMJcllthjp97PJRjQfY*P~065!;p auROd_WJmG^JT4v-70Em<5+%)iF8^Od#l!;u diff --git a/admin/controller.php b/admin/controller.php index 0b43409..3789eee 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'; @@ -51,38 +55,38 @@ class GetbibleController extends BaseController function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', 'getbible'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); + $view = $this->input->getCmd('view', 'getbible'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $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); + $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..9fbbd28 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,16 +47,16 @@ 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'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task 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..6333f30 100644 --- a/admin/getbible.php +++ b/admin/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// register this component namespace -spl_autoload_register(function ($class) { +// register additional namespace +\spl_autoload_register(function ($class) { // project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla.GetBible' => 'VDM\\Joomla\\GetBible', @@ -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..0d75d8f 100644 --- a/admin/helpers/getbible.php +++ b/admin/helpers/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// register this component namespace -spl_autoload_register(function ($class) { +// register additional namespace +\spl_autoload_register(function ($class) { // project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla.GetBible' => 'VDM\\Joomla\\GetBible', @@ -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,18 +182,18 @@ 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) - { + { if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } @@ -197,8 +207,8 @@ abstract class GetbibleHelper $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -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'); @@ -367,7 +377,7 @@ abstract class GetbibleHelper $db->execute(); $found = $db->getNumRows(); if($found) - { + { return $db->loadResult(); } return $id; @@ -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,22 +402,22 @@ 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)) { $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); } @@ -862,7 +872,7 @@ abstract class GetbibleHelper /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success * @deprecated 3.3 Use JsonHelper::check($string); @@ -875,7 +885,7 @@ abstract class GetbibleHelper /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success * @deprecated 3.3 Use ObjectHelper::check($object); @@ -888,7 +898,7 @@ abstract class GetbibleHelper /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); @@ -901,7 +911,7 @@ abstract class GetbibleHelper /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success * @deprecated 3.3 Use UtilitiesStringHelper::check($string); @@ -921,7 +931,7 @@ abstract class GetbibleHelper { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -939,7 +949,7 @@ abstract class GetbibleHelper /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); @@ -958,7 +968,7 @@ abstract class GetbibleHelper /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); @@ -971,7 +981,7 @@ abstract class GetbibleHelper /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); @@ -990,7 +1000,7 @@ abstract class GetbibleHelper /** * Convert none English strings to code usable string * - * @input an string + * @input an string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); @@ -1003,7 +1013,7 @@ abstract class GetbibleHelper /** * make sure a string is HTML save * - * @input an html string + * @input an html string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::html(...); @@ -1021,7 +1031,7 @@ abstract class GetbibleHelper /** * Convert all int in a string to an English word string * - * @input an string with numbers + * @input an string with numbers * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); @@ -1035,7 +1045,7 @@ abstract class GetbibleHelper * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::number($x); */ 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/language/en-GB/en-GB.com_getbible.ini b/admin/language/en-GB/en-GB.com_getbible.ini index 103d547..2611f0f 100644 --- a/admin/language/en-GB/en-GB.com_getbible.ini +++ b/admin/language/en-GB/en-GB.com_getbible.ini @@ -1,7 +1,7 @@ COM_GETBIBLE="Get Bible" COM_GETBIBLE_ACCESS_ALREADY_EXIST_BUT_COULD_NOT_BE_REACTIVATED="Access already exist, but could not be reactivated." COM_GETBIBLE_ACCESS_REVOKED="Access revoked." -COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." +COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER="All is good, please check again later" COM_GETBIBLE_ALL_TRANSLATIONS="All Translations" COM_GETBIBLE_ALL_TRANSLATIONS_WERE_SUCCESSFULLY_UPDATED_AND_THEY_ARE_NOW_IN_SYNC_WITH_THE_GETBIBLE_API="All translations were successfully updated, and they are now in sync with the getBible API." COM_GETBIBLE_ARCHIVED="Archived" @@ -70,6 +70,7 @@ COM_GETBIBLE_BOOK_CREATED_DATE_DESC="The date this Book was created." COM_GETBIBLE_BOOK_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_BOOK_DETAILS="Details" COM_GETBIBLE_BOOK_ERROR_UNIQUE_ALIAS="Another Book has the same alias." +COM_GETBIBLE_BOOK_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Book has the same alias ." COM_GETBIBLE_BOOK_FORCE_HASH_CHECK_BUTTON_ACCESS="Book Force Hash Check Button Access" COM_GETBIBLE_BOOK_FORCE_HASH_CHECK_BUTTON_ACCESS_DESC="Allows the users in this group to access the force hash check button." COM_GETBIBLE_BOOK_ID="Id" @@ -163,6 +164,7 @@ COM_GETBIBLE_CHAPTER_CREATED_DATE_DESC="The date this Chapter was created." COM_GETBIBLE_CHAPTER_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_CHAPTER_DETAILS="Details" COM_GETBIBLE_CHAPTER_ERROR_UNIQUE_ALIAS="Another Chapter has the same alias." +COM_GETBIBLE_CHAPTER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Chapter has the same alias ." COM_GETBIBLE_CHAPTER_ID="Id" COM_GETBIBLE_CHAPTER_MODIFIED_BY_DESC="The last user that modified this Chapter." COM_GETBIBLE_CHAPTER_MODIFIED_BY_LABEL="Modified By" @@ -684,6 +686,7 @@ COM_GETBIBLE_LINKER_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_LINKER_DETAILS="Details" COM_GETBIBLE_LINKER_EDIT="Editing the Linker" COM_GETBIBLE_LINKER_ERROR_UNIQUE_ALIAS="Another Linker has the same alias." +COM_GETBIBLE_LINKER_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Linker has the same alias ." COM_GETBIBLE_LINKER_GUID_DESCRIPTION="Globally Unique Identifier" COM_GETBIBLE_LINKER_GUID_HINT="Auto Generated" COM_GETBIBLE_LINKER_GUID_LABEL="GUID" @@ -788,6 +791,7 @@ COM_GETBIBLE_NOTE_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_NOTE_DETAILS="Details" COM_GETBIBLE_NOTE_EDIT="Editing the Note" COM_GETBIBLE_NOTE_ERROR_UNIQUE_ALIAS="Another Note has the same alias." +COM_GETBIBLE_NOTE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Note has the same alias ." COM_GETBIBLE_NOTE_GUID_DESCRIPTION="Globally Unique Identifier" COM_GETBIBLE_NOTE_GUID_HINT="Auto Generated" COM_GETBIBLE_NOTE_GUID_LABEL="GUID" @@ -884,6 +888,7 @@ COM_GETBIBLE_OPEN_AI_MESSAGE_CREATED_DATE_DESC="The date this Open AI Message wa COM_GETBIBLE_OPEN_AI_MESSAGE_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_OPEN_AI_MESSAGE_EDIT="Editing the Open AI Message" COM_GETBIBLE_OPEN_AI_MESSAGE_ERROR_UNIQUE_ALIAS="Another Open AI Message has the same alias." +COM_GETBIBLE_OPEN_AI_MESSAGE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Open AI Message has the same alias ." COM_GETBIBLE_OPEN_AI_MESSAGE_FUNCTION="function" COM_GETBIBLE_OPEN_AI_MESSAGE_ID="Id" COM_GETBIBLE_OPEN_AI_MESSAGE_INDEX_DESCRIPTION="Message index" @@ -1025,6 +1030,7 @@ COM_GETBIBLE_OPEN_AI_RESPONSE_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_OPEN_AI_RESPONSE_DETAILS="Details" COM_GETBIBLE_OPEN_AI_RESPONSE_EDIT="Editing the Open AI Response" COM_GETBIBLE_OPEN_AI_RESPONSE_ERROR_UNIQUE_ALIAS="Another Open AI Response has the same alias." +COM_GETBIBLE_OPEN_AI_RESPONSE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Open AI Response has the same alias ." COM_GETBIBLE_OPEN_AI_RESPONSE_FREQUENCY_PENALTY_DESCRIPTION="Penalty for new tokens based on their frequency in the text" COM_GETBIBLE_OPEN_AI_RESPONSE_FREQUENCY_PENALTY_LABEL="Frequency Penalty" COM_GETBIBLE_OPEN_AI_RESPONSE_GPT35TURBO="gpt-3.5-turbo" @@ -1157,6 +1163,7 @@ COM_GETBIBLE_PASSWORD_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_PASSWORD_DETAILS="Details" COM_GETBIBLE_PASSWORD_EDIT="Editing the Password" COM_GETBIBLE_PASSWORD_ERROR_UNIQUE_ALIAS="Another Password has the same alias." +COM_GETBIBLE_PASSWORD_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Password has the same alias ." COM_GETBIBLE_PASSWORD_GUID_DESCRIPTION="Globally Unique Identifier" COM_GETBIBLE_PASSWORD_GUID_HINT="Auto Generated" COM_GETBIBLE_PASSWORD_GUID_LABEL="GUID" @@ -1182,7 +1189,7 @@ COM_GETBIBLE_PASSWORD_STATUS="Status" COM_GETBIBLE_PASSWORD_TO_SHORT_USE_A_LONGER_PASSWORD="Password to short, use a longer password." COM_GETBIBLE_PASSWORD_VERSION_DESC="A count of the number of times this Password has been revised." COM_GETBIBLE_PASSWORD_VERSION_LABEL="Version" -COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATTER="Please check again latter." +COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATER="Please check again later" COM_GETBIBLE_PROMPT="Prompt" COM_GETBIBLE_PROMPTS="Prompts" COM_GETBIBLE_PROMPTS_ACCESS="Prompts Access" @@ -1306,6 +1313,7 @@ COM_GETBIBLE_PROMPT_CREATED_DATE_DESC="The date this Prompt was created." COM_GETBIBLE_PROMPT_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_PROMPT_EDIT="Editing the Prompt" COM_GETBIBLE_PROMPT_ERROR_UNIQUE_ALIAS="Another Prompt has the same alias." +COM_GETBIBLE_PROMPT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Prompt has the same alias ." COM_GETBIBLE_PROMPT_FREQUENCY_PENALTY_DESCRIPTION="Penalty for new tokens based on their frequency in the text" COM_GETBIBLE_PROMPT_FREQUENCY_PENALTY_LABEL="Frequency Penalty" COM_GETBIBLE_PROMPT_FREQUENCY_PENALTY_NOTE_DESCRIPTION="

The "frequency_penalty" is another optional parameter that defaults to 0. This is also a value between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

  • For example, a high frequency penalty discourages the model from excessively repeating the same words or phrases, encouraging it to produce more diverse and creative text.
" @@ -1511,6 +1519,7 @@ COM_GETBIBLE_TAGGED_VERSE_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_TAGGED_VERSE_DETAILS="Details" COM_GETBIBLE_TAGGED_VERSE_EDIT="Editing the Tagged Verse" COM_GETBIBLE_TAGGED_VERSE_ERROR_UNIQUE_ALIAS="Another Tagged Verse has the same alias." +COM_GETBIBLE_TAGGED_VERSE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Tagged Verse has the same alias ." COM_GETBIBLE_TAGGED_VERSE_GUID_DESCRIPTION="Globally Unique Identifier" COM_GETBIBLE_TAGGED_VERSE_GUID_HINT="Auto Generated" COM_GETBIBLE_TAGGED_VERSE_GUID_LABEL="GUID" @@ -1602,6 +1611,7 @@ COM_GETBIBLE_TAG_DESCRIPTION_LABEL="Description" COM_GETBIBLE_TAG_DETAILS="Details" COM_GETBIBLE_TAG_EDIT="Editing the Tag" COM_GETBIBLE_TAG_ERROR_UNIQUE_ALIAS="Another Tag has the same alias." +COM_GETBIBLE_TAG_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Tag has the same alias ." COM_GETBIBLE_TAG_FOUND_BUT_COULD_NOT_BE_REACTIVATED="Tag found, but could not be reactivated." COM_GETBIBLE_TAG_GUID_DESCRIPTION="Globally Unique Identifier" COM_GETBIBLE_TAG_GUID_HINT="Auto Generated" @@ -1782,6 +1792,7 @@ COM_GETBIBLE_TRANSLATION_ENCODING_DESCRIPTION="Enter some encoding" COM_GETBIBLE_TRANSLATION_ENCODING_LABEL="Encoding" COM_GETBIBLE_TRANSLATION_ENCODING_MESSAGE="Error! Please add some encoding here." COM_GETBIBLE_TRANSLATION_ERROR_UNIQUE_ALIAS="Another Translation has the same alias." +COM_GETBIBLE_TRANSLATION_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Translation has the same alias ." COM_GETBIBLE_TRANSLATION_ID="Id" COM_GETBIBLE_TRANSLATION_LANGUAGE_DESCRIPTION="The translation language." COM_GETBIBLE_TRANSLATION_LANGUAGE_HINT="English" @@ -1909,6 +1920,7 @@ COM_GETBIBLE_VERSE_CREATED_DATE_DESC="The date this Verse was created." COM_GETBIBLE_VERSE_CREATED_DATE_LABEL="Created Date" COM_GETBIBLE_VERSE_DETAILS="Details" COM_GETBIBLE_VERSE_ERROR_UNIQUE_ALIAS="Another Verse has the same alias." +COM_GETBIBLE_VERSE_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Verse has the same alias ." COM_GETBIBLE_VERSE_ID="Id" COM_GETBIBLE_VERSE_MODIFIED_BY_DESC="The last user that modified this Verse." COM_GETBIBLE_VERSE_MODIFIED_BY_LABEL="Modified By" diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 8d8a328..96311d4 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; @@ -25,8 +26,8 @@ $counter = 0; ListSelection) : ?>
ListSelection as $ListSelection) : ?> -
-
+
+
-
+
- +
- - -
+ + +
\ 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..56d6b97 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(); + + public function __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) @@ -101,64 +104,54 @@ class GetbibleModelAjax extends ListModel */ public function getVersion($version = null) { - // get the token if set - $token = $this->app_params->get('gitea_token'); - - // only add if token is set - if ($token) + try { - try - { - // load the API details - Factory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token); + // get the repository tags + $tags = GiteaFactory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); + } + catch (DomainException $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + catch (InvalidArgumentException $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + catch (Exception $e) + { + return $this->getTokenForVersion($e->getMessage()); + } + // do we have tags returned + if (isset($tags[0]) && isset($tags[0]->name)) + { + // get the version + $manifest = GetbibleHelper::manifest(); + $local_version = (string) $manifest->version; + $current_version = trim($tags[0]->name, 'vV'); - // get the repository tags - $tags = Factory::_('Gitea.Repository.Tags')->list('getBible', 'joomla-component'); - } - catch (DomainException $e) + // now check if this version is out dated + if ($current_version === $local_version) { - return $this->getTokenForVersion($e->getMessage()); + return ['notice' => '' . Text::_('COM_GETBIBLE_UP_TO_DATE') . '']; } - catch (InvalidArgumentException $e) + else { - return $this->getTokenForVersion($e->getMessage()); - } - catch (Exception $e) - { - return $this->getTokenForVersion($e->getMessage()); - } - // do we have tags returned - if (isset($tags[0]) && isset($tags[0]->name)) - { - // get the version - $manifest = GetbibleHelper::manifest(); - $local_version = (string) $manifest->version; - $current_version = trim($tags[0]->name, 'vV'); - - // now check if this version is out dated - if ($current_version === $local_version) + // check if this is beta version + $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); + $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); + if (($local_array[0] > $current_array[0]) || + ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || + ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) { - return ['notice' => '' . Text::_('COM_GETBIBLE_UP_TO_DATE') . '']; + return ['notice' => '' . Text::_('COM_GETBIBLE_BETA_RELEASE') . '']; } else { - // check if this is beta version - $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); - $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); - if (($local_array[0] > $current_array[0]) || - ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || - ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) - { - return ['notice' => '' . Text::_('COM_GETBIBLE_BETA_RELEASE') . '']; - } - else - { - // download link of the latest version - $download = "https://git.vdm.dev/api/v1/repos/getBible/joomla-component/archive/" . $tags[0]->name . ".zip?access_token=" . $token; + // download link of the latest version + $download = "https://git.vdm.dev/api/v1/repos/getBible/joomla-component/archive/" . $tags[0]->name . ".zip?access_token=" . $token; - return ['notice' => '' . Text::_('COM_GETBIBLE_OUT_OF_DATE') . '! ' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; - } + return ['notice' => '' . Text::_('COM_GETBIBLE_OUT_OF_DATE') . '! ' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; } } } @@ -204,17 +197,11 @@ class GetbibleModelAjax extends ListModel { try { - // get the token if set - $token = $this->app_params->get('gitea_token'); - - // load the API details - Factory::_('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 = $wiki->content; } catch (DomainException $e) { diff --git a/admin/models/book.php b/admin/models/book.php index 8c4f7d5..d8f22a1 100644 --- a/admin/models/book.php +++ b/admin/models/book.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Book Admin Model @@ -69,18 +77,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 +133,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 +160,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 +173,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. @@ -296,13 +304,13 @@ class GetbibleModelBook extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/book.js'; } - + /** * Method to test whether a record can be deleted. * @@ -321,7 +329,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,8 +347,8 @@ class GetbibleModelBook extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -354,28 +362,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +391,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 +415,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 +430,7 @@ class GetbibleModelBook extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -437,10 +445,10 @@ class GetbibleModelBook extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +471,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -479,7 +487,7 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; } @@ -499,10 +507,10 @@ class GetbibleModelBook extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -528,30 +536,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 +596,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 +622,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'); @@ -641,7 +648,7 @@ class GetbibleModelBook extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -654,7 +661,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 +677,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 +765,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 +773,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 +790,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 +806,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 +856,7 @@ class GetbibleModelBook extends AdminModel return true; } - + /** * Method to save the form data. * @@ -861,23 +868,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 +894,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 +902,14 @@ class GetbibleModelBook extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -915,7 +922,6 @@ class GetbibleModelBook extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -941,7 +947,7 @@ class GetbibleModelBook extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/books.php b/admin/models/books.php index b61c155..c6339b2 100644 --- a/admin/models/books.php +++ b/admin/models/books.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Books List Model */ class GetbibleModelBooks extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -59,7 +67,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 +124,7 @@ class GetbibleModelBooks extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -131,12 +139,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,22 +158,22 @@ class GetbibleModelBooks extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -291,7 +299,7 @@ class GetbibleModelBooks extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -306,13 +314,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 +343,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 +361,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..985f9ac 100644 --- a/admin/models/chapter.php +++ b/admin/models/chapter.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Chapter Admin Model @@ -70,18 +78,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 +134,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 +161,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 +174,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. @@ -314,13 +322,13 @@ class GetbibleModelChapter extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/chapter.js'; } - + /** * Method to test whether a record can be deleted. * @@ -339,7 +347,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,8 +365,8 @@ class GetbibleModelChapter extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -372,28 +380,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +409,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 +433,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 +448,7 @@ class GetbibleModelChapter extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -455,10 +463,10 @@ class GetbibleModelChapter extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +489,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -497,7 +505,7 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; } @@ -517,10 +525,10 @@ class GetbibleModelChapter extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -546,30 +554,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 +614,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 +640,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'); @@ -659,7 +666,7 @@ class GetbibleModelChapter extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -672,7 +679,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 +695,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 +783,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 +791,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 +808,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 +824,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 +874,7 @@ class GetbibleModelChapter extends AdminModel return true; } - + /** * Method to save the form data. * @@ -879,23 +886,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 +912,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 +920,14 @@ class GetbibleModelChapter extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -933,7 +940,6 @@ class GetbibleModelChapter extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -959,7 +965,7 @@ class GetbibleModelChapter extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/chapters.php b/admin/models/chapters.php index c1dd668..c4c1dc8 100644 --- a/admin/models/chapters.php +++ b/admin/models/chapters.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Chapters List Model */ class GetbibleModelChapters extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,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 +132,7 @@ class GetbibleModelChapters extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,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,22 +166,22 @@ class GetbibleModelChapters extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -348,7 +356,7 @@ class GetbibleModelChapters extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -363,13 +371,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 +386,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 +423,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 +441,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..0e66772 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'); @@ -30,19 +34,19 @@ class JFormFieldBooksfiltername extends JFormFieldList /** * The booksfiltername field type. * - * @var string + * @var string */ public $type = 'booksfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldBooksfiltername extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter = []; + $_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..3318175 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'); @@ -30,19 +34,19 @@ class JFormFieldBooksfilternr extends JFormFieldList /** * The booksfilternr field type. * - * @var string + * @var string */ public $type = 'booksfilternr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldBooksfilternr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NUMBER') . ' -'); + $_filter = []; + $_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..a1f9f99 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'); @@ -30,19 +34,19 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList /** * The chaptersfilterbooknr field type. * - * @var string + * @var string */ public $type = 'chaptersfilterbooknr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldChaptersfilterbooknr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -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..9956331 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'); @@ -30,19 +34,19 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList /** * The chaptersfilterchapter field type. * - * @var string + * @var string */ public $type = 'chaptersfilterchapter'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldChaptersfilterchapter extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -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..a1065b4 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'); @@ -30,7 +34,7 @@ class JFormFieldLinkers extends JFormFieldList /** * The linkers field type. * - * @var string + * @var string */ public $type = 'linkers'; @@ -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( @@ -70,7 +74,7 @@ class JFormFieldLinkers extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -83,20 +87,20 @@ 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. + if ($user->authorise('linker.create', 'com_getbible') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit linker - if ($user->authorise('linker.edit', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('linker.edit', 'com_getbible') && $app->isClient('administrator')) // 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).'
'; @@ -141,7 +145,7 @@ class JFormFieldLinkers extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/linkersfiltername.php b/admin/models/fields/linkersfiltername.php index 61be658..7948133 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'); @@ -30,19 +34,19 @@ class JFormFieldLinkersfiltername extends JFormFieldList /** * The linkersfiltername field type. * - * @var string + * @var string */ public $type = 'linkersfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldLinkersfiltername extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter = []; + $_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..b711f9c 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'); @@ -30,19 +34,19 @@ class JFormFieldLinkersfilterpublicnotes extends JFormFieldList /** * The linkersfilterpublicnotes field type. * - * @var string + * @var string */ public $type = 'linkersfilterpublicnotes'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldLinkersfilterpublicnotes extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_NOTES') . ' -'); + $_filter = []; + $_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..4103eb8 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'); @@ -30,19 +34,19 @@ class JFormFieldLinkersfilterpublictaggedverses extends JFormFieldList /** * The linkersfilterpublictaggedverses field type. * - * @var string + * @var string */ public $type = 'linkersfilterpublictaggedverses'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldLinkersfilterpublictaggedverses extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_PUBLIC_TAGGED_VERSES') . ' -'); + $_filter = []; + $_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..b3d974a 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'); @@ -30,19 +34,19 @@ class JFormFieldNotesfilteraccess extends JFormFieldList /** * The notesfilteraccess field type. * - * @var string + * @var string */ public $type = 'notesfilteraccess'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldNotesfilteraccess extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter = []; + $_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..f3abb6e 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'); @@ -30,19 +34,19 @@ class JFormFieldNotesfilterbooknr extends JFormFieldList /** * The notesfilterbooknr field type. * - * @var string + * @var string */ public $type = 'notesfilterbooknr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldNotesfilterbooknr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); + $_filter = []; + $_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..a66c9f4 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'); @@ -30,19 +34,19 @@ class JFormFieldNotesfilterchapter extends JFormFieldList /** * The notesfilterchapter field type. * - * @var string + * @var string */ public $type = 'notesfilterchapter'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldNotesfilterchapter extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); + $_filter = []; + $_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..b2d8d34 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'); @@ -30,19 +34,19 @@ class JFormFieldNotesfilterverse extends JFormFieldList /** * The notesfilterverse field type. * - * @var string + * @var string */ public $type = 'notesfilterverse'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldNotesfilterverse extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); + $_filter = []; + $_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..a1107e0 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'); @@ -30,19 +34,19 @@ class JFormFieldOpenaimessagesfilterrole extends JFormFieldList /** * The openaimessagesfilterrole field type. * - * @var string + * @var string */ public $type = 'openaimessagesfilterrole'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldOpenaimessagesfilterrole extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ROLE') . ' -'); + $_filter = []; + $_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..50a7fed 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'); @@ -30,19 +34,19 @@ class JFormFieldOpenaimessagesfiltersource extends JFormFieldList /** * The openaimessagesfiltersource field type. * - * @var string + * @var string */ public $type = 'openaimessagesfiltersource'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldOpenaimessagesfiltersource extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_SOURCE') . ' -'); + $_filter = []; + $_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..459f1da 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'); @@ -30,14 +34,14 @@ class JFormFieldOpenairesponses extends JFormFieldList /** * The openairesponses field type. * - * @var string + * @var string */ public $type = 'openairesponses'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/openairesponsesfilterresponseid.php b/admin/models/fields/openairesponsesfilterresponseid.php index 5e19576..3e65aec 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'); @@ -30,19 +34,19 @@ class JFormFieldOpenairesponsesfilterresponseid extends JFormFieldList /** * The openairesponsesfilterresponseid field type. * - * @var string + * @var string */ public $type = 'openairesponsesfilterresponseid'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldOpenairesponsesfilterresponseid extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_ID') . ' -'); + $_filter = []; + $_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..deefeed 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'); @@ -30,19 +34,19 @@ class JFormFieldOpenairesponsesfilterresponsemodel extends JFormFieldList /** * The openairesponsesfilterresponsemodel field type. * - * @var string + * @var string */ public $type = 'openairesponsesfilterresponsemodel'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldOpenairesponsesfilterresponsemodel extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_RESPONSE_MODEL') . ' -'); + $_filter = []; + $_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..fb7ff56 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'); @@ -30,19 +34,19 @@ class JFormFieldPasswordsfiltername extends JFormFieldList /** * The passwordsfiltername field type. * - * @var string + * @var string */ public $type = 'passwordsfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldPasswordsfiltername extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter = []; + $_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..0d948b9 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'); @@ -30,14 +34,14 @@ class JFormFieldPrompts extends JFormFieldList /** * The prompts field type. * - * @var string + * @var string */ public $type = 'prompts'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/promptsfiltercachebehaviour.php b/admin/models/fields/promptsfiltercachebehaviour.php index c3796fc..1b2afd8 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'); @@ -30,19 +34,19 @@ class JFormFieldPromptsfiltercachebehaviour extends JFormFieldList /** * The promptsfiltercachebehaviour field type. * - * @var string + * @var string */ public $type = 'promptsfiltercachebehaviour'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldPromptsfiltercachebehaviour extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CACHE_BEHAVIOUR') . ' -'); + $_filter = []; + $_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..dd4c520 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'); @@ -30,19 +34,19 @@ class JFormFieldPromptsfiltermodel extends JFormFieldList /** * The promptsfiltermodel field type. * - * @var string + * @var string */ public $type = 'promptsfiltermodel'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldPromptsfiltermodel extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_MODEL') . ' -'); + $_filter = []; + $_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..66969b8 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'); @@ -30,19 +34,19 @@ class JFormFieldPromptsfiltername extends JFormFieldList /** * The promptsfiltername field type. * - * @var string + * @var string */ public $type = 'promptsfiltername'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldPromptsfiltername extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_NAME') . ' -'); + $_filter = []; + $_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..e7d400b 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'); @@ -30,7 +34,7 @@ class JFormFieldTagers extends JFormFieldList /** * The tagers field type. * - * @var string + * @var string */ public $type = 'tagers'; @@ -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( @@ -70,7 +74,7 @@ class JFormFieldTagers extends JFormFieldList $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; // get the return value. - $_uri = (string) JUri::getInstance(); + $_uri = (string) \Joomla\CMS\Uri\Uri::getInstance(); $_return = urlencode(base64_encode($_uri)); // load return value. $ref .= '&return=' . $_return; @@ -83,20 +87,20 @@ 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. + if ($user->authorise('tag.create', 'com_getbible') && $app->isClient('administrator')) // TODO for now only in admin area. { // build Create button - $button[] = ' '; } // only add if user allowed to edit tag - if ($user->authorise('tag.edit', 'com_getbible') && $app->isAdmin()) // TODO for now only in admin area. + if ($user->authorise('tag.edit', 'com_getbible') && $app->isClient('administrator')) // 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).'
'; @@ -141,7 +145,7 @@ class JFormFieldTagers extends JFormFieldList /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/taggedversesfilteraccess.php b/admin/models/fields/taggedversesfilteraccess.php index 98be0bd..a1dbc5e 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'); @@ -30,19 +34,19 @@ class JFormFieldTaggedversesfilteraccess extends JFormFieldList /** * The taggedversesfilteraccess field type. * - * @var string + * @var string */ public $type = 'taggedversesfilteraccess'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldTaggedversesfilteraccess extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter = []; + $_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..76f9041 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'); @@ -30,19 +34,19 @@ class JFormFieldTaggedversesfilterbooknr extends JFormFieldList /** * The taggedversesfilterbooknr field type. * - * @var string + * @var string */ public $type = 'taggedversesfilterbooknr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldTaggedversesfilterbooknr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -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..5778be8 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'); @@ -30,19 +34,19 @@ class JFormFieldTaggedversesfilterchapter extends JFormFieldList /** * The taggedversesfilterchapter field type. * - * @var string + * @var string */ public $type = 'taggedversesfilterchapter'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldTaggedversesfilterchapter extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -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..beec684 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'); @@ -30,19 +34,19 @@ class JFormFieldTaggedversesfilterverse extends JFormFieldList /** * The taggedversesfilterverse field type. * - * @var string + * @var string */ public $type = 'taggedversesfilterverse'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,7 +60,7 @@ class JFormFieldTaggedversesfilterverse extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); + $_filter = []; if ($_results) { @@ -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..ff64424 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'); @@ -30,19 +34,19 @@ class JFormFieldTagsfilteraccess extends JFormFieldList /** * The tagsfilteraccess field type. * - * @var string + * @var string */ public $type = 'tagsfilteraccess'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldTagsfilteraccess extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_ACCESS') . ' -'); + $_filter = []; + $_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..45d4c6f 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'); @@ -30,14 +34,14 @@ class JFormFieldTargettranslations extends JFormFieldList /** * The targettranslations field type. * - * @var string + * @var string */ public $type = 'targettranslations'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/translations.php b/admin/models/fields/translations.php index 5075914..de7db3d 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'); @@ -30,14 +34,14 @@ class JFormFieldTranslations extends JFormFieldList /** * The translations field type. * - * @var string + * @var string */ public $type = 'translations'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { diff --git a/admin/models/fields/translationsfilterdirection.php b/admin/models/fields/translationsfilterdirection.php index 23c3d5c..f146152 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'); @@ -30,19 +34,19 @@ class JFormFieldTranslationsfilterdirection extends JFormFieldList /** * The translationsfilterdirection field type. * - * @var string + * @var string */ public $type = 'translationsfilterdirection'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldTranslationsfilterdirection extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_DIRECTIONAL') . ' -'); + $_filter = []; + $_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..5fff420 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'); @@ -30,19 +34,19 @@ class JFormFieldVersesfilterbooknr extends JFormFieldList /** * The versesfilterbooknr field type. * - * @var string + * @var string */ public $type = 'versesfilterbooknr'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldVersesfilterbooknr extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_BOOK_NUMBER') . ' -'); + $_filter = []; + $_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..ebb3e42 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'); @@ -30,19 +34,19 @@ class JFormFieldVersesfilterchapter extends JFormFieldList /** * The versesfilterchapter field type. * - * @var string + * @var string */ public $type = 'versesfilterchapter'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldVersesfilterchapter extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_CHAPTER') . ' -'); + $_filter = []; + $_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..11e96a3 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'); @@ -30,19 +34,19 @@ class JFormFieldVersesfilterverse extends JFormFieldList /** * The versesfilterverse field type. * - * @var string + * @var string */ public $type = 'versesfilterverse'; /** * Method to get a list of options for a list input. * - * @return array An array of JHtml options. + * @return array An array of Html options. */ protected function getOptions() { // Get a db connection. - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -56,8 +60,8 @@ class JFormFieldVersesfilterverse extends JFormFieldList $db->setQuery($query); $_results = $db->loadColumn(); - $_filter = array(); - $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_GETBIBLE_FILTER_SELECT_VERSE') . ' -'); + $_filter = []; + $_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/forms/book.xml b/admin/models/forms/book.xml index 637d005..77b9f93 100644 --- a/admin/models/forms/book.xml +++ b/admin/models/forms/book.xml @@ -159,7 +159,7 @@ message="COM_GETBIBLE_BOOK_SHA_MESSAGE" /> - +
diff --git a/admin/models/forms/chapter.xml b/admin/models/forms/chapter.xml index 04ebb2a..db6554a 100644 --- a/admin/models/forms/chapter.xml +++ b/admin/models/forms/chapter.xml @@ -171,7 +171,7 @@ message="COM_GETBIBLE_CHAPTER_SHA_MESSAGE" />
- +
diff --git a/admin/models/forms/linker.xml b/admin/models/forms/linker.xml index 6a555d1..84ba4c0 100644 --- a/admin/models/forms/linker.xml +++ b/admin/models/forms/linker.xml @@ -151,7 +151,7 @@ COM_GETBIBLE_LINKER_NO
- +
diff --git a/admin/models/forms/note.xml b/admin/models/forms/note.xml index 637b0f6..dc8598a 100644 --- a/admin/models/forms/note.xml +++ b/admin/models/forms/note.xml @@ -175,7 +175,7 @@ step="1" />
- +
diff --git a/admin/models/forms/open_ai_message.xml b/admin/models/forms/open_ai_message.xml index 8b344ae..e318a4a 100644 --- a/admin/models/forms/open_ai_message.xml +++ b/admin/models/forms/open_ai_message.xml @@ -187,7 +187,7 @@ step="1" />
- +
diff --git a/admin/models/forms/open_ai_response.xml b/admin/models/forms/open_ai_response.xml index d321225..b06069f 100644 --- a/admin/models/forms/open_ai_response.xml +++ b/admin/models/forms/open_ai_response.xml @@ -394,7 +394,7 @@ COM_GETBIBLE_OPEN_AI_RESPONSE_GPT35TURBO16K0613
- +
diff --git a/admin/models/forms/password.xml b/admin/models/forms/password.xml index 9617f3e..0d12a9f 100644 --- a/admin/models/forms/password.xml +++ b/admin/models/forms/password.xml @@ -149,7 +149,7 @@ autocomplete="off" />
- +
diff --git a/admin/models/forms/prompt.xml b/admin/models/forms/prompt.xml index 317ad61..9ad512f 100644 --- a/admin/models/forms/prompt.xml +++ b/admin/models/forms/prompt.xml @@ -546,7 +546,7 @@
- +
diff --git a/admin/models/forms/tag.xml b/admin/models/forms/tag.xml index a65e7f4..3c4e309 100644 --- a/admin/models/forms/tag.xml +++ b/admin/models/forms/tag.xml @@ -153,7 +153,7 @@ hint="COM_GETBIBLE_TAG_DESCRIPTION_HINT" />
- +
diff --git a/admin/models/forms/tagged_verse.xml b/admin/models/forms/tagged_verse.xml index c19c1e3..e27b9c3 100644 --- a/admin/models/forms/tagged_verse.xml +++ b/admin/models/forms/tagged_verse.xml @@ -184,7 +184,7 @@ step="1" />
- +
diff --git a/admin/models/forms/translation.xml b/admin/models/forms/translation.xml index c253374..198987b 100644 --- a/admin/models/forms/translation.xml +++ b/admin/models/forms/translation.xml @@ -390,7 +390,7 @@ hint="COM_GETBIBLE_TRANSLATION_DISTRIBUTION_ABBREVIATION_HINT" />
- +
diff --git a/admin/models/forms/verse.xml b/admin/models/forms/verse.xml index 19d7c39..52a981f 100644 --- a/admin/models/forms/verse.xml +++ b/admin/models/forms/verse.xml @@ -184,7 +184,7 @@ hint="COM_GETBIBLE_VERSE_NAME_HINT" />
- +
diff --git a/admin/models/getbible.php b/admin/models/getbible.php index 49b49d8..2be8c10 100644 --- a/admin/models/getbible.php +++ b/admin/models/getbible.php @@ -18,9 +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\Uri\Uri; +use Joomla\CMS\Session\Session; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible List Model @@ -30,9 +39,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 +109,7 @@ class GetbibleModelGetbible extends ListModel foreach($viewGroups as $group => $views) { $i = 0; - if (GetbibleHelper::checkArray($views)) + if (UtilitiesArrayHelper::check($views)) { foreach($views as $view) { @@ -112,11 +121,11 @@ class GetbibleModelGetbible extends ListModel if (count($dwd) == 3) { list($type, $name, $url) = $dwd; - $viewName = $name; - $alt = $name; - $url = $url; - $image = $name . '.' . $type; - $name = 'COM_GETBIBLE_DASHBOARD_' . GetbibleHelper::safeString($name,'U'); + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U'); } } // internal views @@ -138,11 +147,11 @@ class GetbibleModelGetbible extends ListModel switch($action) { case 'add': - $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'; - $add = true; + $url = 'index.php?option=com_getbible&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_GETBIBLE_DASHBOARD_'.StringHelper::safe($name,'U').'_ADD'; + $add = true; break; default: // check for new convention (more stable) @@ -155,34 +164,34 @@ class GetbibleModelGetbible extends ListModel { $extension = 'com_getbible.' . $name; } - $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'); + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U') . '_' . StringHelper::safe($action,'U'); break; } } else { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_getbible&view=' . $name; - $image = $name . '.' . $type; - $name = 'COM_GETBIBLE_DASHBOARD_' . GetbibleHelper::safeString($name,'U'); - $hover = false; + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_getbible&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_GETBIBLE_DASHBOARD_' . StringHelper::safe($name,'U'); + $hover = false; } } else { - $viewName = $view; - $alt = $view; - $url = 'index.php?option=com_getbible&view=' . $view; - $image = $view . '.png'; - $name = ucwords($view).'

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

'; + $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 +199,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) { @@ -212,64 +221,64 @@ class GetbibleModelGetbible extends ListModel // set main access controllers if ($accessDashboard_add) { - $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_getbible'); + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_getbible'); } if ($accessDashboard_list) { $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) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (GetbibleHelper::checkString($accessTo)) + elseif (StringHelper::check($accessTo)) { // check access if($user->authorise($accessTo, 'com_getbible') && $dashboard_list) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } - elseif (GetbibleHelper::checkString($accessAdd)) + elseif (StringHelper::check($accessAdd)) { // check access if($user->authorise($accessAdd, 'com_getbible') && $dashboard_add) { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } } else { - $icons[$group][$i] = new StdClass; - $icons[$group][$i]->url = $url; - $icons[$group][$i]->name = $name; - $icons[$group][$i]->image = $image; - $icons[$group][$i]->alt = $alt; + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; } $i++; } @@ -286,18 +295,17 @@ class GetbibleModelGetbible extends ListModel public function getWiki() { // 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(); + $call_url = Uri::base() . 'index.php?option=com_getbible&task=ajax.getWiki&format=json&raw=true&' . Session::getFormToken() . '=1&name=Home'; + $document = Factory::getDocument(); $document->addScriptDeclaration(' function getWikiPage(){ - fetch("' . $call_url . '").then((response) => { if (response.ok) { return response.json(); } }).then((result) => { if (typeof result.page !== "undefined") { - document.getElementById("wiki-md").innerHTML = result.page; + document.getElementById("wiki-md").innerHTML = marked.parse(result.page); } else if (typeof result.error !== "undefined") { document.getElementById("wiki-md-error").innerHTML = result.error } @@ -305,34 +313,44 @@ 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->addScript(JURI::root() . "media/com_getbible/js/marked.js"); + $document = Factory::getDocument(); + Html::_('script', "media/com_getbible/js/marked.js", ['version' => 'auto']); $document->addScriptDeclaration(' - var token = "'.JSession::getFormToken().'"; + var token = "' . Session::getFormToken() . '"; var noticeboard = "https://vdm.bz/getbible-noticeboard-md"; - jQuery(document).ready(function () { - jQuery.get(noticeboard) - .success(function(board) { + document.addEventListener("DOMContentLoaded", function() { + fetch(noticeboard) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); + }) + .then(board => { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked.parse(board)); - getIS(1,board).done(function(result) { - if (result){ - jQuery("#cpanel_tabTabs a").each(function() { - if (this.href.indexOf("#vast_development_method") >= 0 || this.href.indexOf("#notice_board") >= 0) { - var textVDM = jQuery(this).text(); - jQuery(this).html("1 "+textVDM); - jQuery(this).attr("id","vdm-new-notice"); - jQuery("#vdm-new-notice").click(function() { - getIS(2,board).done(function(result) { - if (result) { - jQuery(".vdm-new-notice").fadeOut(500); + document.getElementById("noticeboard-md").innerHTML = marked.parse(board); + getIS(1, board) + .then(result => { + if (result) { + document.querySelectorAll("#cpanel_tabTabs a").forEach(link => { + if (link.href.includes("#vast_development_method") || link.href.includes("#notice_board")) { + var textVDM = link.textContent; + link.innerHTML = "1 " + textVDM; + link.id = "vdm-new-notice"; + document.getElementById("vdm-new-notice").addEventListener("click", () => { + getIS(2, board) + .then(result => { + if (result) { + document.querySelectorAll(".vdm-new-notice").forEach(element => { + element.style.opacity = 0; + }); } }); }); @@ -341,64 +359,78 @@ class GetbibleModelGetbible extends ListModel } }); } else { - jQuery("#noticeboard-md").html("'.JText::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; } }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#noticeboard-md").html("'.JText::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); + .catch(error => { + console.error("There was an error!", error); + document.getElementById("noticeboard-md").innerHTML = "'.Text::_('COM_GETBIBLE_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATER').'."; }); }); + // to check is READ/NEW - function getIS(type,notice){ - if(type == 1){ - var getUrl = "index.php?option=com_getbible&task=ajax.isNew&format=json&raw=true"; - } else if (type == 2) { - var getUrl = "index.php?option=com_getbible&task=ajax.isRead&format=json&raw=true"; - } - if(token.length > 0 && notice.length){ - var request = token+"=1¬ice="+notice; + function getIS(type, notice) { + let getUrl = ""; + if (type === 1) { + getUrl = "index.php?option=com_getbible&task=ajax.isNew&format=json&raw=true"; + } else if (type === 2) { + getUrl = "index.php?option=com_getbible&task=ajax.isRead&format=json&raw=true"; } - return jQuery.ajax({ - type: "POST", - url: getUrl, - dataType: "json", - data: request, - jsonp: false - }); + let request = new URLSearchParams(); + if (token.length > 0 && notice.length) { + request.append(token, "1"); + request.append("notice", notice); + } + return fetch(getUrl, { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" + }, + body: request + }).then(response => response.json()); } -// nice little dot trick :) -jQuery(document).ready( function($) { - var x=0; - setInterval(function() { - var dots = ""; - x++; - for (var y=0; y < x%8; y++) { - dots+="."; - } - $(".loading-dots").text(dots); - } , 500); +document.addEventListener("DOMContentLoaded", function() { + document.querySelectorAll(".loading-dots").forEach(function(loading_dots) { + let x = 0; + let intervalId = setInterval(function() { + if (!loading_dots.classList.contains("loading-dots")) { + clearInterval(intervalId); + return; + } + let dots = ".".repeat(x % 8); + loading_dots.textContent = dots; + x++; + }, 500); + }); });'); - return '
'.JText::_('COM_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 () { - jQuery.get(getreadme) - .success(function(readme) { - jQuery("#readme-md").html(marked.parse(readme)); + var getreadme = "'. Uri::root() . 'administrator/components/com_getbible/README.txt"; + document.addEventListener("DOMContentLoaded", function () { + fetch(getreadme) + .then(response => { + if (!response.ok) { + throw new Error("Network response was not ok"); + } + return response.text(); }) - .error(function(jqXHR, textStatus, errorThrown) { - jQuery("#readme-md").html("'.JText::_('COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATTER').'"); + .then(readme => { + document.getElementById("readme-md").innerHTML = marked.parse(readme); + }) + .catch(error => { + console.error("There has been a problem with your fetch operation:", error); + document.getElementById("readme-md").innerHTML = "'.Text::_('COM_GETBIBLE_PLEASE_CHECK_AGAIN_LATER').'."; }); });'); - return '
'.JText::_('COM_GETBIBLE_THE_README_IS_LOADING').'..
'; + return '
'.Text::_('COM_GETBIBLE_THE_README_IS_LOADING').'..
'; } /** @@ -410,8 +442,8 @@ jQuery(document).ready( function($) { public function getVersion() { // 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(); + $call_url = Uri::base() . 'index.php?option=com_getbible&task=ajax.getVersion&format=json&raw=true&' . Session::getFormToken() . '=1&version=1'; + $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..6ee3753 100644 --- a/admin/models/linker.php +++ b/admin/models/linker.php @@ -18,10 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; @@ -70,18 +80,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 +136,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 +196,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 +218,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 +247,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 +263,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 +315,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 +337,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 +366,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 +382,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 +447,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 +482,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 +509,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 +522,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. @@ -656,13 +666,13 @@ class GetbibleModelLinker extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/linker.js'; } - + /** * Method to test whether a record can be deleted. * @@ -681,7 +691,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,8 +709,8 @@ class GetbibleModelLinker extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -714,28 +724,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +753,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 +777,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 +792,7 @@ class GetbibleModelLinker extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -797,10 +807,10 @@ class GetbibleModelLinker extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +833,7 @@ class GetbibleModelLinker extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -839,7 +849,7 @@ class GetbibleModelLinker extends AdminModel { return false; } - + return true; } @@ -859,10 +869,10 @@ class GetbibleModelLinker extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -888,30 +898,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 +958,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 +984,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'); @@ -1001,7 +1010,7 @@ class GetbibleModelLinker extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1014,7 +1023,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 +1039,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 +1127,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 +1135,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 +1152,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 +1168,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 +1218,7 @@ class GetbibleModelLinker extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1221,15 +1230,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 +1257,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 +1271,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 +1279,14 @@ class GetbibleModelLinker extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1290,7 +1299,6 @@ class GetbibleModelLinker extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1316,7 +1324,7 @@ class GetbibleModelLinker extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/linkers.php b/admin/models/linkers.php index 2d607a2..ce2fb45 100644 --- a/admin/models/linkers.php +++ b/admin/models/linkers.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Linkers List Model */ class GetbibleModelLinkers extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -59,7 +67,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 +124,7 @@ class GetbibleModelLinkers extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -131,12 +139,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 +160,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 +171,7 @@ class GetbibleModelLinkers extends ListModel } } - + // return items return $items; } @@ -183,7 +191,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,25 +204,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -333,7 +341,7 @@ class GetbibleModelLinkers extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -348,13 +356,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 +385,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 +403,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..2f17b69 100644 --- a/admin/models/note.php +++ b/admin/models/note.php @@ -18,12 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Note Admin Model @@ -73,18 +81,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 +137,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 +164,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 +177,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. @@ -350,13 +358,13 @@ class GetbibleModelNote extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/note.js'; } - + /** * Method to test whether a record can be deleted. * @@ -375,7 +383,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,8 +401,8 @@ class GetbibleModelNote extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -408,28 +416,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +445,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 +469,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 +484,7 @@ class GetbibleModelNote extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -491,10 +499,10 @@ class GetbibleModelNote extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +525,7 @@ class GetbibleModelNote extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -533,7 +541,7 @@ class GetbibleModelNote extends AdminModel { return false; } - + return true; } @@ -553,10 +561,10 @@ class GetbibleModelNote extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -582,30 +590,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 +650,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 +676,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'); @@ -695,7 +702,7 @@ class GetbibleModelNote extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -708,7 +715,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 +731,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 +813,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 +821,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 +838,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 +854,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 +904,7 @@ class GetbibleModelNote extends AdminModel return true; } - + /** * Method to save the form data. * @@ -909,15 +916,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 +943,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 +957,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 +965,14 @@ class GetbibleModelNote extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -978,7 +985,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..9e834d9 100644 --- a/admin/models/notes.php +++ b/admin/models/notes.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Notes List Model */ class GetbibleModelNotes extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,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 +132,7 @@ class GetbibleModelNotes extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,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 +169,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 +178,7 @@ class GetbibleModelNotes extends ListModel } } - + // return items return $items; } @@ -190,25 +198,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -352,7 +360,7 @@ class GetbibleModelNotes extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -385,13 +393,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 +411,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..6ed5782 100644 --- a/admin/models/open_ai_message.php +++ b/admin/models/open_ai_message.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Open_ai_message Admin Model @@ -74,18 +82,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 +138,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 +165,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 +178,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. @@ -355,13 +363,13 @@ class GetbibleModelOpen_ai_message extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/open_ai_message.js'; } - + /** * Method to test whether a record can be deleted. * @@ -380,7 +388,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,8 +406,8 @@ class GetbibleModelOpen_ai_message extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -413,28 +421,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +450,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 +474,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 +489,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. @@ -496,10 +504,10 @@ class GetbibleModelOpen_ai_message extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +530,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -538,7 +546,7 @@ class GetbibleModelOpen_ai_message extends AdminModel { return false; } - + return true; } @@ -558,10 +566,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 +595,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 +655,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 +681,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'); @@ -700,7 +707,7 @@ class GetbibleModelOpen_ai_message extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -713,7 +720,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 +736,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 +824,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 +832,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 +849,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 +865,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 +915,7 @@ class GetbibleModelOpen_ai_message extends AdminModel return true; } - + /** * Method to save the form data. * @@ -920,23 +927,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 +953,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 +961,14 @@ class GetbibleModelOpen_ai_message extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -974,7 +981,6 @@ class GetbibleModelOpen_ai_message extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1000,7 +1006,7 @@ class GetbibleModelOpen_ai_message extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/open_ai_messages.php b/admin/models/open_ai_messages.php index 2023545..ec804e6 100644 --- a/admin/models/open_ai_messages.php +++ b/admin/models/open_ai_messages.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * 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'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,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 +132,7 @@ class GetbibleModelOpen_ai_messages extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,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 +168,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 +179,7 @@ class GetbibleModelOpen_ai_messages extends ListModel } } - + // return items return $items; } @@ -193,7 +201,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,25 +214,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -368,7 +376,7 @@ class GetbibleModelOpen_ai_messages extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -383,13 +391,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 +421,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 +439,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..f16544b 100644 --- a/admin/models/open_ai_response.php +++ b/admin/models/open_ai_response.php @@ -18,10 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper; /** * Getbible Open_ai_response Admin Model @@ -100,18 +110,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 +164,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 +233,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 +254,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 +287,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 +300,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 +319,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 +346,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 +359,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. @@ -803,13 +813,13 @@ class GetbibleModelOpen_ai_response extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/open_ai_response.js'; } - + /** * Method to test whether a record can be deleted. * @@ -828,7 +838,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,8 +856,8 @@ class GetbibleModelOpen_ai_response extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -861,28 +871,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +900,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 +924,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 +939,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. @@ -944,10 +954,10 @@ class GetbibleModelOpen_ai_response extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +980,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -986,7 +996,7 @@ class GetbibleModelOpen_ai_response extends AdminModel { return false; } - + return true; } @@ -1006,10 +1016,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 +1045,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 +1105,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 +1131,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'); @@ -1148,7 +1157,7 @@ class GetbibleModelOpen_ai_response extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1161,7 +1170,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 +1186,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 +1274,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 +1282,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 +1299,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 +1315,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 +1365,7 @@ class GetbibleModelOpen_ai_response extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1368,23 +1377,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 +1403,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 +1411,14 @@ class GetbibleModelOpen_ai_response extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1422,7 +1431,6 @@ class GetbibleModelOpen_ai_response extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1448,7 +1456,7 @@ class GetbibleModelOpen_ai_response extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/open_ai_responses.php b/admin/models/open_ai_responses.php index bc2fe45..8ca2712 100644 --- a/admin/models/open_ai_responses.php +++ b/admin/models/open_ai_responses.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * 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'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -61,7 +69,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 +140,7 @@ class GetbibleModelOpen_ai_responses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -147,12 +155,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,22 +174,22 @@ class GetbibleModelOpen_ai_responses extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -304,7 +312,7 @@ class GetbibleModelOpen_ai_responses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -319,13 +327,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 +358,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 +376,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..caa3edd 100644 --- a/admin/models/password.php +++ b/admin/models/password.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; @@ -70,18 +78,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 +134,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 +161,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 +174,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 +305,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 @@ -335,13 +343,13 @@ class GetbibleModelPassword extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/password.js'; } - + /** * Method to test whether a record can be deleted. * @@ -360,7 +368,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,8 +386,8 @@ class GetbibleModelPassword extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -393,28 +401,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +430,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 +454,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 +469,7 @@ class GetbibleModelPassword extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -476,10 +484,10 @@ class GetbibleModelPassword extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +510,7 @@ class GetbibleModelPassword extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -518,7 +526,7 @@ class GetbibleModelPassword extends AdminModel { return false; } - + return true; } @@ -538,10 +546,10 @@ class GetbibleModelPassword extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -567,30 +575,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 +635,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 +661,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'); @@ -680,7 +687,7 @@ class GetbibleModelPassword extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -693,7 +700,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 +716,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 +804,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 +812,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 +829,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 +845,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 +895,7 @@ class GetbibleModelPassword extends AdminModel return true; } - + /** * Method to save the form data. * @@ -900,15 +907,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 +934,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 +948,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 +956,14 @@ class GetbibleModelPassword extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -969,7 +976,6 @@ class GetbibleModelPassword extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -995,7 +1001,7 @@ class GetbibleModelPassword extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/passwords.php b/admin/models/passwords.php index 2eadcbb..b78a87b 100644 --- a/admin/models/passwords.php +++ b/admin/models/passwords.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Passwords List Model */ class GetbibleModelPasswords extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -58,7 +66,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 +116,7 @@ class GetbibleModelPasswords extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -123,12 +131,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,22 +150,22 @@ class GetbibleModelPasswords extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -263,7 +271,7 @@ class GetbibleModelPasswords extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -278,13 +286,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 +314,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 +332,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..04da724 100644 --- a/admin/models/prompt.php +++ b/admin/models/prompt.php @@ -18,12 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Prompt Admin Model @@ -115,18 +123,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 +187,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 +214,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 +227,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. @@ -711,13 +719,13 @@ class GetbibleModelPrompt extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/prompt.js'; } - + /** * Method to test whether a record can be deleted. * @@ -736,7 +744,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,8 +762,8 @@ class GetbibleModelPrompt extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -769,28 +777,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +806,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 +830,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 +845,7 @@ class GetbibleModelPrompt extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -852,10 +860,10 @@ class GetbibleModelPrompt extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +886,7 @@ class GetbibleModelPrompt extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -894,7 +902,7 @@ class GetbibleModelPrompt extends AdminModel { return false; } - + return true; } @@ -914,10 +922,10 @@ class GetbibleModelPrompt extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -943,30 +951,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 +1011,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 +1037,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'); @@ -1056,7 +1063,7 @@ class GetbibleModelPrompt extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -1069,7 +1076,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 +1092,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 +1180,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 +1188,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 +1205,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 +1221,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 +1271,7 @@ class GetbibleModelPrompt extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1276,15 +1283,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 +1321,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 +1340,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 +1348,14 @@ class GetbibleModelPrompt extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1361,7 +1368,6 @@ class GetbibleModelPrompt extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1387,7 +1393,7 @@ class GetbibleModelPrompt extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/prompts.php b/admin/models/prompts.php index 84776e3..e06bef5 100644 --- a/admin/models/prompts.php +++ b/admin/models/prompts.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Prompts List Model */ class GetbibleModelPrompts extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -61,7 +69,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 +140,7 @@ class GetbibleModelPrompts extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -147,12 +155,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 +176,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 +189,7 @@ class GetbibleModelPrompts extends ListModel } } - + // return items return $items; } @@ -202,7 +210,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 +224,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,25 +244,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -394,7 +402,7 @@ class GetbibleModelPrompts extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -409,13 +417,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 +448,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 +466,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..2d4e665 100644 --- a/admin/models/tag.php +++ b/admin/models/tag.php @@ -18,12 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Tag Admin Model @@ -71,18 +79,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 +135,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 +162,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 +175,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. @@ -314,13 +322,13 @@ class GetbibleModelTag extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/tag.js'; } - + /** * Method to test whether a record can be deleted. * @@ -339,7 +347,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,8 +365,8 @@ class GetbibleModelTag extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -372,28 +380,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +409,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 +433,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 +448,7 @@ class GetbibleModelTag extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -455,10 +463,10 @@ class GetbibleModelTag extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +489,7 @@ class GetbibleModelTag extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -497,7 +505,7 @@ class GetbibleModelTag extends AdminModel { return false; } - + return true; } @@ -517,10 +525,10 @@ class GetbibleModelTag extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -546,30 +554,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 +614,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 +640,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'); @@ -659,7 +666,7 @@ class GetbibleModelTag extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -672,7 +679,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 +695,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 +783,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 +791,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 +808,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 +824,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 +874,7 @@ class GetbibleModelTag extends AdminModel return true; } - + /** * Method to save the form data. * @@ -879,15 +886,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 +913,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 +927,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 +935,14 @@ class GetbibleModelTag extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -948,7 +955,6 @@ class GetbibleModelTag extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -974,7 +980,7 @@ class GetbibleModelTag extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/tagged_verse.php b/admin/models/tagged_verse.php index 12762a6..87306ec 100644 --- a/admin/models/tagged_verse.php +++ b/admin/models/tagged_verse.php @@ -18,12 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; use VDM\Joomla\Utilities\GuidHelper; use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Tagged_verse Admin Model @@ -74,18 +82,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 +138,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 +165,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 +178,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. @@ -368,13 +376,13 @@ class GetbibleModelTagged_verse extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/tagged_verse.js'; } - + /** * Method to test whether a record can be deleted. * @@ -393,7 +401,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,8 +419,8 @@ class GetbibleModelTagged_verse extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -426,28 +434,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +463,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 +487,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 +502,7 @@ class GetbibleModelTagged_verse extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -509,10 +517,10 @@ class GetbibleModelTagged_verse extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +543,7 @@ class GetbibleModelTagged_verse extends AdminModel { return array('guid'); } - + /** * Method to delete one or more records. * @@ -551,7 +559,7 @@ class GetbibleModelTagged_verse extends AdminModel { return false; } - + return true; } @@ -571,10 +579,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 +608,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 +668,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 +694,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'); @@ -713,7 +720,7 @@ class GetbibleModelTagged_verse extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -726,7 +733,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 +749,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 +831,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 +839,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 +856,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 +872,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 +922,7 @@ class GetbibleModelTagged_verse extends AdminModel return true; } - + /** * Method to save the form data. * @@ -927,15 +934,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 +961,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 +975,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 +983,14 @@ class GetbibleModelTagged_verse extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -996,7 +1003,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..2a44da5 100644 --- a/admin/models/tagged_verses.php +++ b/admin/models/tagged_verses.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Tagged_verses List Model */ class GetbibleModelTagged_verses extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -62,7 +70,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 +148,7 @@ class GetbibleModelTagged_verses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -155,12 +163,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 +185,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 +194,7 @@ class GetbibleModelTagged_verses extends ListModel } } - + // return items return $items; } @@ -206,25 +214,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -502,7 +510,7 @@ class GetbibleModelTagged_verses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -520,25 +528,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 +554,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 +589,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 +607,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..e1048e2 100644 --- a/admin/models/tags.php +++ b/admin/models/tags.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Tags List Model */ class GetbibleModelTags extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -58,7 +66,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 +116,7 @@ class GetbibleModelTags extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -123,12 +131,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 +152,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 +161,7 @@ class GetbibleModelTags extends ListModel } } - + // return items return $items; } @@ -173,25 +181,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -284,7 +292,7 @@ class GetbibleModelTags extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -315,13 +323,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 +341,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..7c68bb9 100644 --- a/admin/models/translation.php +++ b/admin/models/translation.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Translation Admin Model @@ -84,18 +92,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 +156,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 +183,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 +196,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. @@ -543,13 +551,13 @@ class GetbibleModelTranslation extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/translation.js'; } - + /** * Method to test whether a record can be deleted. * @@ -568,7 +576,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,8 +594,8 @@ class GetbibleModelTranslation extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -601,28 +609,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +638,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 +662,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 +677,7 @@ class GetbibleModelTranslation extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -684,10 +692,10 @@ class GetbibleModelTranslation extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +718,7 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -726,7 +734,7 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + return true; } @@ -746,10 +754,10 @@ class GetbibleModelTranslation extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -775,30 +783,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 +843,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 +869,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'); @@ -888,7 +895,7 @@ class GetbibleModelTranslation extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -901,7 +908,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 +924,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 +1012,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 +1020,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 +1037,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 +1053,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 +1103,7 @@ class GetbibleModelTranslation extends AdminModel return true; } - + /** * Method to save the form data. * @@ -1108,15 +1115,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 +1138,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 +1157,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 +1165,14 @@ class GetbibleModelTranslation extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -1178,7 +1185,6 @@ class GetbibleModelTranslation extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -1204,7 +1210,7 @@ class GetbibleModelTranslation extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/translations.php b/admin/models/translations.php index ae17540..4fae953 100644 --- a/admin/models/translations.php +++ b/admin/models/translations.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Translations List Model */ class GetbibleModelTranslations extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,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 +132,7 @@ class GetbibleModelTranslations extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,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 +168,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 +177,7 @@ class GetbibleModelTranslations extends ListModel } } - + // return items return $items; } @@ -189,25 +197,25 @@ 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. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -295,7 +303,7 @@ class GetbibleModelTranslations extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -310,13 +318,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 +348,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 +366,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..1926925 100644 --- a/admin/models/verse.php +++ b/admin/models/verse.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\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\UCM\UCMType; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Verse Admin Model @@ -73,18 +81,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 +137,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 +164,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 +177,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. @@ -334,13 +342,13 @@ class GetbibleModelVerse extends AdminModel /** * Method to get the script that have to be included on the form * - * @return string script files + * @return string script files */ public function getScript() { return 'media/com_getbible/js/verse.js'; } - + /** * Method to test whether a record can be deleted. * @@ -359,7 +367,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,8 +385,8 @@ class GetbibleModelVerse extends AdminModel */ protected function canEditState($record) { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; + $user = Factory::getUser(); + $recordId = $record->id ?? 0; if ($recordId) { @@ -392,28 +400,28 @@ 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. * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. * - * @return boolean - * @since 2.5 + * @return boolean + * @since 2.5 */ - protected function allowEdit($data = array(), $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); + $user = Factory::getUser(); return $user->authorise('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 +429,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 +453,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 +468,7 @@ class GetbibleModelVerse extends AdminModel $table->modified = $date->toSql(); $table->modified_by = $user->id; } - + if (!empty($table->id)) { // Increment the items version number. @@ -475,10 +483,10 @@ class GetbibleModelVerse extends AdminModel * * @since 1.6 */ - protected function loadFormData() + 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 +509,7 @@ class GetbibleModelVerse extends AdminModel { return false; } - + /** * Method to delete one or more records. * @@ -517,7 +525,7 @@ class GetbibleModelVerse extends AdminModel { return false; } - + return true; } @@ -537,10 +545,10 @@ class GetbibleModelVerse extends AdminModel { return false; } - + return true; - } - + } + /** * Method to perform batch operations on an item or a set of items. * @@ -566,30 +574,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 +634,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 +660,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'); @@ -679,7 +686,7 @@ class GetbibleModelVerse extends AdminModel $values['published'] = 0; } - $newIds = array(); + $newIds = []; // Parent exists so let's proceed while (!empty($pks)) { @@ -692,7 +699,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 +715,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 +803,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 +811,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 +828,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 +844,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 +894,7 @@ class GetbibleModelVerse extends AdminModel return true; } - + /** * Method to save the form data. * @@ -899,23 +906,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 +932,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 +940,14 @@ class GetbibleModelVerse extends AdminModel } } } - + if (parent::save($data)) { return true; } return false; } - + /** * Method to generate a unique value. * @@ -953,7 +960,6 @@ class GetbibleModelVerse extends AdminModel */ protected function generateUnique($field,$value) { - // set field value unique $table = $this->getTable(); @@ -979,7 +985,7 @@ class GetbibleModelVerse extends AdminModel // Alter the title $table = $this->getTable(); - while ($table->load(array('title' => $title))) + while ($table->load(['title' => $title])) { $title = StringHelper::increment($title); } diff --git a/admin/models/verses.php b/admin/models/verses.php index 579b547..56b0378 100644 --- a/admin/models/verses.php +++ b/admin/models/verses.php @@ -18,18 +18,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Verses List Model */ class GetbibleModelVerses extends ListModel { - public function __construct($config = array()) + public function __construct($config = []) { if (empty($config['filter_fields'])) - { + { $config['filter_fields'] = array( 'a.id','id', 'a.published','published', @@ -60,7 +68,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 +132,7 @@ class GetbibleModelVerses extends ListModel // List state information. parent::populateState($ordering, $direction); } - + /** * Method to get an array of data items. * @@ -139,12 +147,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,22 +166,22 @@ class GetbibleModelVerses extends ListModel } } - + // return items return $items; } - + /** * Method to build an SQL query to load the list data. * - * @return string An SQL query + * @return string An SQL query */ protected function getListQuery() { // Get the user object. - $user = JFactory::getUser(); + $user = Factory::getUser(); // Create a new query object. - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); // Select some fields @@ -322,7 +330,7 @@ class GetbibleModelVerses extends ListModel return $query; } - + /** * Method to get a store id based on model configuration state. * @@ -337,13 +345,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 +375,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 +393,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..117ad2c 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 @@ -35,60 +42,60 @@ class GetbibleTableBook extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_book', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Book table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTableBook extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_BOOK_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTableBook extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTableBook extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTableBook extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTableBook extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/chapter.php b/admin/tables/chapter.php index 41a17bd..5f426ea 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 @@ -35,60 +42,60 @@ class GetbibleTableChapter extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_chapter', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Chapter table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTableChapter extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_CHAPTER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTableChapter extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTableChapter extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTableChapter extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTableChapter extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/linker.php b/admin/tables/linker.php index d9e9b66..e1007b3 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 @@ -35,60 +42,60 @@ class GetbibleTableLinker extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_linker', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Linker table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTableLinker extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_LINKER_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTableLinker extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTableLinker extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTableLinker extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTableLinker extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/note.php b/admin/tables/note.php index 45296be..b558ee6 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 @@ -35,63 +42,63 @@ class GetbibleTableNote extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Note table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTableNote extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_NOTE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTableNote extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTableNote extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTableNote extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTableNote extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/open_ai_message.php b/admin/tables/open_ai_message.php index bfde711..74f1a41 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 @@ -35,63 +42,63 @@ class GetbibleTableOpen_ai_message extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Open_ai_message table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTableOpen_ai_message extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTableOpen_ai_message extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTableOpen_ai_message extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTableOpen_ai_message extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTableOpen_ai_message extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/open_ai_response.php b/admin/tables/open_ai_response.php index f4ec262..289178a 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 @@ -35,63 +42,63 @@ class GetbibleTableOpen_ai_response extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Open_ai_response table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTableOpen_ai_response extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTableOpen_ai_response extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTableOpen_ai_response extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTableOpen_ai_response extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTableOpen_ai_response extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/password.php b/admin/tables/password.php index 1fe8aed..73adec7 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 @@ -35,60 +42,60 @@ class GetbibleTablePassword extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_password', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Password table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTablePassword extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_PASSWORD_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTablePassword extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTablePassword extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTablePassword extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTablePassword extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/prompt.php b/admin/tables/prompt.php index c1ee6ed..df83e77 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 @@ -35,63 +42,63 @@ class GetbibleTablePrompt extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Prompt table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTablePrompt extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_PROMPT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTablePrompt extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTablePrompt extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTablePrompt extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTablePrompt extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/tag.php b/admin/tables/tag.php index 65617a0..6b382ae 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 @@ -35,63 +42,63 @@ class GetbibleTableTag extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Tag table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTableTag extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_TAG_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTableTag extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTableTag extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTableTag extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTableTag extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/tagged_verse.php b/admin/tables/tagged_verse.php index 5208774..70c7696 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 @@ -35,63 +42,63 @@ class GetbibleTableTagged_verse extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { 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 = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Tagged_verse table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -106,33 +113,38 @@ class GetbibleTableTagged_verse extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_TAGGED_VERSE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -144,20 +156,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -168,7 +180,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,13 +203,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -213,12 +225,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 +241,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -253,7 +265,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 +273,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 +283,7 @@ class GetbibleTableTagged_verse extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -279,8 +291,8 @@ class GetbibleTableTagged_verse extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -291,8 +303,8 @@ class GetbibleTableTagged_verse extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -306,12 +318,12 @@ class GetbibleTableTagged_verse extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/translation.php b/admin/tables/translation.php index 6113407..69de385 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 @@ -35,60 +42,60 @@ class GetbibleTableTranslation extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_translation', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Translation table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTableTranslation extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_TRANSLATION_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTableTranslation extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTableTranslation extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTableTranslation extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTableTranslation extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/tables/verse.php b/admin/tables/verse.php index 5ca405b..ce114ff 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 @@ -35,60 +42,60 @@ class GetbibleTableVerse extends Table * @since 3.3 */ protected $_jsonEncode = array('params', 'metadata'); - + /** * Constructor * * @param object Database connector object */ - function __construct(&$db) + function __construct(&$db) { parent::__construct('#__getbible_verse', 'id', $db); - } - + } + public function bind($array, $ignore = '') { - + if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - - // Bind the rules. + + // Bind the rules. if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); + { + $rules = new AccessRules($array['rules']); + $this->setRules($rules); } return parent::bind($array, $ignore); } - + /** * Overload the store method for the Verse table. * - * @param boolean Toggle whether null values should be updated. + * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { - $date = JFactory::getDate(); - $user = JFactory::getUser(); + $date = Factory::getDate(); + $user = Factory::getUser(); if ($this->id) { // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); } else { @@ -103,33 +110,38 @@ class GetbibleTableVerse extends Table $this->created_by = $user->get('id'); } } - + 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')); + + if ($table->published === -2) + { + $this->setError(Text::_('COM_GETBIBLE_VERSE_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } } - + if (isset($this->url)) { // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); + $this->url = PunycodeHelper::urlToPunycode($this->url); } if (isset($this->website)) { // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); + $this->website = PunycodeHelper::urlToPunycode($this->website); } return parent::store($updateNulls); } - + /** * Overloaded check method to ensure data integrity. * @@ -141,20 +153,20 @@ 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)) { $this->alias = StringHelper::increment($this->alias, 'dash'); } } - + /* * Clean up keywords -- eliminate extra spaces between phrases * and cr (\r) and lf (\n) characters from string. * Only process if not empty. - */ + */ if (!empty($this->metakey)) { // Array of characters to remove. @@ -165,7 +177,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,13 +200,13 @@ 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); $this->setRules($rules); } - + // Set ordering if ($this->published < 0) { @@ -210,12 +222,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 +238,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 AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. } // try again elseif ($try) { $try = explode('.',$component); $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) + if ($result instanceof AccessRules) { if (isset($try[1])) { @@ -250,7 +262,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 +270,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 +280,7 @@ class GetbibleTableVerse extends Table return $result; } } - return JAccess::getAssetRules(0); + return AccessRules::getAssetRules(0); } /** @@ -276,8 +288,8 @@ class GetbibleTableVerse extends Table * The default name is in the form 'table_name.id' * where id is the value of the primary key of the table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetName() { @@ -288,8 +300,8 @@ class GetbibleTableVerse extends Table /** * Method to return the title to use for the asset table. * - * @return string - * @since 2.5 + * @return string + * @since 2.5 */ protected function _getAssetTitle() { @@ -303,12 +315,12 @@ class GetbibleTableVerse extends Table /** * Get the parent asset id for the record * - * @return int - * @since 2.5 + * @return int + * @since 2.5 */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + protected function _getAssetParentId(?Table $table = null, $id = null) { - $asset = JTable::getInstance('Asset'); + $asset = Table::getInstance('Asset'); $asset->loadByName('com_getbible'); return $asset->id; diff --git a/admin/views/book/submitbutton.js b/admin/views/book/submitbutton.js index e9bf89d..3845dec 100644 --- a/admin/views/book/submitbutton.js +++ b/admin/views/book/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/book/tmpl/edit.php b/admin/views/book/tmpl/edit.php index 96da247..2b2be57 100644 --- a/admin/views/book/tmpl/edit.php +++ b/admin/views/book/tmpl/edit.php @@ -18,72 +18,71 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/books/view.html.php b/admin/views/books/view.html.php index fdc174c..e3ac707 100644 --- a/admin/views/books/view.html.php +++ b/admin/views/books/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Books @@ -41,7 +54,7 @@ class GetbibleViewBooks extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewBooks extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('book'); $this->canEdit = $this->canDo->get('book.edit'); @@ -71,7 +84,7 @@ class GetbibleViewBooks extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewBooks extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_BOOKS'), 'generic'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=books'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_BOOKS'), 'generic'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('book.add'); + ToolbarHelper::addNew('book.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('book.edit'); + ToolbarHelper::editList('book.edit'); } if ($this->canState) { - JToolBarHelper::publishList('books.publish'); - JToolBarHelper::unpublishList('books.unpublish'); - JToolBarHelper::archiveList('books.archive'); + ToolbarHelper::publishList('books.publish'); + ToolbarHelper::unpublishList('books.unpublish'); + ToolbarHelper::archiveList('books.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('books.checkin'); + ToolbarHelper::checkin('books.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewBooks extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,44 +148,44 @@ class GetbibleViewBooks extends HtmlView if ($this->user->authorise('book.update_chapters_names', 'com_getbible')) { // add Update Chapters Names button. - JToolBarHelper::custom('books.updateChaptersNames', 'generic custom-button-updatechaptersnames', '', 'COM_GETBIBLE_UPDATE_CHAPTERS_NAMES', 'true'); + ToolbarHelper::custom('books.updateChaptersNames', 'generic custom-button-updatechaptersnames', '', 'COM_GETBIBLE_UPDATE_CHAPTERS_NAMES', 'true'); } if ($this->user->authorise('book.force_hash_check', 'com_getbible')) { // add Force Hash Check button. - JToolBarHelper::custom('books.forceHashCheck', 'health custom-button-forcehashcheck', '', 'COM_GETBIBLE_FORCE_HASH_CHECK', 'true'); + ToolbarHelper::custom('books.forceHashCheck', 'health custom-button-forcehashcheck', '', 'COM_GETBIBLE_FORCE_HASH_CHECK', 'true'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'books.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'books.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('books.trash'); + ToolbarHelper::trash('books.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('books'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -180,9 +193,9 @@ class GetbibleViewBooks extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -190,19 +203,19 @@ class GetbibleViewBooks extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Name Selection - $this->nameOptions = JFormHelper::loadFieldType('booksfiltername')->options; + $this->nameOptions = FormHelper::loadFieldType('booksfiltername')->options; // We do some sanitation for Name filter - if (GetbibleHelper::checkArray($this->nameOptions) && + if (ArrayHelper::check($this->nameOptions) && isset($this->nameOptions[0]->value) && - !GetbibleHelper::checkString($this->nameOptions[0]->value)) + !StringHelper::check($this->nameOptions[0]->value)) { unset($this->nameOptions[0]); } // Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_BOOK_NAME_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_BOOK_NAME_LABEL').' -', 'batch[name]', - JHtml::_('select.options', $this->nameOptions, 'value', 'text') + Html::_('select.options', $this->nameOptions, 'value', 'text') ); } @@ -210,19 +223,19 @@ class GetbibleViewBooks extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Abbreviation Translation Selection - $this->abbreviationTranslationOptions = JFormHelper::loadFieldType('Translations')->options; + $this->abbreviationTranslationOptions = FormHelper::loadFieldType('Translations')->options; // We do some sanitation for Abbreviation Translation filter - if (GetbibleHelper::checkArray($this->abbreviationTranslationOptions) && + if (ArrayHelper::check($this->abbreviationTranslationOptions) && isset($this->abbreviationTranslationOptions[0]->value) && - !GetbibleHelper::checkString($this->abbreviationTranslationOptions[0]->value)) + !StringHelper::check($this->abbreviationTranslationOptions[0]->value)) { unset($this->abbreviationTranslationOptions[0]); } // Abbreviation Translation Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_BOOK_ABBREVIATION_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_BOOK_ABBREVIATION_LABEL').' -', 'batch[abbreviation]', - JHtml::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') + Html::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') ); } @@ -230,19 +243,19 @@ class GetbibleViewBooks extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Nr Selection - $this->nrOptions = JFormHelper::loadFieldType('booksfilternr')->options; + $this->nrOptions = FormHelper::loadFieldType('booksfilternr')->options; // We do some sanitation for Nr filter - if (GetbibleHelper::checkArray($this->nrOptions) && + if (ArrayHelper::check($this->nrOptions) && isset($this->nrOptions[0]->value) && - !GetbibleHelper::checkString($this->nrOptions[0]->value)) + !StringHelper::check($this->nrOptions[0]->value)) { unset($this->nrOptions[0]); } // Nr Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_BOOK_NR_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_BOOK_NR_LABEL').' -', 'batch[nr]', - JHtml::_('select.options', $this->nrOptions, 'value', 'text') + Html::_('select.options', $this->nrOptions, 'value', 'text') ); } } @@ -256,10 +269,10 @@ class GetbibleViewBooks extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_BOOKS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/books.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_BOOKS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/books.css", ['version' => 'auto']); } /** @@ -274,26 +287,26 @@ class GetbibleViewBooks extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_BOOK_NAME_LABEL'), - 'g.translation' => JText::_('COM_GETBIBLE_BOOK_ABBREVIATION_LABEL'), - 'a.nr' => JText::_('COM_GETBIBLE_BOOK_NR_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_BOOK_NAME_LABEL'), + 'g.translation' => Text::_('COM_GETBIBLE_BOOK_ABBREVIATION_LABEL'), + 'a.nr' => Text::_('COM_GETBIBLE_BOOK_NR_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/chapter/submitbutton.js b/admin/views/chapter/submitbutton.js index cc7923e..c1b9647 100644 --- a/admin/views/chapter/submitbutton.js +++ b/admin/views/chapter/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/chapter/tmpl/edit.php b/admin/views/chapter/tmpl/edit.php index fd17978..0ff856d 100644 --- a/admin/views/chapter/tmpl/edit.php +++ b/admin/views/chapter/tmpl/edit.php @@ -18,72 +18,71 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/chapters/view.html.php b/admin/views/chapters/view.html.php index caa6ac8..51bbb02 100644 --- a/admin/views/chapters/view.html.php +++ b/admin/views/chapters/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Chapters @@ -41,7 +54,7 @@ class GetbibleViewChapters extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewChapters extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('chapter'); $this->canEdit = $this->canDo->get('chapter.edit'); @@ -71,7 +84,7 @@ class GetbibleViewChapters extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewChapters extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_CHAPTERS'), 'generic'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=chapters'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_CHAPTERS'), 'generic'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('chapter.add'); + ToolbarHelper::addNew('chapter.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('chapter.edit'); + ToolbarHelper::editList('chapter.edit'); } if ($this->canState) { - JToolBarHelper::publishList('chapters.publish'); - JToolBarHelper::unpublishList('chapters.unpublish'); - JToolBarHelper::archiveList('chapters.archive'); + ToolbarHelper::publishList('chapters.publish'); + ToolbarHelper::unpublishList('chapters.unpublish'); + ToolbarHelper::archiveList('chapters.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('chapters.checkin'); + ToolbarHelper::checkin('chapters.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewChapters extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewChapters extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'chapters.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'chapters.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('chapters.trash'); + ToolbarHelper::trash('chapters.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('chapters'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewChapters extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewChapters extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Chapter Selection - $this->chapterOptions = JFormHelper::loadFieldType('chaptersfilterchapter')->options; + $this->chapterOptions = FormHelper::loadFieldType('chaptersfilterchapter')->options; // We do some sanitation for Chapter filter - if (GetbibleHelper::checkArray($this->chapterOptions) && + if (ArrayHelper::check($this->chapterOptions) && isset($this->chapterOptions[0]->value) && - !GetbibleHelper::checkString($this->chapterOptions[0]->value)) + !StringHelper::check($this->chapterOptions[0]->value)) { unset($this->chapterOptions[0]); } // Chapter Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_CHAPTER_CHAPTER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_CHAPTER_CHAPTER_LABEL').' -', 'batch[chapter]', - JHtml::_('select.options', $this->chapterOptions, 'value', 'text') + Html::_('select.options', $this->chapterOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewChapters extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Book Nr Selection - $this->book_nrOptions = JFormHelper::loadFieldType('chaptersfilterbooknr')->options; + $this->book_nrOptions = FormHelper::loadFieldType('chaptersfilterbooknr')->options; // We do some sanitation for Book Nr filter - if (GetbibleHelper::checkArray($this->book_nrOptions) && + if (ArrayHelper::check($this->book_nrOptions) && isset($this->book_nrOptions[0]->value) && - !GetbibleHelper::checkString($this->book_nrOptions[0]->value)) + !StringHelper::check($this->book_nrOptions[0]->value)) { unset($this->book_nrOptions[0]); } // Book Nr Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_CHAPTER_BOOK_NR_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_CHAPTER_BOOK_NR_LABEL').' -', 'batch[book_nr]', - JHtml::_('select.options', $this->book_nrOptions, 'value', 'text') + Html::_('select.options', $this->book_nrOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewChapters extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Abbreviation Translation Selection - $this->abbreviationTranslationOptions = JFormHelper::loadFieldType('Translations')->options; + $this->abbreviationTranslationOptions = FormHelper::loadFieldType('Translations')->options; // We do some sanitation for Abbreviation Translation filter - if (GetbibleHelper::checkArray($this->abbreviationTranslationOptions) && + if (ArrayHelper::check($this->abbreviationTranslationOptions) && isset($this->abbreviationTranslationOptions[0]->value) && - !GetbibleHelper::checkString($this->abbreviationTranslationOptions[0]->value)) + !StringHelper::check($this->abbreviationTranslationOptions[0]->value)) { unset($this->abbreviationTranslationOptions[0]); } // Abbreviation Translation Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_CHAPTER_ABBREVIATION_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_CHAPTER_ABBREVIATION_LABEL').' -', 'batch[abbreviation]', - JHtml::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') + Html::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') ); } } @@ -246,10 +259,10 @@ class GetbibleViewChapters extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_CHAPTERS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/chapters.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_CHAPTERS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/chapters.css", ['version' => 'auto']); } /** @@ -264,27 +277,27 @@ class GetbibleViewChapters extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_CHAPTER_NAME_LABEL'), - 'a.chapter' => JText::_('COM_GETBIBLE_CHAPTER_CHAPTER_LABEL'), - 'a.book_nr' => JText::_('COM_GETBIBLE_CHAPTER_BOOK_NR_LABEL'), - 'g.translation' => JText::_('COM_GETBIBLE_CHAPTER_ABBREVIATION_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_CHAPTER_NAME_LABEL'), + 'a.chapter' => Text::_('COM_GETBIBLE_CHAPTER_CHAPTER_LABEL'), + 'a.book_nr' => Text::_('COM_GETBIBLE_CHAPTER_BOOK_NR_LABEL'), + 'g.translation' => Text::_('COM_GETBIBLE_CHAPTER_ABBREVIATION_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/getbible/tmpl/default.php b/admin/views/getbible/tmpl/default.php index 946509a..9f44806 100644 --- a/admin/views/getbible/tmpl/default.php +++ b/admin/views/getbible/tmpl/default.php @@ -18,68 +18,70 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; ?>
- 'cpanel')); ?> + 'cpanel')); ?> - +
- 'main')); ?> - + 'main')); ?> + loadTemplate('main');?> - - + +
- 'vdm')); ?> - + 'vdm')); ?> + loadTemplate('vdm');?> - - + +
- + - +
- 'wiki_one')); ?> - + 'wiki_one')); ?> + loadTemplate('wiki_tutorials');?> - - + +
- + - +
- 'notice_board_one')); ?> - + 'notice_board_one')); ?> + loadTemplate('notice_board_vast_development_method');?> - - + +
- + - +
- 'readme_one')); ?> - + 'readme_one')); ?> + loadTemplate('readme_information');?> - - + +
- + - +
\ No newline at end of file diff --git a/admin/views/getbible/tmpl/default_main.php b/admin/views/getbible/tmpl/default_main.php index 4da9e6d..fabd16a 100644 --- a/admin/views/getbible/tmpl/default_main.php +++ b/admin/views/getbible/tmpl/default_main.php @@ -18,19 +18,21 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + ?> icons['main']) && is_array($this->icons['main'])) :?> icons['main'] as $icon): ?>
-
-

+

\ No newline at end of file diff --git a/admin/views/getbible/tmpl/default_notice_board_vast_development_method.php b/admin/views/getbible/tmpl/default_notice_board_vast_development_method.php index 2a0e483..b576ff7 100644 --- a/admin/views/getbible/tmpl/default_notice_board_vast_development_method.php +++ b/admin/views/getbible/tmpl/default_notice_board_vast_development_method.php @@ -18,5 +18,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> noticeboard; ?> diff --git a/admin/views/getbible/tmpl/default_readme_information.php b/admin/views/getbible/tmpl/default_readme_information.php index 18f25d2..d4c0fd1 100644 --- a/admin/views/getbible/tmpl/default_readme_information.php +++ b/admin/views/getbible/tmpl/default_readme_information.php @@ -18,5 +18,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> readme; ?> diff --git a/admin/views/getbible/tmpl/default_vdm.php b/admin/views/getbible/tmpl/default_vdm.php index cf8cd6d..388562e 100644 --- a/admin/views/getbible/tmpl/default_vdm.php +++ b/admin/views/getbible/tmpl/default_vdm.php @@ -18,22 +18,25 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\ArrayHelper; + ?> -<?php echo JText::_('COM_GETBIBLE'); ?> +<?php echo Text::_('COM_GETBIBLE'); ?>
-contributors)): ?> +contributors)): ?> contributors) > 1): ?> -

+

-

+

    contributors as $contributor): ?> diff --git a/admin/views/getbible/tmpl/default_wiki_tutorials.php b/admin/views/getbible/tmpl/default_wiki_tutorials.php index c531eb9..cc1c328 100644 --- a/admin/views/getbible/tmpl/default_wiki_tutorials.php +++ b/admin/views/getbible/tmpl/default_wiki_tutorials.php @@ -18,5 +18,9 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> wiki; ?> diff --git a/admin/views/getbible/view.html.php b/admin/views/getbible/view.html.php index 3be7666..ba0776b 100644 --- a/admin/views/getbible/view.html.php +++ b/admin/views/getbible/view.html.php @@ -18,12 +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\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible View class */ -class GetbibleViewGetbible extends JViewLegacy +class GetbibleViewGetbible extends HtmlView { /** * View display method @@ -32,19 +37,19 @@ class GetbibleViewGetbible extends JViewLegacy function display($tpl = null) { // Assign data to the view - $this->icons = $this->get('Icons'); - $this->contributors = GetbibleHelper::getContributors(); + $this->icons = $this->get('Icons'); + $this->contributors = GetbibleHelper::getContributors(); $this->wiki = $this->get('Wiki'); $this->noticeboard = $this->get('Noticeboard'); $this->readme = $this->get('Readme'); $this->version = $this->get('Version'); - + // get the manifest details of the component $this->manifest = GetbibleHelper::manifest(); - + // Set the toolbar $this->addToolBar(); - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -64,18 +69,18 @@ class GetbibleViewGetbible extends JViewLegacy protected function addToolBar() { $canDo = GetbibleHelper::getActions('getbible'); - JToolBarHelper::title(JText::_('COM_GETBIBLE_DASHBOARD'), 'grid-2'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_DASHBOARD'), 'grid-2'); // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('getbible'); - 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); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } } @@ -86,15 +91,17 @@ class GetbibleViewGetbible extends JViewLegacy */ protected function setDocument() { - $document = JFactory::getDocument(); - - // add dashboard style sheets - $document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/dashboard.css"); - + if (!isset($this->document)) + { + $this->document = Factory::getDocument(); + } // set page title - $document->setTitle(JText::_('COM_GETBIBLE_DASHBOARD')); - + $this->document->setTitle(Text::_('COM_GETBIBLE_DASHBOARD')); + // add manifest to page JavaScript - $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + $this->document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + + // add dashboard style sheets + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/dashboard.css", ['version' => 'auto']); } } diff --git a/admin/views/linker/submitbutton.js b/admin/views/linker/submitbutton.js index 173acd2..d8c9d22 100644 --- a/admin/views/linker/submitbutton.js +++ b/admin/views/linker/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/linker/tmpl/edit.php b/admin/views/linker/tmpl/edit.php index 4cb9e8d..e04b486 100644 --- a/admin/views/linker/tmpl/edit.php +++ b/admin/views/linker/tmpl/edit.php @@ -18,108 +18,107 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
    \ No newline at end of file diff --git a/admin/views/linkers/view.html.php b/admin/views/linkers/view.html.php index 52f34af..e1e1688 100644 --- a/admin/views/linkers/view.html.php +++ b/admin/views/linkers/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Linkers @@ -41,7 +54,7 @@ class GetbibleViewLinkers extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewLinkers extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('linker'); $this->canEdit = $this->canDo->get('linker.edit'); @@ -71,7 +84,7 @@ class GetbibleViewLinkers extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewLinkers extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_LINKERS'), 'joomla'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=linkers'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_LINKERS'), 'joomla'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('linker.add'); + ToolbarHelper::addNew('linker.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('linker.edit'); + ToolbarHelper::editList('linker.edit'); } if ($this->canState) { - JToolBarHelper::publishList('linkers.publish'); - JToolBarHelper::unpublishList('linkers.unpublish'); - JToolBarHelper::archiveList('linkers.archive'); + ToolbarHelper::publishList('linkers.publish'); + ToolbarHelper::unpublishList('linkers.unpublish'); + ToolbarHelper::archiveList('linkers.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('linkers.checkin'); + ToolbarHelper::checkin('linkers.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewLinkers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewLinkers extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'linkers.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'linkers.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('linkers.trash'); + ToolbarHelper::trash('linkers.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('linkers'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewLinkers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewLinkers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Name Selection - $this->nameOptions = JFormHelper::loadFieldType('linkersfiltername')->options; + $this->nameOptions = FormHelper::loadFieldType('linkersfiltername')->options; // We do some sanitation for Name filter - if (GetbibleHelper::checkArray($this->nameOptions) && + if (ArrayHelper::check($this->nameOptions) && isset($this->nameOptions[0]->value) && - !GetbibleHelper::checkString($this->nameOptions[0]->value)) + !StringHelper::check($this->nameOptions[0]->value)) { unset($this->nameOptions[0]); } // Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_LINKER_NAME_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_LINKER_NAME_LABEL').' -', 'batch[name]', - JHtml::_('select.options', $this->nameOptions, 'value', 'text') + Html::_('select.options', $this->nameOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewLinkers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Public Tagged Verses Selection - $this->public_tagged_versesOptions = JFormHelper::loadFieldType('linkersfilterpublictaggedverses')->options; + $this->public_tagged_versesOptions = FormHelper::loadFieldType('linkersfilterpublictaggedverses')->options; // We do some sanitation for Public Tagged Verses filter - if (GetbibleHelper::checkArray($this->public_tagged_versesOptions) && + if (ArrayHelper::check($this->public_tagged_versesOptions) && isset($this->public_tagged_versesOptions[0]->value) && - !GetbibleHelper::checkString($this->public_tagged_versesOptions[0]->value)) + !StringHelper::check($this->public_tagged_versesOptions[0]->value)) { unset($this->public_tagged_versesOptions[0]); } // Public Tagged Verses Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_LINKER_PUBLIC_TAGGED_VERSES_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_LINKER_PUBLIC_TAGGED_VERSES_LABEL').' -', 'batch[public_tagged_verses]', - JHtml::_('select.options', $this->public_tagged_versesOptions, 'value', 'text') + Html::_('select.options', $this->public_tagged_versesOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewLinkers extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Public Notes Selection - $this->public_notesOptions = JFormHelper::loadFieldType('linkersfilterpublicnotes')->options; + $this->public_notesOptions = FormHelper::loadFieldType('linkersfilterpublicnotes')->options; // We do some sanitation for Public Notes filter - if (GetbibleHelper::checkArray($this->public_notesOptions) && + if (ArrayHelper::check($this->public_notesOptions) && isset($this->public_notesOptions[0]->value) && - !GetbibleHelper::checkString($this->public_notesOptions[0]->value)) + !StringHelper::check($this->public_notesOptions[0]->value)) { unset($this->public_notesOptions[0]); } // Public Notes Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_LINKER_PUBLIC_NOTES_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_LINKER_PUBLIC_NOTES_LABEL').' -', 'batch[public_notes]', - JHtml::_('select.options', $this->public_notesOptions, 'value', 'text') + Html::_('select.options', $this->public_notesOptions, 'value', 'text') ); } } @@ -246,10 +259,10 @@ class GetbibleViewLinkers extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_LINKERS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/linkers.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_LINKERS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/linkers.css", ['version' => 'auto']); } /** @@ -264,26 +277,26 @@ class GetbibleViewLinkers extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_LINKER_NAME_LABEL'), - 'a.public_tagged_verses' => JText::_('COM_GETBIBLE_LINKER_PUBLIC_TAGGED_VERSES_LABEL'), - 'a.public_notes' => JText::_('COM_GETBIBLE_LINKER_PUBLIC_NOTES_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_LINKER_NAME_LABEL'), + 'a.public_tagged_verses' => Text::_('COM_GETBIBLE_LINKER_PUBLIC_TAGGED_VERSES_LABEL'), + 'a.public_notes' => Text::_('COM_GETBIBLE_LINKER_PUBLIC_NOTES_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/note/submitbutton.js b/admin/views/note/submitbutton.js index 8136d65..6406ef5 100644 --- a/admin/views/note/submitbutton.js +++ b/admin/views/note/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/note/tmpl/edit.php b/admin/views/note/tmpl/edit.php index cb7166b..500a98f 100644 --- a/admin/views/note/tmpl/edit.php +++ b/admin/views/note/tmpl/edit.php @@ -18,72 +18,71 @@ // 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 ?> - access); ?> + access); ?> get('note.edit.state')) : ?> checked_out) : ?> - published, $i, 'notes.', true, 'cb'); ?> + published, $i, 'notes.', true, 'cb'); ?> - published, $i, 'notes.', false, 'cb'); ?> + published, $i, 'notes.', false, 'cb'); ?> - published, $i, 'notes.', true, 'cb'); ?> + published, $i, 'notes.', true, 'cb'); ?> - published, $i, 'notes.', false, 'cb'); ?> + published, $i, 'notes.', false, 'cb'); ?> diff --git a/admin/views/notes/tmpl/default_head.php b/admin/views/notes/tmpl/default_head.php index 45dae8a..1e87332 100644 --- a/admin/views/notes/tmpl/default_head.php +++ b/admin/views/notes/tmpl/default_head.php @@ -18,14 +18,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -36,24 +39,24 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/notes/tmpl/default_toolbar.php b/admin/views/notes/tmpl/default_toolbar.php index 77747da..dccf8e9 100644 --- a/admin/views/notes/tmpl/default_toolbar.php +++ b/admin/views/notes/tmpl/default_toolbar.php @@ -18,34 +18,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
    - -
    - - -
    -
    - - pagination->getLimitBox(); ?> -
    -
    - - -
    -
    - - -
    -
    + +
    + + +
    +
    + + pagination->getLimitBox(); ?> +
    +
    + + +
    +
    + + +
    +
\ No newline at end of file diff --git a/admin/views/notes/view.html.php b/admin/views/notes/view.html.php index 03328b3..f5ff0ce 100644 --- a/admin/views/notes/view.html.php +++ b/admin/views/notes/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Notes @@ -41,7 +54,7 @@ class GetbibleViewNotes extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewNotes extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('note'); $this->canEdit = $this->canDo->get('note.edit'); @@ -71,7 +84,7 @@ class GetbibleViewNotes extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewNotes extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_NOTES'), 'file'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=notes'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_NOTES'), 'file'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('note.add'); + ToolbarHelper::addNew('note.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('note.edit'); + ToolbarHelper::editList('note.edit'); } if ($this->canState) { - JToolBarHelper::publishList('notes.publish'); - JToolBarHelper::unpublishList('notes.unpublish'); - JToolBarHelper::archiveList('notes.archive'); + ToolbarHelper::publishList('notes.publish'); + ToolbarHelper::unpublishList('notes.unpublish'); + ToolbarHelper::archiveList('notes.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('notes.checkin'); + ToolbarHelper::checkin('notes.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewNotes extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('notes.trash'); + ToolbarHelper::trash('notes.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('notes'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,19 +183,19 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Book Nr Selection - $this->book_nrOptions = JFormHelper::loadFieldType('notesfilterbooknr')->options; + $this->book_nrOptions = FormHelper::loadFieldType('notesfilterbooknr')->options; // We do some sanitation for Book Nr filter - if (GetbibleHelper::checkArray($this->book_nrOptions) && + if (ArrayHelper::check($this->book_nrOptions) && isset($this->book_nrOptions[0]->value) && - !GetbibleHelper::checkString($this->book_nrOptions[0]->value)) + !StringHelper::check($this->book_nrOptions[0]->value)) { unset($this->book_nrOptions[0]); } // Book Nr Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_NOTE_BOOK_NR_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_NOTE_BOOK_NR_LABEL').' -', 'batch[book_nr]', - JHtml::_('select.options', $this->book_nrOptions, 'value', 'text') + Html::_('select.options', $this->book_nrOptions, 'value', 'text') ); } @@ -190,19 +203,19 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Linker Name Selection - $this->linkerNameOptions = JFormHelper::loadFieldType('Linkers')->options; + $this->linkerNameOptions = FormHelper::loadFieldType('Linkers')->options; // We do some sanitation for Linker Name filter - if (GetbibleHelper::checkArray($this->linkerNameOptions) && + if (ArrayHelper::check($this->linkerNameOptions) && isset($this->linkerNameOptions[0]->value) && - !GetbibleHelper::checkString($this->linkerNameOptions[0]->value)) + !StringHelper::check($this->linkerNameOptions[0]->value)) { unset($this->linkerNameOptions[0]); } // Linker Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_NOTE_LINKER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_NOTE_LINKER_LABEL').' -', 'batch[linker]', - JHtml::_('select.options', $this->linkerNameOptions, 'value', 'text') + Html::_('select.options', $this->linkerNameOptions, 'value', 'text') ); } @@ -210,19 +223,19 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Access Selection - $this->accessOptions = JFormHelper::loadFieldType('notesfilteraccess')->options; + $this->accessOptions = FormHelper::loadFieldType('notesfilteraccess')->options; // We do some sanitation for Access filter - if (GetbibleHelper::checkArray($this->accessOptions) && + if (ArrayHelper::check($this->accessOptions) && isset($this->accessOptions[0]->value) && - !GetbibleHelper::checkString($this->accessOptions[0]->value)) + !StringHelper::check($this->accessOptions[0]->value)) { unset($this->accessOptions[0]); } // Access Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_NOTE_ACCESS_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_NOTE_ACCESS_LABEL').' -', 'batch[access]', - JHtml::_('select.options', $this->accessOptions, 'value', 'text') + Html::_('select.options', $this->accessOptions, 'value', 'text') ); } @@ -230,19 +243,19 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Verse Selection - $this->verseOptions = JFormHelper::loadFieldType('notesfilterverse')->options; + $this->verseOptions = FormHelper::loadFieldType('notesfilterverse')->options; // We do some sanitation for Verse filter - if (GetbibleHelper::checkArray($this->verseOptions) && + if (ArrayHelper::check($this->verseOptions) && isset($this->verseOptions[0]->value) && - !GetbibleHelper::checkString($this->verseOptions[0]->value)) + !StringHelper::check($this->verseOptions[0]->value)) { unset($this->verseOptions[0]); } // Verse Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_NOTE_VERSE_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_NOTE_VERSE_LABEL').' -', 'batch[verse]', - JHtml::_('select.options', $this->verseOptions, 'value', 'text') + Html::_('select.options', $this->verseOptions, 'value', 'text') ); } @@ -250,19 +263,19 @@ class GetbibleViewNotes extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Chapter Selection - $this->chapterOptions = JFormHelper::loadFieldType('notesfilterchapter')->options; + $this->chapterOptions = FormHelper::loadFieldType('notesfilterchapter')->options; // We do some sanitation for Chapter filter - if (GetbibleHelper::checkArray($this->chapterOptions) && + if (ArrayHelper::check($this->chapterOptions) && isset($this->chapterOptions[0]->value) && - !GetbibleHelper::checkString($this->chapterOptions[0]->value)) + !StringHelper::check($this->chapterOptions[0]->value)) { unset($this->chapterOptions[0]); } // Chapter Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_NOTE_CHAPTER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_NOTE_CHAPTER_LABEL').' -', 'batch[chapter]', - JHtml::_('select.options', $this->chapterOptions, 'value', 'text') + Html::_('select.options', $this->chapterOptions, 'value', 'text') ); } } @@ -276,10 +289,10 @@ class GetbibleViewNotes extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_NOTES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/notes.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_NOTES')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/notes.css", ['version' => 'auto']); } /** @@ -294,26 +307,26 @@ class GetbibleViewNotes extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.book_nr' => JText::_('COM_GETBIBLE_NOTE_BOOK_NR_LABEL'), - 'g.name' => JText::_('COM_GETBIBLE_NOTE_LINKER_LABEL'), - 'a.access' => JText::_('COM_GETBIBLE_NOTE_ACCESS_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.book_nr' => Text::_('COM_GETBIBLE_NOTE_BOOK_NR_LABEL'), + 'g.name' => Text::_('COM_GETBIBLE_NOTE_LINKER_LABEL'), + 'a.access' => Text::_('COM_GETBIBLE_NOTE_ACCESS_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/open_ai_message/submitbutton.js b/admin/views/open_ai_message/submitbutton.js index 3c988c5..c4d1f62 100644 --- a/admin/views/open_ai_message/submitbutton.js +++ b/admin/views/open_ai_message/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/open_ai_message/tmpl/edit.php b/admin/views/open_ai_message/tmpl/edit.php index f6227cb..2a1a981 100644 --- a/admin/views/open_ai_message/tmpl/edit.php +++ b/admin/views/open_ai_message/tmpl/edit.php @@ -18,77 +18,76 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?> - source); ?> + source); ?> get('open_ai_message.edit.state')) : ?> checked_out) : ?> - published, $i, 'open_ai_messages.', true, 'cb'); ?> + published, $i, 'open_ai_messages.', true, 'cb'); ?> - published, $i, 'open_ai_messages.', false, 'cb'); ?> + published, $i, 'open_ai_messages.', false, 'cb'); ?> - published, $i, 'open_ai_messages.', true, 'cb'); ?> + published, $i, 'open_ai_messages.', true, 'cb'); ?> - published, $i, 'open_ai_messages.', false, 'cb'); ?> + published, $i, 'open_ai_messages.', false, 'cb'); ?> diff --git a/admin/views/open_ai_messages/tmpl/default_head.php b/admin/views/open_ai_messages/tmpl/default_head.php index 2f4f6d4..91244f4 100644 --- a/admin/views/open_ai_messages/tmpl/default_head.php +++ b/admin/views/open_ai_messages/tmpl/default_head.php @@ -18,14 +18,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -36,27 +39,27 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/open_ai_messages/tmpl/default_toolbar.php b/admin/views/open_ai_messages/tmpl/default_toolbar.php index 665453b..bbc9303 100644 --- a/admin/views/open_ai_messages/tmpl/default_toolbar.php +++ b/admin/views/open_ai_messages/tmpl/default_toolbar.php @@ -18,34 +18,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/open_ai_messages/view.html.php b/admin/views/open_ai_messages/view.html.php index 53976aa..36d0bc0 100644 --- a/admin/views/open_ai_messages/view.html.php +++ b/admin/views/open_ai_messages/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Open_ai_messages @@ -41,7 +54,7 @@ class GetbibleViewOpen_ai_messages extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewOpen_ai_messages extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('open_ai_message'); $this->canEdit = $this->canDo->get('open_ai_message.edit'); @@ -71,7 +84,7 @@ class GetbibleViewOpen_ai_messages extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewOpen_ai_messages extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_OPEN_AI_MESSAGES'), 'comment'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=open_ai_messages'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_OPEN_AI_MESSAGES'), 'comment'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('open_ai_message.add'); + ToolbarHelper::addNew('open_ai_message.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('open_ai_message.edit'); + ToolbarHelper::editList('open_ai_message.edit'); } if ($this->canState) { - JToolBarHelper::publishList('open_ai_messages.publish'); - JToolBarHelper::unpublishList('open_ai_messages.unpublish'); - JToolBarHelper::archiveList('open_ai_messages.archive'); + ToolbarHelper::publishList('open_ai_messages.publish'); + ToolbarHelper::unpublishList('open_ai_messages.unpublish'); + ToolbarHelper::archiveList('open_ai_messages.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('open_ai_messages.checkin'); + ToolbarHelper::checkin('open_ai_messages.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'open_ai_messages.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'open_ai_messages.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('open_ai_messages.trash'); + ToolbarHelper::trash('open_ai_messages.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('open_ai_messages'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Role Selection - $this->roleOptions = JFormHelper::loadFieldType('openaimessagesfilterrole')->options; + $this->roleOptions = FormHelper::loadFieldType('openaimessagesfilterrole')->options; // We do some sanitation for Role filter - if (GetbibleHelper::checkArray($this->roleOptions) && + if (ArrayHelper::check($this->roleOptions) && isset($this->roleOptions[0]->value) && - !GetbibleHelper::checkString($this->roleOptions[0]->value)) + !StringHelper::check($this->roleOptions[0]->value)) { unset($this->roleOptions[0]); } // Role Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ROLE_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ROLE_LABEL').' -', 'batch[role]', - JHtml::_('select.options', $this->roleOptions, 'value', 'text') + Html::_('select.options', $this->roleOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Open Ai Response Response Id Selection - $this->open_ai_responseResponse_idOptions = JFormHelper::loadFieldType('Openairesponses')->options; + $this->open_ai_responseResponse_idOptions = FormHelper::loadFieldType('Openairesponses')->options; // We do some sanitation for Open Ai Response Response Id filter - if (GetbibleHelper::checkArray($this->open_ai_responseResponse_idOptions) && + if (ArrayHelper::check($this->open_ai_responseResponse_idOptions) && isset($this->open_ai_responseResponse_idOptions[0]->value) && - !GetbibleHelper::checkString($this->open_ai_responseResponse_idOptions[0]->value)) + !StringHelper::check($this->open_ai_responseResponse_idOptions[0]->value)) { unset($this->open_ai_responseResponse_idOptions[0]); } // Open Ai Response Response Id Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI_RESPONSE_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI_RESPONSE_LABEL').' -', 'batch[open_ai_response]', - JHtml::_('select.options', $this->open_ai_responseResponse_idOptions, 'value', 'text') + Html::_('select.options', $this->open_ai_responseResponse_idOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Prompt Name Selection - $this->promptNameOptions = JFormHelper::loadFieldType('Prompts')->options; + $this->promptNameOptions = FormHelper::loadFieldType('Prompts')->options; // We do some sanitation for Prompt Name filter - if (GetbibleHelper::checkArray($this->promptNameOptions) && + if (ArrayHelper::check($this->promptNameOptions) && isset($this->promptNameOptions[0]->value) && - !GetbibleHelper::checkString($this->promptNameOptions[0]->value)) + !StringHelper::check($this->promptNameOptions[0]->value)) { unset($this->promptNameOptions[0]); } // Prompt Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_PROMPT_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_PROMPT_LABEL').' -', 'batch[prompt]', - JHtml::_('select.options', $this->promptNameOptions, 'value', 'text') + Html::_('select.options', $this->promptNameOptions, 'value', 'text') ); } @@ -240,19 +253,19 @@ class GetbibleViewOpen_ai_messages extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Source Selection - $this->sourceOptions = JFormHelper::loadFieldType('openaimessagesfiltersource')->options; + $this->sourceOptions = FormHelper::loadFieldType('openaimessagesfiltersource')->options; // We do some sanitation for Source filter - if (GetbibleHelper::checkArray($this->sourceOptions) && + if (ArrayHelper::check($this->sourceOptions) && isset($this->sourceOptions[0]->value) && - !GetbibleHelper::checkString($this->sourceOptions[0]->value)) + !StringHelper::check($this->sourceOptions[0]->value)) { unset($this->sourceOptions[0]); } // Source Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_SOURCE_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_SOURCE_LABEL').' -', 'batch[source]', - JHtml::_('select.options', $this->sourceOptions, 'value', 'text') + Html::_('select.options', $this->sourceOptions, 'value', 'text') ); } } @@ -266,10 +279,10 @@ class GetbibleViewOpen_ai_messages extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_OPEN_AI_MESSAGES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/open_ai_messages.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_OPEN_AI_MESSAGES')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/open_ai_messages.css", ['version' => 'auto']); } /** @@ -284,27 +297,27 @@ class GetbibleViewOpen_ai_messages extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.role' => JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ROLE_LABEL'), - 'g.response_id' => JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI_RESPONSE_LABEL'), - 'h.name' => JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_PROMPT_LABEL'), - 'a.source' => JText::_('COM_GETBIBLE_OPEN_AI_MESSAGE_SOURCE_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.role' => Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_ROLE_LABEL'), + 'g.response_id' => Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_OPEN_AI_RESPONSE_LABEL'), + 'h.name' => Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_PROMPT_LABEL'), + 'a.source' => Text::_('COM_GETBIBLE_OPEN_AI_MESSAGE_SOURCE_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/open_ai_response/submitbutton.js b/admin/views/open_ai_response/submitbutton.js index 975edef..ced4894 100644 --- a/admin/views/open_ai_response/submitbutton.js +++ b/admin/views/open_ai_response/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/open_ai_response/tmpl/edit.php b/admin/views/open_ai_response/tmpl/edit.php index 012a0b8..84b5158 100644 --- a/admin/views/open_ai_response/tmpl/edit.php +++ b/admin/views/open_ai_response/tmpl/edit.php @@ -18,106 +18,105 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/open_ai_responses/view.html.php b/admin/views/open_ai_responses/view.html.php index 699397a..b5cb4d8 100644 --- a/admin/views/open_ai_responses/view.html.php +++ b/admin/views/open_ai_responses/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Open_ai_responses @@ -41,7 +54,7 @@ class GetbibleViewOpen_ai_responses extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewOpen_ai_responses extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('open_ai_response'); $this->canEdit = $this->canDo->get('open_ai_response.edit'); @@ -71,7 +84,7 @@ class GetbibleViewOpen_ai_responses extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewOpen_ai_responses extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_OPEN_AI_RESPONSES'), 'reply'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=open_ai_responses'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_OPEN_AI_RESPONSES'), 'reply'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('open_ai_response.add'); + ToolbarHelper::addNew('open_ai_response.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('open_ai_response.edit'); + ToolbarHelper::editList('open_ai_response.edit'); } if ($this->canState) { - JToolBarHelper::publishList('open_ai_responses.publish'); - JToolBarHelper::unpublishList('open_ai_responses.unpublish'); - JToolBarHelper::archiveList('open_ai_responses.archive'); + ToolbarHelper::publishList('open_ai_responses.publish'); + ToolbarHelper::unpublishList('open_ai_responses.unpublish'); + ToolbarHelper::archiveList('open_ai_responses.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('open_ai_responses.checkin'); + ToolbarHelper::checkin('open_ai_responses.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'open_ai_responses.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'open_ai_responses.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('open_ai_responses.trash'); + ToolbarHelper::trash('open_ai_responses.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('open_ai_responses'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Response Id Selection - $this->response_idOptions = JFormHelper::loadFieldType('openairesponsesfilterresponseid')->options; + $this->response_idOptions = FormHelper::loadFieldType('openairesponsesfilterresponseid')->options; // We do some sanitation for Response Id filter - if (GetbibleHelper::checkArray($this->response_idOptions) && + if (ArrayHelper::check($this->response_idOptions) && isset($this->response_idOptions[0]->value) && - !GetbibleHelper::checkString($this->response_idOptions[0]->value)) + !StringHelper::check($this->response_idOptions[0]->value)) { unset($this->response_idOptions[0]); } // Response Id Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_ID_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_ID_LABEL').' -', 'batch[response_id]', - JHtml::_('select.options', $this->response_idOptions, 'value', 'text') + Html::_('select.options', $this->response_idOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Prompt Name Selection - $this->promptNameOptions = JFormHelper::loadFieldType('Prompts')->options; + $this->promptNameOptions = FormHelper::loadFieldType('Prompts')->options; // We do some sanitation for Prompt Name filter - if (GetbibleHelper::checkArray($this->promptNameOptions) && + if (ArrayHelper::check($this->promptNameOptions) && isset($this->promptNameOptions[0]->value) && - !GetbibleHelper::checkString($this->promptNameOptions[0]->value)) + !StringHelper::check($this->promptNameOptions[0]->value)) { unset($this->promptNameOptions[0]); } // Prompt Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_PROMPT_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_PROMPT_LABEL').' -', 'batch[prompt]', - JHtml::_('select.options', $this->promptNameOptions, 'value', 'text') + Html::_('select.options', $this->promptNameOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewOpen_ai_responses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Response Model Selection - $this->response_modelOptions = JFormHelper::loadFieldType('openairesponsesfilterresponsemodel')->options; + $this->response_modelOptions = FormHelper::loadFieldType('openairesponsesfilterresponsemodel')->options; // We do some sanitation for Response Model filter - if (GetbibleHelper::checkArray($this->response_modelOptions) && + if (ArrayHelper::check($this->response_modelOptions) && isset($this->response_modelOptions[0]->value) && - !GetbibleHelper::checkString($this->response_modelOptions[0]->value)) + !StringHelper::check($this->response_modelOptions[0]->value)) { unset($this->response_modelOptions[0]); } // Response Model Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_MODEL_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_MODEL_LABEL').' -', 'batch[response_model]', - JHtml::_('select.options', $this->response_modelOptions, 'value', 'text') + Html::_('select.options', $this->response_modelOptions, 'value', 'text') ); } } @@ -246,10 +259,10 @@ class GetbibleViewOpen_ai_responses extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_OPEN_AI_RESPONSES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/open_ai_responses.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_OPEN_AI_RESPONSES')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/open_ai_responses.css", ['version' => 'auto']); } /** @@ -264,28 +277,28 @@ class GetbibleViewOpen_ai_responses extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.response_id' => JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_ID_LABEL'), - 'g.name' => JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_PROMPT_LABEL'), - 'a.response_object' => JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_OBJECT_LABEL'), - 'a.response_model' => JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_MODEL_LABEL'), - 'a.total_tokens' => JText::_('COM_GETBIBLE_OPEN_AI_RESPONSE_TOTAL_TOKENS_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.response_id' => Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_ID_LABEL'), + 'g.name' => Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_PROMPT_LABEL'), + 'a.response_object' => Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_OBJECT_LABEL'), + 'a.response_model' => Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_RESPONSE_MODEL_LABEL'), + 'a.total_tokens' => Text::_('COM_GETBIBLE_OPEN_AI_RESPONSE_TOTAL_TOKENS_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/password/submitbutton.js b/admin/views/password/submitbutton.js index 91edb6e..8a448b3 100644 --- a/admin/views/password/submitbutton.js +++ b/admin/views/password/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/password/tmpl/edit.php b/admin/views/password/tmpl/edit.php index 9cb982d..1e68aaa 100644 --- a/admin/views/password/tmpl/edit.php +++ b/admin/views/password/tmpl/edit.php @@ -18,72 +18,71 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/passwords/view.html.php b/admin/views/passwords/view.html.php index d1613c1..9f9d0d3 100644 --- a/admin/views/passwords/view.html.php +++ b/admin/views/passwords/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Passwords @@ -41,7 +54,7 @@ class GetbibleViewPasswords extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewPasswords extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('password'); $this->canEdit = $this->canDo->get('password.edit'); @@ -71,7 +84,7 @@ class GetbibleViewPasswords extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewPasswords extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_PASSWORDS'), 'lock'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=passwords'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_PASSWORDS'), 'lock'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('password.add'); + ToolbarHelper::addNew('password.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('password.edit'); + ToolbarHelper::editList('password.edit'); } if ($this->canState) { - JToolBarHelper::publishList('passwords.publish'); - JToolBarHelper::unpublishList('passwords.unpublish'); - JToolBarHelper::archiveList('passwords.archive'); + ToolbarHelper::publishList('passwords.publish'); + ToolbarHelper::unpublishList('passwords.unpublish'); + ToolbarHelper::archiveList('passwords.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('passwords.checkin'); + ToolbarHelper::checkin('passwords.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewPasswords extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewPasswords extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'passwords.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'passwords.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('passwords.trash'); + ToolbarHelper::trash('passwords.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('passwords'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewPasswords extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewPasswords extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Name Selection - $this->nameOptions = JFormHelper::loadFieldType('passwordsfiltername')->options; + $this->nameOptions = FormHelper::loadFieldType('passwordsfiltername')->options; // We do some sanitation for Name filter - if (GetbibleHelper::checkArray($this->nameOptions) && + if (ArrayHelper::check($this->nameOptions) && isset($this->nameOptions[0]->value) && - !GetbibleHelper::checkString($this->nameOptions[0]->value)) + !StringHelper::check($this->nameOptions[0]->value)) { unset($this->nameOptions[0]); } // Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PASSWORD_NAME_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PASSWORD_NAME_LABEL').' -', 'batch[name]', - JHtml::_('select.options', $this->nameOptions, 'value', 'text') + Html::_('select.options', $this->nameOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewPasswords extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Linker Name Selection - $this->linkerNameOptions = JFormHelper::loadFieldType('Linkers')->options; + $this->linkerNameOptions = FormHelper::loadFieldType('Linkers')->options; // We do some sanitation for Linker Name filter - if (GetbibleHelper::checkArray($this->linkerNameOptions) && + if (ArrayHelper::check($this->linkerNameOptions) && isset($this->linkerNameOptions[0]->value) && - !GetbibleHelper::checkString($this->linkerNameOptions[0]->value)) + !StringHelper::check($this->linkerNameOptions[0]->value)) { unset($this->linkerNameOptions[0]); } // Linker Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PASSWORD_LINKER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PASSWORD_LINKER_LABEL').' -', 'batch[linker]', - JHtml::_('select.options', $this->linkerNameOptions, 'value', 'text') + Html::_('select.options', $this->linkerNameOptions, 'value', 'text') ); } } @@ -226,10 +239,10 @@ class GetbibleViewPasswords extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_PASSWORDS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/passwords.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_PASSWORDS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/passwords.css", ['version' => 'auto']); } /** @@ -244,25 +257,25 @@ class GetbibleViewPasswords extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_PASSWORD_NAME_LABEL'), - 'g.name' => JText::_('COM_GETBIBLE_PASSWORD_LINKER_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_PASSWORD_NAME_LABEL'), + 'g.name' => Text::_('COM_GETBIBLE_PASSWORD_LINKER_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/prompt/submitbutton.js b/admin/views/prompt/submitbutton.js index 1a18fec..44cf7b5 100644 --- a/admin/views/prompt/submitbutton.js +++ b/admin/views/prompt/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/prompt/tmpl/edit.php b/admin/views/prompt/tmpl/edit.php index bbd2658..929f2a1 100644 --- a/admin/views/prompt/tmpl/edit.php +++ b/admin/views/prompt/tmpl/edit.php @@ -18,88 +18,87 @@ // 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 ?> - integration); ?> + integration); ?> - cache_behaviour); ?> + cache_behaviour); ?> escape($item->abbreviation_translation); ?> @@ -88,21 +92,21 @@ $edit = "index.php?option=com_getbible&view=prompts&task=prompt.edit"; escape($item->guid); ?> - model); ?> + model); ?> get('prompt.edit.state')) : ?> checked_out) : ?> - published, $i, 'prompts.', true, 'cb'); ?> + published, $i, 'prompts.', true, 'cb'); ?> - published, $i, 'prompts.', false, 'cb'); ?> + published, $i, 'prompts.', false, 'cb'); ?> - published, $i, 'prompts.', true, 'cb'); ?> + published, $i, 'prompts.', true, 'cb'); ?> - published, $i, 'prompts.', false, 'cb'); ?> + published, $i, 'prompts.', false, 'cb'); ?> diff --git a/admin/views/prompts/tmpl/default_head.php b/admin/views/prompts/tmpl/default_head.php index e10490e..39dbd93 100644 --- a/admin/views/prompts/tmpl/default_head.php +++ b/admin/views/prompts/tmpl/default_head.php @@ -18,14 +18,17 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?> canEdit&& $this->canState): ?> - listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> - + @@ -36,33 +39,33 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - + - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/prompts/tmpl/default_toolbar.php b/admin/views/prompts/tmpl/default_toolbar.php index 8bf8855..df80f17 100644 --- a/admin/views/prompts/tmpl/default_toolbar.php +++ b/admin/views/prompts/tmpl/default_toolbar.php @@ -18,34 +18,37 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; + ?>
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/admin/views/prompts/view.html.php b/admin/views/prompts/view.html.php index 67c29b0..af779eb 100644 --- a/admin/views/prompts/view.html.php +++ b/admin/views/prompts/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Prompts @@ -41,7 +54,7 @@ class GetbibleViewPrompts extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewPrompts extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('prompt'); $this->canEdit = $this->canDo->get('prompt.edit'); @@ -71,7 +84,7 @@ class GetbibleViewPrompts extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewPrompts extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_PROMPTS'), 'puzzle'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=prompts'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_PROMPTS'), 'puzzle'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('prompt.add'); + ToolbarHelper::addNew('prompt.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('prompt.edit'); + ToolbarHelper::editList('prompt.edit'); } if ($this->canState) { - JToolBarHelper::publishList('prompts.publish'); - JToolBarHelper::unpublishList('prompts.unpublish'); - JToolBarHelper::archiveList('prompts.archive'); + ToolbarHelper::publishList('prompts.publish'); + ToolbarHelper::unpublishList('prompts.unpublish'); + ToolbarHelper::archiveList('prompts.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('prompts.checkin'); + ToolbarHelper::checkin('prompts.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewPrompts extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'prompts.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'prompts.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('prompts.trash'); + ToolbarHelper::trash('prompts.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('prompts'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Name Selection - $this->nameOptions = JFormHelper::loadFieldType('promptsfiltername')->options; + $this->nameOptions = FormHelper::loadFieldType('promptsfiltername')->options; // We do some sanitation for Name filter - if (GetbibleHelper::checkArray($this->nameOptions) && + if (ArrayHelper::check($this->nameOptions) && isset($this->nameOptions[0]->value) && - !GetbibleHelper::checkString($this->nameOptions[0]->value)) + !StringHelper::check($this->nameOptions[0]->value)) { unset($this->nameOptions[0]); } // Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PROMPT_NAME_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PROMPT_NAME_LABEL').' -', 'batch[name]', - JHtml::_('select.options', $this->nameOptions, 'value', 'text') + Html::_('select.options', $this->nameOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Cache Behaviour Selection - $this->cache_behaviourOptions = JFormHelper::loadFieldType('promptsfiltercachebehaviour')->options; + $this->cache_behaviourOptions = FormHelper::loadFieldType('promptsfiltercachebehaviour')->options; // We do some sanitation for Cache Behaviour filter - if (GetbibleHelper::checkArray($this->cache_behaviourOptions) && + if (ArrayHelper::check($this->cache_behaviourOptions) && isset($this->cache_behaviourOptions[0]->value) && - !GetbibleHelper::checkString($this->cache_behaviourOptions[0]->value)) + !StringHelper::check($this->cache_behaviourOptions[0]->value)) { unset($this->cache_behaviourOptions[0]); } // Cache Behaviour Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PROMPT_CACHE_BEHAVIOUR_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PROMPT_CACHE_BEHAVIOUR_LABEL').' -', 'batch[cache_behaviour]', - JHtml::_('select.options', $this->cache_behaviourOptions, 'value', 'text') + Html::_('select.options', $this->cache_behaviourOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Abbreviation Translation Selection - $this->abbreviationTranslationOptions = JFormHelper::loadFieldType('Targettranslations')->options; + $this->abbreviationTranslationOptions = FormHelper::loadFieldType('Targettranslations')->options; // We do some sanitation for Abbreviation Translation filter - if (GetbibleHelper::checkArray($this->abbreviationTranslationOptions) && + if (ArrayHelper::check($this->abbreviationTranslationOptions) && isset($this->abbreviationTranslationOptions[0]->value) && - !GetbibleHelper::checkString($this->abbreviationTranslationOptions[0]->value)) + !StringHelper::check($this->abbreviationTranslationOptions[0]->value)) { unset($this->abbreviationTranslationOptions[0]); } // Abbreviation Translation Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PROMPT_ABBREVIATION_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PROMPT_ABBREVIATION_LABEL').' -', 'batch[abbreviation]', - JHtml::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') + Html::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') ); } @@ -240,19 +253,19 @@ class GetbibleViewPrompts extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Model Selection - $this->modelOptions = JFormHelper::loadFieldType('promptsfiltermodel')->options; + $this->modelOptions = FormHelper::loadFieldType('promptsfiltermodel')->options; // We do some sanitation for Model filter - if (GetbibleHelper::checkArray($this->modelOptions) && + if (ArrayHelper::check($this->modelOptions) && isset($this->modelOptions[0]->value) && - !GetbibleHelper::checkString($this->modelOptions[0]->value)) + !StringHelper::check($this->modelOptions[0]->value)) { unset($this->modelOptions[0]); } // Model Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_PROMPT_MODEL_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_PROMPT_MODEL_LABEL').' -', 'batch[model]', - JHtml::_('select.options', $this->modelOptions, 'value', 'text') + Html::_('select.options', $this->modelOptions, 'value', 'text') ); } } @@ -266,10 +279,10 @@ class GetbibleViewPrompts extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_PROMPTS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/prompts.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_PROMPTS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/prompts.css", ['version' => 'auto']); } /** @@ -284,27 +297,27 @@ class GetbibleViewPrompts extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_PROMPT_NAME_LABEL'), - 'a.integration' => JText::_('COM_GETBIBLE_PROMPT_INTEGRATION_LABEL'), - 'a.cache_behaviour' => JText::_('COM_GETBIBLE_PROMPT_CACHE_BEHAVIOUR_LABEL'), - 'a.model' => JText::_('COM_GETBIBLE_PROMPT_MODEL_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_PROMPT_NAME_LABEL'), + 'a.integration' => Text::_('COM_GETBIBLE_PROMPT_INTEGRATION_LABEL'), + 'a.cache_behaviour' => Text::_('COM_GETBIBLE_PROMPT_CACHE_BEHAVIOUR_LABEL'), + 'a.model' => Text::_('COM_GETBIBLE_PROMPT_MODEL_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/tag/submitbutton.js b/admin/views/tag/submitbutton.js index a9ad492..c850697 100644 --- a/admin/views/tag/submitbutton.js +++ b/admin/views/tag/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/tag/tmpl/edit.php b/admin/views/tag/tmpl/edit.php index fa4b3c6..e44f39f 100644 --- a/admin/views/tag/tmpl/edit.php +++ b/admin/views/tag/tmpl/edit.php @@ -18,74 +18,73 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/tags/view.html.php b/admin/views/tags/view.html.php index 97a55fd..e21376b 100644 --- a/admin/views/tags/view.html.php +++ b/admin/views/tags/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Tags @@ -41,7 +54,7 @@ class GetbibleViewTags extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewTags extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('tag'); $this->canEdit = $this->canDo->get('tag.edit'); @@ -71,7 +84,7 @@ class GetbibleViewTags extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewTags extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_TAGS'), 'tags'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=tags'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_TAGS'), 'tags'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('tag.add'); + ToolbarHelper::addNew('tag.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('tag.edit'); + ToolbarHelper::editList('tag.edit'); } if ($this->canState) { - JToolBarHelper::publishList('tags.publish'); - JToolBarHelper::unpublishList('tags.unpublish'); - JToolBarHelper::archiveList('tags.archive'); + ToolbarHelper::publishList('tags.publish'); + ToolbarHelper::unpublishList('tags.unpublish'); + ToolbarHelper::archiveList('tags.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('tags.checkin'); + ToolbarHelper::checkin('tags.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewTags extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewTags extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'tags.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'tags.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('tags.trash'); + ToolbarHelper::trash('tags.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('tags'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,19 +183,19 @@ class GetbibleViewTags extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Linker Name Selection - $this->linkerNameOptions = JFormHelper::loadFieldType('Linkers')->options; + $this->linkerNameOptions = FormHelper::loadFieldType('Linkers')->options; // We do some sanitation for Linker Name filter - if (GetbibleHelper::checkArray($this->linkerNameOptions) && + if (ArrayHelper::check($this->linkerNameOptions) && isset($this->linkerNameOptions[0]->value) && - !GetbibleHelper::checkString($this->linkerNameOptions[0]->value)) + !StringHelper::check($this->linkerNameOptions[0]->value)) { unset($this->linkerNameOptions[0]); } // Linker Name Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_TAG_LINKER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_TAG_LINKER_LABEL').' -', 'batch[linker]', - JHtml::_('select.options', $this->linkerNameOptions, 'value', 'text') + Html::_('select.options', $this->linkerNameOptions, 'value', 'text') ); } @@ -190,19 +203,19 @@ class GetbibleViewTags extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Access Selection - $this->accessOptions = JFormHelper::loadFieldType('tagsfilteraccess')->options; + $this->accessOptions = FormHelper::loadFieldType('tagsfilteraccess')->options; // We do some sanitation for Access filter - if (GetbibleHelper::checkArray($this->accessOptions) && + if (ArrayHelper::check($this->accessOptions) && isset($this->accessOptions[0]->value) && - !GetbibleHelper::checkString($this->accessOptions[0]->value)) + !StringHelper::check($this->accessOptions[0]->value)) { unset($this->accessOptions[0]); } // Access Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_TAG_ACCESS_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_TAG_ACCESS_LABEL').' -', 'batch[access]', - JHtml::_('select.options', $this->accessOptions, 'value', 'text') + Html::_('select.options', $this->accessOptions, 'value', 'text') ); } } @@ -216,10 +229,10 @@ class GetbibleViewTags extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_TAGS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/tags.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_TAGS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/tags.css", ['version' => 'auto']); } /** @@ -234,26 +247,26 @@ class GetbibleViewTags extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_GETBIBLE_TAG_NAME_LABEL'), - 'g.name' => JText::_('COM_GETBIBLE_TAG_LINKER_LABEL'), - 'a.access' => JText::_('COM_GETBIBLE_TAG_ACCESS_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.name' => Text::_('COM_GETBIBLE_TAG_NAME_LABEL'), + 'g.name' => Text::_('COM_GETBIBLE_TAG_LINKER_LABEL'), + 'a.access' => Text::_('COM_GETBIBLE_TAG_ACCESS_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/translation/submitbutton.js b/admin/views/translation/submitbutton.js index 2db2bd4..867f56d 100644 --- a/admin/views/translation/submitbutton.js +++ b/admin/views/translation/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/translation/tmpl/edit.php b/admin/views/translation/tmpl/edit.php index e3eaf7b..796fd21 100644 --- a/admin/views/translation/tmpl/edit.php +++ b/admin/views/translation/tmpl/edit.php @@ -18,77 +18,76 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/translations/view.html.php b/admin/views/translations/view.html.php index 806f319..b335839 100644 --- a/admin/views/translations/view.html.php +++ b/admin/views/translations/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Translations @@ -41,7 +54,7 @@ class GetbibleViewTranslations extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewTranslations extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('translation'); $this->canEdit = $this->canDo->get('translation.edit'); @@ -71,7 +84,7 @@ class GetbibleViewTranslations extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewTranslations extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_TRANSLATIONS'), 'book'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=translations'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_TRANSLATIONS'), 'book'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('translation.add'); + ToolbarHelper::addNew('translation.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('translation.edit'); + ToolbarHelper::editList('translation.edit'); } if ($this->canState) { - JToolBarHelper::publishList('translations.publish'); - JToolBarHelper::unpublishList('translations.unpublish'); - JToolBarHelper::archiveList('translations.archive'); + ToolbarHelper::publishList('translations.publish'); + ToolbarHelper::unpublishList('translations.unpublish'); + ToolbarHelper::archiveList('translations.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('translations.checkin'); + ToolbarHelper::checkin('translations.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewTranslations extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,44 +148,44 @@ class GetbibleViewTranslations extends HtmlView if ($this->user->authorise('translation.update_book_names', 'com_getbible')) { // add Update Book Names button. - JToolBarHelper::custom('translations.updateBookNames', 'bookmark custom-button-updatebooknames', '', 'COM_GETBIBLE_UPDATE_BOOK_NAMES', 'true'); + ToolbarHelper::custom('translations.updateBookNames', 'bookmark custom-button-updatebooknames', '', 'COM_GETBIBLE_UPDATE_BOOK_NAMES', 'true'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'translations.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'translations.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('translations.trash'); + ToolbarHelper::trash('translations.trash'); } } if ($this->user->authorise('translation.update_translations_details', 'com_getbible')) { // add Update Translations Details button. - JToolBarHelper::custom('translations.updateTranslationsDetails', 'book custom-button-updatetranslationsdetails', '', 'COM_GETBIBLE_UPDATE_TRANSLATIONS_DETAILS', false); + ToolbarHelper::custom('translations.updateTranslationsDetails', 'book custom-button-updatetranslationsdetails', '', 'COM_GETBIBLE_UPDATE_TRANSLATIONS_DETAILS', false); } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('translations'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -180,9 +193,9 @@ class GetbibleViewTranslations extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -190,19 +203,19 @@ class GetbibleViewTranslations extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Direction Selection - $this->directionOptions = JFormHelper::loadFieldType('translationsfilterdirection')->options; + $this->directionOptions = FormHelper::loadFieldType('translationsfilterdirection')->options; // We do some sanitation for Direction filter - if (GetbibleHelper::checkArray($this->directionOptions) && + if (ArrayHelper::check($this->directionOptions) && isset($this->directionOptions[0]->value) && - !GetbibleHelper::checkString($this->directionOptions[0]->value)) + !StringHelper::check($this->directionOptions[0]->value)) { unset($this->directionOptions[0]); } // Direction Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_TRANSLATION_DIRECTION_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_TRANSLATION_DIRECTION_LABEL').' -', 'batch[direction]', - JHtml::_('select.options', $this->directionOptions, 'value', 'text') + Html::_('select.options', $this->directionOptions, 'value', 'text') ); } } @@ -216,10 +229,10 @@ class GetbibleViewTranslations extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_TRANSLATIONS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/translations.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_TRANSLATIONS')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/translations.css", ['version' => 'auto']); } /** @@ -234,27 +247,27 @@ class GetbibleViewTranslations extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.translation' => JText::_('COM_GETBIBLE_TRANSLATION_TRANSLATION_LABEL'), - 'a.abbreviation' => JText::_('COM_GETBIBLE_TRANSLATION_ABBREVIATION_LABEL'), - 'a.language' => JText::_('COM_GETBIBLE_TRANSLATION_LANGUAGE_LABEL'), - 'a.direction' => JText::_('COM_GETBIBLE_TRANSLATION_DIRECTION_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.translation' => Text::_('COM_GETBIBLE_TRANSLATION_TRANSLATION_LABEL'), + 'a.abbreviation' => Text::_('COM_GETBIBLE_TRANSLATION_ABBREVIATION_LABEL'), + 'a.language' => Text::_('COM_GETBIBLE_TRANSLATION_LANGUAGE_LABEL'), + 'a.direction' => Text::_('COM_GETBIBLE_TRANSLATION_DIRECTION_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/admin/views/verse/submitbutton.js b/admin/views/verse/submitbutton.js index 82b9203..615777c 100644 --- a/admin/views/verse/submitbutton.js +++ b/admin/views/verse/submitbutton.js @@ -18,7 +18,7 @@ Joomla.submitbutton = function(task) { if (task == ''){ return false; - } else { + } else { var action = task.split('.'); if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ Joomla.submitform(task, document.getElementById("adminForm")); diff --git a/admin/views/verse/tmpl/edit.php b/admin/views/verse/tmpl/edit.php index 9600416..7fae5c6 100644 --- a/admin/views/verse/tmpl/edit.php +++ b/admin/views/verse/tmpl/edit.php @@ -18,77 +18,76 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; +Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +Html::_('behavior.formvalidator'); +Html::_('formbehavior.chosen', 'select'); +Html::_('behavior.keepalive'); + $componentParams = $this->params; // will be removed just use $this->params instead ?>
\ No newline at end of file diff --git a/admin/views/verses/view.html.php b/admin/views/verses/view.html.php index ccd8de3..6fd968f 100644 --- a/admin/views/verses/view.html.php +++ b/admin/views/verses/view.html.php @@ -18,7 +18,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\StringHelper; /** * Getbible Html View class for the Verses @@ -41,7 +54,7 @@ class GetbibleViewVerses extends HtmlView $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. @@ -51,7 +64,7 @@ class GetbibleViewVerses extends HtmlView $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + $this->return_here = urlencode(base64_encode((string) Uri::getInstance())); // get global action permissions $this->canDo = GetbibleHelper::getActions('verse'); $this->canEdit = $this->canDo->get('verse.edit'); @@ -71,7 +84,7 @@ class GetbibleViewVerses extends HtmlView $this->batchDisplay = JHtmlBatch_::render(); } } - + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -90,32 +103,32 @@ class GetbibleViewVerses extends HtmlView */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_GETBIBLE_VERSES'), 'generic'); JHtmlSidebar::setAction('index.php?option=com_getbible&view=verses'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + ToolbarHelper::title(Text::_('COM_GETBIBLE_VERSES'), 'generic'); + FormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { - JToolBarHelper::addNew('verse.add'); + ToolbarHelper::addNew('verse.add'); } // Only load if there are items - if (GetbibleHelper::checkArray($this->items)) + if (ArrayHelper::check($this->items)) { if ($this->canEdit) { - JToolBarHelper::editList('verse.edit'); + ToolbarHelper::editList('verse.edit'); } if ($this->canState) { - JToolBarHelper::publishList('verses.publish'); - JToolBarHelper::unpublishList('verses.unpublish'); - JToolBarHelper::archiveList('verses.archive'); + ToolbarHelper::publishList('verses.publish'); + ToolbarHelper::unpublishList('verses.unpublish'); + ToolbarHelper::archiveList('verses.archive'); if ($this->canDo->get('core.admin')) { - JToolBarHelper::checkin('verses.checkin'); + ToolbarHelper::checkin('verses.checkin'); } } @@ -123,11 +136,11 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); + $title = Text::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); + $layout = new FileLayout('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); @@ -135,34 +148,34 @@ class GetbibleViewVerses extends HtmlView if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { - JToolbarHelper::deleteList('', 'verses.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::deleteList('', 'verses.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { - JToolbarHelper::trash('verses.trash'); + ToolbarHelper::trash('verses.trash'); } } // set help url for this view if found $this->help_url = GetbibleHelper::getHelpUrl('verses'); - 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); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_getbible'); + ToolbarHelper::preferences('com_getbible'); } // Only load published batch if state and batch is allowed if ($this->canState && $this->canBatch) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_STATE'), 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + Html::_('select.options', Html::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); } @@ -170,9 +183,9 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection( - JText::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), + Text::_('COM_GETBIBLE_KEEP_ORIGINAL_ACCESS'), 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + Html::_('select.options', Html::_('access.assetgroups'), 'value', 'text') ); } @@ -180,19 +193,19 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Book Nr Selection - $this->book_nrOptions = JFormHelper::loadFieldType('versesfilterbooknr')->options; + $this->book_nrOptions = FormHelper::loadFieldType('versesfilterbooknr')->options; // We do some sanitation for Book Nr filter - if (GetbibleHelper::checkArray($this->book_nrOptions) && + if (ArrayHelper::check($this->book_nrOptions) && isset($this->book_nrOptions[0]->value) && - !GetbibleHelper::checkString($this->book_nrOptions[0]->value)) + !StringHelper::check($this->book_nrOptions[0]->value)) { unset($this->book_nrOptions[0]); } // Book Nr Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_VERSE_BOOK_NR_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_VERSE_BOOK_NR_LABEL').' -', 'batch[book_nr]', - JHtml::_('select.options', $this->book_nrOptions, 'value', 'text') + Html::_('select.options', $this->book_nrOptions, 'value', 'text') ); } @@ -200,19 +213,19 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Chapter Selection - $this->chapterOptions = JFormHelper::loadFieldType('versesfilterchapter')->options; + $this->chapterOptions = FormHelper::loadFieldType('versesfilterchapter')->options; // We do some sanitation for Chapter filter - if (GetbibleHelper::checkArray($this->chapterOptions) && + if (ArrayHelper::check($this->chapterOptions) && isset($this->chapterOptions[0]->value) && - !GetbibleHelper::checkString($this->chapterOptions[0]->value)) + !StringHelper::check($this->chapterOptions[0]->value)) { unset($this->chapterOptions[0]); } // Chapter Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_VERSE_CHAPTER_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_VERSE_CHAPTER_LABEL').' -', 'batch[chapter]', - JHtml::_('select.options', $this->chapterOptions, 'value', 'text') + Html::_('select.options', $this->chapterOptions, 'value', 'text') ); } @@ -220,19 +233,19 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Verse Selection - $this->verseOptions = JFormHelper::loadFieldType('versesfilterverse')->options; + $this->verseOptions = FormHelper::loadFieldType('versesfilterverse')->options; // We do some sanitation for Verse filter - if (GetbibleHelper::checkArray($this->verseOptions) && + if (ArrayHelper::check($this->verseOptions) && isset($this->verseOptions[0]->value) && - !GetbibleHelper::checkString($this->verseOptions[0]->value)) + !StringHelper::check($this->verseOptions[0]->value)) { unset($this->verseOptions[0]); } // Verse Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_VERSE_VERSE_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_VERSE_VERSE_LABEL').' -', 'batch[verse]', - JHtml::_('select.options', $this->verseOptions, 'value', 'text') + Html::_('select.options', $this->verseOptions, 'value', 'text') ); } @@ -240,19 +253,19 @@ class GetbibleViewVerses extends HtmlView if ($this->canBatch && $this->canCreate && $this->canEdit) { // Set Abbreviation Translation Selection - $this->abbreviationTranslationOptions = JFormHelper::loadFieldType('Translations')->options; + $this->abbreviationTranslationOptions = FormHelper::loadFieldType('Translations')->options; // We do some sanitation for Abbreviation Translation filter - if (GetbibleHelper::checkArray($this->abbreviationTranslationOptions) && + if (ArrayHelper::check($this->abbreviationTranslationOptions) && isset($this->abbreviationTranslationOptions[0]->value) && - !GetbibleHelper::checkString($this->abbreviationTranslationOptions[0]->value)) + !StringHelper::check($this->abbreviationTranslationOptions[0]->value)) { unset($this->abbreviationTranslationOptions[0]); } // Abbreviation Translation Batch Selection JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_GETBIBLE_VERSE_ABBREVIATION_LABEL').' -', + '- Keep Original '.Text::_('COM_GETBIBLE_VERSE_ABBREVIATION_LABEL').' -', 'batch[abbreviation]', - JHtml::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') + Html::_('select.options', $this->abbreviationTranslationOptions, 'value', 'text') ); } } @@ -266,10 +279,10 @@ class GetbibleViewVerses extends HtmlView { if (!isset($this->document)) { - $this->document = JFactory::getDocument(); + $this->document = Factory::getDocument(); } - $this->document->setTitle(JText::_('COM_GETBIBLE_VERSES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_getbible/assets/css/verses.css", (GetbibleHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->setTitle(Text::_('COM_GETBIBLE_VERSES')); + Html::_('stylesheet', "administrator/components/com_getbible/assets/css/verses.css", ['version' => 'auto']); } /** @@ -284,27 +297,27 @@ class GetbibleViewVerses extends HtmlView if(strlen($var) > 50) { // use the helper htmlEscape method instead and shorten the string - return GetbibleHelper::htmlEscape($var, $this->_charset, true); + return StringHelper::html($var, $this->_charset, true); } // use the helper htmlEscape method instead. - return GetbibleHelper::htmlEscape($var, $this->_charset); + return StringHelper::html($var, $this->_charset); } /** * Returns an array of fields the table can be sorted by * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value */ protected function getSortFields() { return array( - 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.book_nr' => JText::_('COM_GETBIBLE_VERSE_BOOK_NR_LABEL'), - 'a.chapter' => JText::_('COM_GETBIBLE_VERSE_CHAPTER_LABEL'), - 'a.verse' => JText::_('COM_GETBIBLE_VERSE_VERSE_LABEL'), - 'g.translation' => JText::_('COM_GETBIBLE_VERSE_ABBREVIATION_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.book_nr' => Text::_('COM_GETBIBLE_VERSE_BOOK_NR_LABEL'), + 'a.chapter' => Text::_('COM_GETBIBLE_VERSE_CHAPTER_LABEL'), + 'a.verse' => Text::_('COM_GETBIBLE_VERSE_VERSE_LABEL'), + 'g.translation' => Text::_('COM_GETBIBLE_VERSE_ABBREVIATION_LABEL'), + 'a.id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/getbible.xml b/getbible.xml index 7097c55..06a2b3f 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 4th December, 2023 + 22nd January, 2024 Llewellyn van der Merwe joomla@vdm.io https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.0.32 + 3.0.0 Get Bible (v.2.0.32) +

Get Bible (v.3.0.0)

Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide. @@ -116,6 +116,6 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is - https://git.vdm.dev/getBible/joomla-component/raw/branch/master/update_server.xml + https://git.vdm.dev/getBible/joomla-component/raw/branch/3.10/update_server.xml \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php index 6c5b3c6..ea65e1c 100644 --- a/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php +++ b/libraries/jcb_powers/VDM.Joomla.Gitea/src/Utilities/Http.php @@ -52,7 +52,7 @@ final class Http extends JoomlaHttp // add the token if given if (is_string($token)) { - $config['headers']['Authorization'] = 'token ' . $token; + $config['headers']['Authorization'] = $token; $this->_token_ = $token; } @@ -78,7 +78,7 @@ final class Http extends JoomlaHttp ); // add the token - $headers['Authorization'] = 'token ' . $token; + $headers['Authorization'] = $token; $this->_token_ = $token; $this->setOption('headers', $headers); diff --git a/libraries/jcb_powers/VDM.Joomla/src/Abstraction/BaseConfig.php b/libraries/jcb_powers/VDM.Joomla/src/Abstraction/BaseConfig.php index fbd3c09..c4debc2 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Abstraction/BaseConfig.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Abstraction/BaseConfig.php @@ -42,7 +42,7 @@ abstract class BaseConfig extends JoomlaRegistry * * @since 3.2.0 */ - public function __set(string $key, $value) + public function __set($key, $value) { $this->set($key, $value); } @@ -50,12 +50,12 @@ abstract class BaseConfig extends JoomlaRegistry /** * getting any valid value * - * @param string $key The value's key/path name + * @param string $key The value's key/path name * * @since 3.2.0 * @throws \InvalidArgumentException If $key is not a valid function name. */ - public function __get(string $key) + public function __get($key) { // check if it has been set if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_') diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php index 61dbf59..4c4198f 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/Component/Helper.php @@ -15,6 +15,7 @@ namespace VDM\Joomla\Utilities\Component; use Joomla\Input\Input; use Joomla\CMS\Component\ComponentHelper; use Joomla\Registry\Registry; +use VDM\Joomla\Utilities\String\NamespaceHelper; /** @@ -32,6 +33,14 @@ abstract class Helper */ public static string $option; + /** + * The component manifest list cache + * + * @var array + * @since 3.2.0 + */ + public static array $manifest = []; + /** * The component params list cache * @@ -79,7 +88,7 @@ abstract class Helper if (empty(self::$option)) { // get the option from the url input - self::$option = (new Input)->getString('option', false); + self::$option = (new Input)->getString('option', null); } if (self::$option) @@ -129,20 +138,92 @@ abstract class Helper { // check that we have an option // and get the code name from it - if (($code_name = self::getCode($option, false)) !== false) + if (($code_name = self::getCode($option, null)) !== null) { // we build the helper class name $helper_name = '\\' . \ucfirst($code_name) . 'Helper'; + // check if class exist if (class_exists($helper_name)) { return $helper_name; } + + // try loading namespace + if (($namespace = self::getNamespace($option)) !== null) + { + $name = \ucfirst($code_name) . 'Helper'; + $namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin... + if (class_exists($namespace_helper)) + { + return $namespace_helper; + } + } } return $default; } + /** + * Gets the component namespace if set + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return string|null A component namespace + * + * @since 3.0.11 + */ + public static function getNamespace(?string $option = null): ?string + { + $manifest = self::getManifest($option); + + return $manifest->namespace ?? null; + } + + /** + * Gets the component abstract helper class + * + * @param string|null $option The option for the component. + * @param string|null $default The default return value if none is found + * + * @return object|null A component helper name + * + * @since 3.0.11 + */ + public static function getManifest(?string $option = null): ?object + { + if ($option === null + && ($option = self::getOption($option)) === null) + { + return null; + } + + // get global manifest_cache values + if (!isset(self::$manifest[$option])) + { + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + $query->select($db->quoteName('manifest_cache')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('component')) + ->where($db->quoteName('element') . ' LIKE ' . $db->quote($option)); + + $db->setQuery($query); + + try { + $manifest = $db->loadResult(); + self::$manifest[$option] = json_decode($manifest); + } catch (\Exception $e) { + // Handle the database error appropriately. + self::$manifest[$option] = null; + } + } + + return self::$manifest[$option]; + } + /** * Check if the helper class of this component has a method * @@ -156,7 +237,7 @@ abstract class Helper public static function methodExists(string $method, string $option = null): bool { // get the helper class - return ($helper = self::get($option, false)) !== false && + return ($helper = self::get($option, null)) !== null && method_exists($helper, $method); } @@ -173,7 +254,7 @@ abstract class Helper public static function _(string $method, array $arguments = [], ?string $option = null) { // get the helper class - if (($helper = self::get($option, false)) !== false && + if (($helper = self::get($option, null)) !== null && method_exists($helper, $method)) { // we know this is not ideal... diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php index 0dd04d8..7d1dd0a 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php @@ -89,8 +89,8 @@ abstract class FileHelper /** * get the content of a file * - * @param string $path The path to the file - * @param string/bool $none The return value if no content was found + * @param string $path The path to the file + * @param mixed $none The return value if no content was found * * @return string On success * @@ -150,7 +150,7 @@ abstract class FileHelper * * @since 3.0.9 */ - public static function write($path, $data) + public static function write($path, $data): bool { $klaar = false; if (StringHelper::check($data)) @@ -179,11 +179,11 @@ abstract class FileHelper * @param string $folder The local path to parse * @param array $fileTypes The type of files to get * - * @return void + * @return array|null * * @since 3.0.9 */ - public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) + public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array { if (Folder::exists($folder)) { @@ -219,7 +219,7 @@ abstract class FileHelper // return array of files return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files)); } - return false; + return null; } /** @@ -236,7 +236,7 @@ abstract class FileHelper * * @since 3.0.9 */ - public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) + public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true): string { // make sure to always have a string/path if(!StringHelper::check($default)) @@ -316,7 +316,7 @@ abstract class FileHelper * * @since 3.0.9 */ - public static function exists($path) + public static function exists($path): bool { $exists = false; // if this is a local path diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php index e219473..14a1148 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php @@ -138,7 +138,7 @@ abstract class GuidHelper * @param string|array $what * @param string|null $component * - * @return mix + * @return mixed * * @since 3.0.9 */ diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php new file mode 100644 index 0000000..55ee2e4 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php @@ -0,0 +1,78 @@ + + * @git Joomla Component Builder + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a namespace helper + * + * @since 3.0.9 + */ +abstract class NamespaceHelper +{ + /** + * Making namespace safe + * + * @param string $string The namespace string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safe(string $string): string + { + // Remove leading and trailing backslashes + $string = trim($string, '\\'); + + // Split the string into namespace segments + $segments = explode('\\', $string); + + // make each segment safe + $segments = array_map([self::class, 'safeSegment'], $segments); + + // Join the namespace segments back together + return implode('\\', $segments); + } + + /** + * Making one namespace segment safe + * + * @param string $string The namespace segment string you would like to make safe + * + * @return string on success + * @since 3.0.9 + */ + public static function safeSegment(string $string): string + { + // Check if segment starts with a number + if (preg_match("/^\d/", $string)) + { + // Extract the starting number(s) + preg_match("/^\d+/", $string, $matches); + + if (isset($matches[0])) + { + $numberWord = StringHelper::numbers($matches[0]); + $string = str_replace($matches[0], $numberWord, $string); + } + } + + // Transliterate string TODO: look again as this makes it lowercase + // $segment = StringHelper::transliterate($segment); + + // Make sure segment only contains valid characters + return preg_replace("/[^A-Za-z0-9]/", '', $string); + } +} + diff --git a/media/js/book.js b/media/js/book.js index e8582fd..d167f24 100644 --- a/media/js/book.js +++ b/media/js/book.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/chapter.js b/media/js/chapter.js index e8582fd..d167f24 100644 --- a/media/js/chapter.js +++ b/media/js/chapter.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/linker.js b/media/js/linker.js index e8582fd..d167f24 100644 --- a/media/js/linker.js +++ b/media/js/linker.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/note.js b/media/js/note.js index e8582fd..d167f24 100644 --- a/media/js/note.js +++ b/media/js/note.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/open_ai_message.js b/media/js/open_ai_message.js index e8582fd..d167f24 100644 --- a/media/js/open_ai_message.js +++ b/media/js/open_ai_message.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/open_ai_response.js b/media/js/open_ai_response.js index e8582fd..d167f24 100644 --- a/media/js/open_ai_response.js +++ b/media/js/open_ai_response.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/password.js b/media/js/password.js index e8582fd..d167f24 100644 --- a/media/js/password.js +++ b/media/js/password.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/prompt.js b/media/js/prompt.js index e0fc064..cf181f5 100644 --- a/media/js/prompt.js +++ b/media/js/prompt.js @@ -55,4 +55,4 @@ class DynamicFieldManager { }); } } -} +} diff --git a/media/js/tag.js b/media/js/tag.js index e8582fd..d167f24 100644 --- a/media/js/tag.js +++ b/media/js/tag.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/tagged_verse.js b/media/js/tagged_verse.js index e8582fd..d167f24 100644 --- a/media/js/tagged_verse.js +++ b/media/js/tagged_verse.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/translation.js b/media/js/translation.js index e8582fd..d167f24 100644 --- a/media/js/translation.js +++ b/media/js/translation.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/media/js/verse.js b/media/js/verse.js index e8582fd..d167f24 100644 --- a/media/js/verse.js +++ b/media/js/verse.js @@ -14,4 +14,4 @@ /------------------------------------------------------------------------------------------------------*/ - + diff --git a/script.php b/script.php index f0bf91d..cec44cf 100644 --- a/script.php +++ b/script.php @@ -18,20 +18,24 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Adapter\ComponentAdapter; -JHTML::_('bootstrap.renderModal'); +use Joomla\CMS\Version; +use Joomla\CMS\HTML\HTMLHelper as Html; +HTML::_('bootstrap.renderModal'); /** * Script File of Getbible Component */ -class com_getbibleInstallerScript +class Com_GetbibleInstallerScript { /** * Constructor * - * @param JAdapterInstance $parent The object responsible for running this script + * @param ComponentAdapter $parent The object responsible for running this script */ public function __construct(ComponentAdapter $parent) {} @@ -52,10 +56,10 @@ class com_getbibleInstallerScript public function uninstall(ComponentAdapter $parent) { // Get Application object - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -85,7 +89,7 @@ class com_getbibleInstallerScript if ($note_done) { // If successfully remove Note add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.note) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.note) type alias was removed from the #__content_type table')); } // Remove Note items from the contentitem tag map table @@ -100,7 +104,7 @@ class com_getbibleInstallerScript if ($note_done) { // If successfully remove Note add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.note) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.note) type alias was removed from the #__contentitem_tag_map table')); } // Remove Note items from the ucm content table @@ -115,7 +119,7 @@ class com_getbibleInstallerScript if ($note_done) { // If successfully removed Note add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.note) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.note) type alias was removed from the #__ucm_content table')); } // Make sure that all the Note items are cleared from DB @@ -171,7 +175,7 @@ class com_getbibleInstallerScript if ($tagged_verse_done) { // If successfully remove Tagged_verse add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tagged_verse) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.tagged_verse) type alias was removed from the #__content_type table')); } // Remove Tagged_verse items from the contentitem tag map table @@ -186,7 +190,7 @@ class com_getbibleInstallerScript if ($tagged_verse_done) { // If successfully remove Tagged_verse add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tagged_verse) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.tagged_verse) type alias was removed from the #__contentitem_tag_map table')); } // Remove Tagged_verse items from the ucm content table @@ -201,7 +205,7 @@ class com_getbibleInstallerScript if ($tagged_verse_done) { // If successfully removed Tagged_verse add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tagged_verse) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.tagged_verse) type alias was removed from the #__ucm_content table')); } // Make sure that all the Tagged_verse items are cleared from DB @@ -257,7 +261,7 @@ class com_getbibleInstallerScript if ($prompt_done) { // If successfully remove Prompt add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.prompt) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.prompt) type alias was removed from the #__content_type table')); } // Remove Prompt items from the contentitem tag map table @@ -272,7 +276,7 @@ class com_getbibleInstallerScript if ($prompt_done) { // If successfully remove Prompt add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.prompt) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.prompt) type alias was removed from the #__contentitem_tag_map table')); } // Remove Prompt items from the ucm content table @@ -287,7 +291,7 @@ class com_getbibleInstallerScript if ($prompt_done) { // If successfully removed Prompt add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.prompt) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.prompt) type alias was removed from the #__ucm_content table')); } // Make sure that all the Prompt items are cleared from DB @@ -343,7 +347,7 @@ class com_getbibleInstallerScript if ($open_ai_response_done) { // If successfully remove Open_ai_response add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_response) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_response) type alias was removed from the #__content_type table')); } // Remove Open_ai_response items from the contentitem tag map table @@ -358,7 +362,7 @@ class com_getbibleInstallerScript if ($open_ai_response_done) { // If successfully remove Open_ai_response add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_response) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_response) type alias was removed from the #__contentitem_tag_map table')); } // Remove Open_ai_response items from the ucm content table @@ -373,7 +377,7 @@ class com_getbibleInstallerScript if ($open_ai_response_done) { // If successfully removed Open_ai_response add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_response) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_response) type alias was removed from the #__ucm_content table')); } // Make sure that all the Open_ai_response items are cleared from DB @@ -429,7 +433,7 @@ class com_getbibleInstallerScript if ($open_ai_message_done) { // If successfully remove Open_ai_message add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_message) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_message) type alias was removed from the #__content_type table')); } // Remove Open_ai_message items from the contentitem tag map table @@ -444,7 +448,7 @@ class com_getbibleInstallerScript if ($open_ai_message_done) { // If successfully remove Open_ai_message add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_message) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_message) type alias was removed from the #__contentitem_tag_map table')); } // Remove Open_ai_message items from the ucm content table @@ -459,7 +463,7 @@ class com_getbibleInstallerScript if ($open_ai_message_done) { // If successfully removed Open_ai_message add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.open_ai_message) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.open_ai_message) type alias was removed from the #__ucm_content table')); } // Make sure that all the Open_ai_message items are cleared from DB @@ -515,7 +519,7 @@ class com_getbibleInstallerScript if ($tag_done) { // If successfully remove Tag add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tag) type alias was removed from the #__content_type table')); + $app->enqueueMessage(Text::_('The (com_getbible.tag) type alias was removed from the #__content_type table')); } // Remove Tag items from the contentitem tag map table @@ -530,7 +534,7 @@ class com_getbibleInstallerScript if ($tag_done) { // If successfully remove Tag add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tag) type alias was removed from the #__contentitem_tag_map table')); + $app->enqueueMessage(Text::_('The (com_getbible.tag) type alias was removed from the #__contentitem_tag_map table')); } // Remove Tag items from the ucm content table @@ -545,7 +549,7 @@ class com_getbibleInstallerScript if ($tag_done) { // If successfully removed Tag add queued success message. - $app->enqueueMessage(JText::_('The (com_getbible.tag) type alias was removed from the #__ucm_content table')); + $app->enqueueMessage(Text::_('The (com_getbible.tag) type alias was removed from the #__ucm_content table')); } // Make sure that all the Tag items are cleared from DB @@ -574,8 +578,8 @@ class com_getbibleInstallerScript } // If All related items was removed queued success message. - $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table')); - $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__ucm_base table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__ucm_history table')); // Remove getbible assets from the assets table $getbible_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_getbible%') ); @@ -589,7 +593,7 @@ class com_getbibleInstallerScript if ($tag_done) { // If successfully removed getbible add queued success message. - $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); + $app->enqueueMessage(Text::_('All related items was removed from the #__assets table')); } // Get the biggest rule column in the assets table at this point. @@ -605,24 +609,24 @@ class com_getbibleInstallerScript $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; $db->setQuery($revert_rule); $db->execute(); - $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); + $app->enqueueMessage(Text::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); } else { - $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); + $app->enqueueMessage(Text::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); } } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible from the action_logs_extensions table $getbible_action_logs_extensions = array( $db->quoteName('extension') . ' = ' . $db->quote('com_getbible') ); @@ -636,18 +640,18 @@ class com_getbibleInstallerScript if ($getbible_removed_done) { // If successfully remove Getbible add queued success message. - $app->enqueueMessage(JText::_('The com_getbible extension was removed from the #__action_logs_extensions table')); + $app->enqueueMessage(Text::_('The com_getbible extension was removed from the #__action_logs_extensions table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Linker from the action_log_config table $linker_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.linker') ); @@ -661,18 +665,18 @@ class com_getbibleInstallerScript if ($linker_action_log_config_done) { // If successfully removed Getbible Linker add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.linker type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.linker type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Note from the action_log_config table $note_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.note') ); @@ -686,18 +690,18 @@ class com_getbibleInstallerScript if ($note_action_log_config_done) { // If successfully removed Getbible Note add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.note type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.note type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Tagged_verse from the action_log_config table $tagged_verse_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.tagged_verse') ); @@ -711,18 +715,18 @@ class com_getbibleInstallerScript if ($tagged_verse_action_log_config_done) { // If successfully removed Getbible Tagged_verse add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.tagged_verse type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.tagged_verse type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Prompt from the action_log_config table $prompt_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.prompt') ); @@ -736,18 +740,18 @@ class com_getbibleInstallerScript if ($prompt_action_log_config_done) { // If successfully removed Getbible Prompt add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.prompt type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.prompt type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Open_ai_response from the action_log_config table $open_ai_response_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.open_ai_response') ); @@ -761,18 +765,18 @@ class com_getbibleInstallerScript if ($open_ai_response_action_log_config_done) { // If successfully removed Getbible Open_ai_response add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.open_ai_response type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.open_ai_response type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Open_ai_message from the action_log_config table $open_ai_message_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.open_ai_message') ); @@ -786,18 +790,18 @@ class com_getbibleInstallerScript if ($open_ai_message_action_log_config_done) { // If successfully removed Getbible Open_ai_message add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.open_ai_message type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.open_ai_message type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Password from the action_log_config table $password_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.password') ); @@ -811,18 +815,18 @@ class com_getbibleInstallerScript if ($password_action_log_config_done) { // If successfully removed Getbible Password add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.password type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.password type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Tag from the action_log_config table $tag_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.tag') ); @@ -836,18 +840,18 @@ class com_getbibleInstallerScript if ($tag_action_log_config_done) { // If successfully removed Getbible Tag add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.tag type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.tag type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Translation from the action_log_config table $translation_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.translation') ); @@ -861,18 +865,18 @@ class com_getbibleInstallerScript if ($translation_action_log_config_done) { // If successfully removed Getbible Translation add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.translation type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.translation type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Book from the action_log_config table $book_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.book') ); @@ -886,18 +890,18 @@ class com_getbibleInstallerScript if ($book_action_log_config_done) { // If successfully removed Getbible Book add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.book type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.book type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Chapter from the action_log_config table $chapter_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.chapter') ); @@ -911,18 +915,18 @@ class com_getbibleInstallerScript if ($chapter_action_log_config_done) { // If successfully removed Getbible Chapter add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.chapter type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.chapter type alias was removed from the #__action_log_config table')); } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Getbible Verse from the action_log_config table $verse_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_getbible.verse') ); @@ -936,7 +940,7 @@ class com_getbibleInstallerScript if ($verse_action_log_config_done) { // If successfully removed Getbible Verse add queued success message. - $app->enqueueMessage(JText::_('The com_getbible.verse type alias was removed from the #__action_log_config table')); + $app->enqueueMessage(Text::_('The com_getbible.verse type alias was removed from the #__action_log_config table')); } // little notice as after service, in case of bad experience with component. echo '

Did something go wrong? Are you disappointed?

@@ -966,14 +970,14 @@ class com_getbibleInstallerScript public function preflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // is redundant or so it seems ...hmmm let me know if it works again if ($type === 'uninstall') { return true; } // the default for both install and update - $jversion = new JVersion(); + $jversion = new Version(); if (!$jversion->isCompatible('3.8.0')) { $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); @@ -1021,7 +1025,7 @@ class com_getbibleInstallerScript public function postflight($type, ComponentAdapter $parent) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // We check if we have dynamic folders to copy $this->setDynamicF0ld3rs($app, $parent); // set the default component settings @@ -1029,7 +1033,7 @@ class com_getbibleInstallerScript { // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create the note content type object. $note = new stdClass(); @@ -1104,20 +1108,6 @@ class com_getbibleInstallerScript $tag_Inserted = $db->insertObject('#__content_types', $tag); - // Install the global extension params. - $query = $db->getQuery(true); - // Field to update. - $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","default_translation":"kjv","show_install_button":"0","show_getbible_logo":"1","show_getbible_link":"1","show_hash_validation":"1","show_api_link":"1","activate_search":"0","search_found_color":"#4747ff","table_selection_color":"#dfdfdf","search_words":"1","search_match":"1","search_case":"1","bottom_search_position":"div","show_bottom_search_position_card":"1","bottom_search_position_card_style":"default","activate_notes":"0","activate_tags":"0","allow_untagging":"0","bottom_tag_position":"div","show_bottom_tag_position_card":"1","bottom_tag_position_card_style":"default","activate_sharing":"1","verse_layout_share":"1","verse_number_share":"1","local_link_share":"1","text_reference_share":"3","type_translation_share":"2","default_format_share":"1","verse_selected_color":"#4747ff","show_header":"1","verse_per_line":"1","show_top_menu":"1","top_menu_type":"1","show_bottom_menu":"0","bottom_menu_type":"1","previous_next_navigation":"1","set_custom_tabs":"0","custom_tabs":"div","set_default_tab_names":"0","custom_icons":"0","show_scripture_tab_text":"1","show_scripture_icon":"1","show_scripture_card":"1","scripture_card_style":"default","show_books_tab_text":"1","show_books_icon":"1","show_books_card":"1","books_card_style":"default","show_chapters_tab_text":"1","show_chapters_icon":"1","show_chapters_card":"1","chapters_card_style":"default","show_translations_tab_text":"1","show_translations_icon":"1","show_translations_card":"1","translations_card_style":"default","show_settings":"0","show_settings_tab_text":"1","show_settings_icon":"1","show_settings_card":"1","settings_card_style":"default","show_details":"1","show_details_tab_text":"1","show_details_icon":"1","show_details_card":"1","details_card_style":"default","bottom_app_position":"div","show_bottom_app_position_card":"1","bottom_app_position_card_style":"default","debug":"0","enable_open_ai":"0","openai_model":"gpt-4","openai_token":"secret","enable_open_ai_org":"0","openai_org_token":"secret","openai_max_tokens":"300","openai_temperature":"1","openai_top_p":"1","openai_n":"1","openai_presence_penalty":"0","openai_frequency_penalty":"0","bottom_ai_position":"div","show_bottom_ai_position_card":"1","bottom_ai_position_card_style":"default","check_in":"-1 day","save_history":"1","history_limit":"10","titleContributor1":"Modules","nameContributor1":"CrossWire","emailContributor1":"sword-support@crosswire.org","linkContributor1":"https://wiki.crosswire.org/","useContributor1":"2","showContributor1":"3","add_jquery_framework":"1","uikit_load":"1","uikit_min":""}'), - ); - // Condition. - $conditions = array( - $db->quoteName('element') . ' = ' . $db->quote('com_getbible') - ); - $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions); - $db->setQuery($query); - $allDone = $db->execute(); - // Get the biggest rule column in the assets table at this point. $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; $db->setQuery($get_rule_length); @@ -1131,17 +1121,33 @@ class com_getbibleInstallerScript $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; $db->setQuery($fix_rules_size); $db->execute(); - $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); + $app->enqueueMessage(Text::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); } } - echo ' + // Install the global extension params. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + // Field to update. + $fields = array( + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","default_translation":"kjv","show_install_button":"0","show_getbible_logo":"1","show_getbible_link":"1","show_hash_validation":"1","show_api_link":"1","activate_search":"0","search_found_color":"#4747ff","table_selection_color":"#dfdfdf","search_words":"1","search_match":"1","search_case":"1","bottom_search_position":"div","show_bottom_search_position_card":"1","bottom_search_position_card_style":"default","activate_notes":"0","activate_tags":"0","allow_untagging":"0","bottom_tag_position":"div","show_bottom_tag_position_card":"1","bottom_tag_position_card_style":"default","activate_sharing":"1","verse_layout_share":"1","verse_number_share":"1","local_link_share":"1","text_reference_share":"3","type_translation_share":"2","default_format_share":"1","verse_selected_color":"#4747ff","show_header":"1","verse_per_line":"1","show_top_menu":"1","top_menu_type":"1","show_bottom_menu":"0","bottom_menu_type":"1","previous_next_navigation":"1","set_custom_tabs":"0","custom_tabs":"div","set_default_tab_names":"0","custom_icons":"0","show_scripture_tab_text":"1","show_scripture_icon":"1","show_scripture_card":"1","scripture_card_style":"default","show_books_tab_text":"1","show_books_icon":"1","show_books_card":"1","books_card_style":"default","show_chapters_tab_text":"1","show_chapters_icon":"1","show_chapters_card":"1","chapters_card_style":"default","show_translations_tab_text":"1","show_translations_icon":"1","show_translations_card":"1","translations_card_style":"default","show_settings":"0","show_settings_tab_text":"1","show_settings_icon":"1","show_settings_card":"1","settings_card_style":"default","show_details":"1","show_details_tab_text":"1","show_details_icon":"1","show_details_card":"1","details_card_style":"default","bottom_app_position":"div","show_bottom_app_position_card":"1","bottom_app_position_card_style":"default","debug":"0","enable_open_ai":"0","openai_model":"gpt-4","openai_token":"secret","enable_open_ai_org":"0","openai_org_token":"secret","openai_max_tokens":"300","openai_temperature":"1","openai_top_p":"1","openai_n":"1","openai_presence_penalty":"0","openai_frequency_penalty":"0","bottom_ai_position":"div","show_bottom_ai_position_card":"1","bottom_ai_position_card_style":"default","check_in":"-1 day","save_history":"1","history_limit":"10","titleContributor1":"Modules","nameContributor1":"CrossWire","emailContributor1":"sword-support@crosswire.org","linkContributor1":"https://wiki.crosswire.org/","useContributor1":"2","showContributor1":"3","add_jquery_framework":"1","uikit_load":"1","uikit_min":""}'), + ); + // Condition. + $conditions = array( + $db->quoteName('element') . ' = ' . $db->quote('com_getbible') + ); + $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions); + $db->setQuery($query); + $allDone = $db->execute(); + + + echo '
- '; +
'; // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the getbible action logs extensions object. $getbible_action_logs_extensions = new stdClass(); @@ -1153,7 +1159,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the linker action log config object. $linker_action_log_config = new stdClass(); @@ -1170,7 +1176,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the note action log config object. $note_action_log_config = new stdClass(); @@ -1187,7 +1193,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the tagged_verse action log config object. $tagged_verse_action_log_config = new stdClass(); @@ -1204,7 +1210,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the prompt action log config object. $prompt_action_log_config = new stdClass(); @@ -1221,7 +1227,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the open_ai_response action log config object. $open_ai_response_action_log_config = new stdClass(); @@ -1238,7 +1244,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the open_ai_message action log config object. $open_ai_message_action_log_config = new stdClass(); @@ -1255,7 +1261,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the password action log config object. $password_action_log_config = new stdClass(); @@ -1272,7 +1278,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the tag action log config object. $tag_action_log_config = new stdClass(); @@ -1289,7 +1295,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the translation action log config object. $translation_action_log_config = new stdClass(); @@ -1306,7 +1312,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the book action log config object. $book_action_log_config = new stdClass(); @@ -1323,7 +1329,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the chapter action log config object. $chapter_action_log_config = new stdClass(); @@ -1340,7 +1346,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the verse action log config object. $verse_action_log_config = new stdClass(); @@ -1359,7 +1365,7 @@ class com_getbibleInstallerScript { // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create the note content type object. $note = new stdClass(); @@ -1536,15 +1542,16 @@ class com_getbibleInstallerScript } - echo ' + + echo '
-

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

'; +

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

'; // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the getbible action logs extensions object. $getbible_action_logs_extensions = new stdClass(); @@ -1567,7 +1574,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the linker action log config object. $linker_action_log_config = new stdClass(); @@ -1601,7 +1608,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the note action log config object. $note_action_log_config = new stdClass(); @@ -1635,7 +1642,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the tagged_verse action log config object. $tagged_verse_action_log_config = new stdClass(); @@ -1669,7 +1676,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the prompt action log config object. $prompt_action_log_config = new stdClass(); @@ -1703,7 +1710,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the open_ai_response action log config object. $open_ai_response_action_log_config = new stdClass(); @@ -1737,7 +1744,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the open_ai_message action log config object. $open_ai_message_action_log_config = new stdClass(); @@ -1771,7 +1778,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the password action log config object. $password_action_log_config = new stdClass(); @@ -1805,7 +1812,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the tag action log config object. $tag_action_log_config = new stdClass(); @@ -1839,7 +1846,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the translation action log config object. $translation_action_log_config = new stdClass(); @@ -1873,7 +1880,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the book action log config object. $book_action_log_config = new stdClass(); @@ -1907,7 +1914,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the chapter action log config object. $chapter_action_log_config = new stdClass(); @@ -1941,7 +1948,7 @@ class com_getbibleInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Create the verse action log config object. $verse_action_log_config = new stdClass(); @@ -1977,12 +1984,12 @@ class com_getbibleInstallerScript /** * Remove folders with files - * + * * @param string $dir The path to folder to remove * @param boolean $ignore The folders and files to ignore and not remove * * @return boolean True in all is removed - * + * */ protected function removeFolder($dir, $ignore = false) { @@ -2051,7 +2058,7 @@ class com_getbibleInstallerScript /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success */ @@ -2083,13 +2090,13 @@ class com_getbibleInstallerScript */ protected function setDynamicF0ld3rs($app, $parent) { - // get the instalation path + // get the installation path $installer = $parent->getParent(); $installPath = $installer->getPath('source'); // get all the folders $folders = Folder::folders($installPath); // check if we have folders we may want to copy - $doNotCopy = array('media','admin','site'); // Joomla already deals with these + $doNotCopy = ['media','admin','site']; // Joomla already deals with these if (count((array) $folders) > 1) { foreach ($folders as $folder) diff --git a/site/controller.php b/site/controller.php index 070ab90..63a7d8a 100644 --- a/site/controller.php +++ b/site/controller.php @@ -18,8 +18,13 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Router\Route; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible Component Base Controller @@ -67,9 +72,9 @@ class GetbibleController extends BaseController ); // should these not merge? - if (GetbibleHelper::checkString($urlparams)) + if (UtilitiesArrayHelper::check($urlparams)) { - $safeurlparams = Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge(array($urlparams, $safeurlparams)); + $safeurlparams = UtilitiesArrayHelper::merge(array($urlparams, $safeurlparams)); } return parent::display($cachable, $safeurlparams); @@ -77,7 +82,7 @@ class GetbibleController extends BaseController protected function checkEditView($view) { - if (GetbibleHelper::checkString($view)) + if (StringHelper::check($view)) { $views = array( diff --git a/site/controllers/ajax.json.php b/site/controllers/ajax.json.php index a42cb09..89155fd 100644 --- a/site/controllers/ajax.json.php +++ b/site/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 @@ -60,16 +62,16 @@ 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'); + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); // return to a callback function - $callback = $jinput->get('callback', null, 'CMD'); + $callback = $jinput->get('callback', null, 'CMD'); // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); + $token = Session::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { // get the task @@ -905,7 +907,7 @@ class GetbibleControllerAjax extends BaseController echo json_encode(false); } else - { + { echo "(".json_encode(false).");"; } } diff --git a/site/getbible.php b/site/getbible.php index 34d9783..af530d8 100644 --- a/site/getbible.php +++ b/site/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// register this component namespace -spl_autoload_register(function ($class) { +// register additional namespace +\spl_autoload_register(function ($class) { // project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla.GetBible' => 'VDM\\Joomla\\GetBible', @@ -64,21 +64,24 @@ spl_autoload_register(function ($class) { } }); - +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\MVC\Controller\BaseController; // Set the component css/js -JHtml::_('stylesheet', 'components/com_getbible/assets/css/site.css', ['version' => 'auto']); -JHtml::_('script', 'components/com_getbible/assets/js/site.js', ['version' => 'auto']); +Html::_('stylesheet', 'components/com_getbible/assets/css/site.css', ['version' => 'auto']); +Html::_('script', 'components/com_getbible/assets/js/site.js', ['version' => 'auto']); // Require helper files JLoader::register('GetbibleHelper', __DIR__ . '/helpers/getbible.php'); JLoader::register('GetbibleHelperRoute', __DIR__ . '/helpers/route.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/site/helpers/getbible.php b/site/helpers/getbible.php index 6d5a74e..01c9f62 100644 --- a/site/helpers/getbible.php +++ b/site/helpers/getbible.php @@ -18,8 +18,8 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// register this component namespace -spl_autoload_register(function ($class) { +// register additional namespace +\spl_autoload_register(function ($class) { // project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla.GetBible' => 'VDM\\Joomla\\GetBible', @@ -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\JsonHelper; use VDM\Joomla\Utilities\ObjectHelper; @@ -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); } /** @@ -180,7 +190,7 @@ abstract class GetbibleHelper // check if set if (!ObjectHelper::check(self::$JVersion)) { - self::$JVersion = new JVersion(); + self::$JVersion = new Version(); } return self::$JVersion; } @@ -191,9 +201,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) @@ -202,22 +212,22 @@ abstract class GetbibleHelper { // set link based of selected option if($params->get("useContributor".$nr) == 1) - { + { $link_front = ''; $link_back = ''; } - elseif($params->get("useContributor".$nr) == 2) - { + elseif($params->get("useContributor".$nr) == 2) + { $link_front = ''; $link_back = ''; } - else - { + else + { $link_front = ''; $link_back = ''; } - $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; + $contributors[$nr]['title'] = UtilitiesStringHelper::html($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.UtilitiesStringHelper::html($params->get("nameContributor".$nr)).$link_back; } } return $contributors; @@ -234,14 +244,14 @@ abstract class GetbibleHelper /** * Get any component's model */ - public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = 'Getbible', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_SITE, $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'])) { @@ -249,7 +259,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) { @@ -284,14 +294,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. @@ -315,14 +325,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 @@ -335,7 +345,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; @@ -352,7 +362,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')) @@ -367,8 +377,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); @@ -383,7 +393,7 @@ abstract class GetbibleHelper elseif ($inherit) { // clear the value since we inherit - $rule = array(); + $rule = []; } } // check if there are any view values remaining @@ -391,8 +401,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; } @@ -437,7 +447,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); } @@ -451,7 +461,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); } @@ -577,7 +587,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'); @@ -595,7 +605,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'); @@ -620,7 +630,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') @@ -629,22 +639,22 @@ 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)) { $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; @@ -811,7 +821,7 @@ abstract class GetbibleHelper /** * Check if have an json string * - * @input string The json string to check + * @input string The json string to check * * @returns bool true on success * @deprecated 3.3 Use JsonHelper::check($string); @@ -824,7 +834,7 @@ abstract class GetbibleHelper /** * Check if have an object with a length * - * @input object The object to check + * @input object The object to check * * @returns bool true on success * @deprecated 3.3 Use ObjectHelper::check($object); @@ -837,7 +847,7 @@ abstract class GetbibleHelper /** * Check if have an array with a length * - * @input array The array to check + * @input array The array to check * * @returns bool/int number of items in array on success * @deprecated 3.3 Use UtilitiesArrayHelper::check($array, $removeEmptyString); @@ -850,7 +860,7 @@ abstract class GetbibleHelper /** * Check if have a string with a length * - * @input string The string to check + * @input string The string to check * * @returns bool true on success * @deprecated 3.3 Use UtilitiesStringHelper::check($string); @@ -870,7 +880,7 @@ abstract class GetbibleHelper { // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) + // website, port (try 80 or 443) if ($connected) { //action when connected @@ -888,7 +898,7 @@ abstract class GetbibleHelper /** * Merge an array of array's * - * @input array The arrays you would like to merge + * @input array The arrays you would like to merge * * @returns array on success * @deprecated 3.3 Use UtilitiesArrayHelper::merge($arrays); @@ -907,7 +917,7 @@ abstract class GetbibleHelper /** * Shorten a string * - * @input string The you would like to shorten + * @input string The you would like to shorten * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::shorten(...); @@ -920,7 +930,7 @@ abstract class GetbibleHelper /** * Making strings safe (various ways) * - * @input string The you would like to make safe + * @input string The you would like to make safe * * @returns string on success * @deprecated 3.3 Use UtilitiesStringHelper::safe(...); @@ -939,7 +949,7 @@ abstract class GetbibleHelper /** * Convert none English strings to code usable string * - * @input an string + * @input an string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::transliterate($string); @@ -952,7 +962,7 @@ abstract class GetbibleHelper /** * make sure a string is HTML save * - * @input an html string + * @input an html string * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::html(...); @@ -970,7 +980,7 @@ abstract class GetbibleHelper /** * Convert all int in a string to an English word string * - * @input an string with numbers + * @input an string with numbers * * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::numbers($string); @@ -984,7 +994,7 @@ abstract class GetbibleHelper * Convert an integer into an English word string * Thanks to Tom Nicholson * - * @input an int + * @input an int * @returns a string * @deprecated 3.3 Use UtilitiesStringHelper::number($x); */ diff --git a/site/helpers/headercheck.php b/site/helpers/headercheck.php index 171cdbe..3cd189b 100644 --- a/site/helpers/headercheck.php +++ b/site/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)) diff --git a/site/helpers/route.php b/site/helpers/route.php index aeb6319..1886f65 100644 --- a/site/helpers/route.php +++ b/site/helpers/route.php @@ -18,6 +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\Language\Multilanguage; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Categories\CategoryNode; +use Joomla\CMS\Categories\Categories; +use VDM\Joomla\Utilities\ArrayHelper; + /** * Getbible Route Helper **/ @@ -50,7 +58,7 @@ abstract class GetbibleHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('getbible.app'); + $categories = Categories::getInstance('getbible.app'); $category = $categories->get($catid); if ($category) { @@ -93,7 +101,7 @@ abstract class GetbibleHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('getbible.tag'); + $categories = Categories::getInstance('getbible.tag'); $category = $categories->get($catid); if ($category) { @@ -136,7 +144,7 @@ abstract class GetbibleHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('getbible.search'); + $categories = Categories::getInstance('getbible.search'); $category = $categories->get($catid); if ($category) { @@ -179,7 +187,7 @@ abstract class GetbibleHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('getbible.openai'); + $categories = Categories::getInstance('getbible.openai'); $category = $categories->get($catid); if ($category) { @@ -222,7 +230,7 @@ abstract class GetbibleHelperRoute } if ($catid > 1) { - $categories = JCategories::getInstance('getbible.api'); + $categories = Categories::getInstance('getbible.api'); $category = $categories->get($catid); if ($category) { @@ -243,7 +251,7 @@ abstract class GetbibleHelperRoute /** * Get the URL route for getbible category from a category ID and language * - * @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode + * @param mixed $catid The id of the items's category either an integer id or a instance of CategoryNode * @param mixed $language The id of the language being used. * * @return string The link to the contact @@ -252,20 +260,20 @@ abstract class GetbibleHelperRoute */ public static function getCategoryRoute_keep_for_later($catid, $language = 0) { - if ($catid instanceof JCategoryNode) + if ($catid instanceof CategoryNode) { - $id = $catid->id; - $category = $catid; + $id = $catid->id; + $category = $catid; } else - { - throw new Exception('First parameter must be JCategoryNode'); + { + throw new Exception('First parameter must be CategoryNode'); } - + $views = array(); $view = $views[$category->extension]; - - if ($id < 1 || !($category instanceof JCategoryNode)) + + if ($id < 1 || !($category instanceof CategoryNode)) { $link = ''; } @@ -273,20 +281,20 @@ abstract class GetbibleHelperRoute { //Create the link $link = 'index.php?option=com_getbible&view='.$view.'&category='.$category->slug; - + $needles = array( $view => array($id), 'category' => array($id) ); - - if ($language && $language != "*" && JLanguageMultilang::isEnabled()) + + if ($language && $language != "*" && Multilanguage::isEnabled()) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) + $db = Factory::getDbo(); + $query = $db->getQuery(true) ->select('a.sef AS sef') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); - + $db->setQuery($query); $langs = $db->loadObjectList(); foreach ($langs as $lang) @@ -298,11 +306,11 @@ abstract class GetbibleHelperRoute } } } - + if ($item = self::_findItem($needles,'category')) { - $link .= '&Itemid='.$item; + $link .= '&Itemid='.$item; } else { @@ -328,16 +336,16 @@ abstract class GetbibleHelperRoute protected static function _findItem($needles = null,$type = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $menus = $app->getMenu('site'); $language = isset($needles['language']) ? $needles['language'] : '*'; // Prepare the reverse lookup array. if (!isset(self::$lookup[$language])) { - self::$lookup[$language] = array(); + self::$lookup[$language] = []; - $component = JComponentHelper::getComponent('com_getbible'); + $component = ComponentHelper::getComponent('com_getbible'); $attributes = array('component_id'); $values = array($component->id); @@ -358,7 +366,7 @@ abstract class GetbibleHelperRoute if (!isset(self::$lookup[$language][$view])) { - self::$lookup[$language][$view] = array(); + self::$lookup[$language][$view] = []; } if (isset($item->query['id'])) @@ -387,7 +395,7 @@ abstract class GetbibleHelperRoute { if (isset(self::$lookup[$language][$view])) { - if (GetbibleHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { foreach ($ids as $id) { @@ -408,7 +416,7 @@ abstract class GetbibleHelperRoute if ($type) { // Check if the global menu item has been set. - $params = JComponentHelper::getParams('com_getbible'); + $params = ComponentHelper::getParams('com_getbible'); if ($item = $params->get($type.'_menu', 0)) { return $item; @@ -420,7 +428,7 @@ abstract class GetbibleHelperRoute if ($active && $active->component == 'com_getbible' - && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) + && ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled())) { return $active->id; } diff --git a/site/layouts/aidetails.php b/site/layouts/aidetails.php index 1101b1f..ddb1732 100644 --- a/site/layouts/aidetails.php +++ b/site/layouts/aidetails.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; + ?> @@ -25,9 +30,9 @@ defined('JPATH_BASE') or die('Restricted access');
response_model; ?>

response_object; ?>

    -
  • : response_created; ?>
  • -
  • : prompt_tokens; ?>
  • -
  • : completion_tokens; ?>
  • -
  • : total_tokens; ?>
  • +
  • : response_created; ?>
  • +
  • : prompt_tokens; ?>
  • +
  • : completion_tokens; ?>
  • +
  • : total_tokens; ?>
diff --git a/site/layouts/airesponsemessage.php b/site/layouts/airesponsemessage.php index 1932d27..0619272 100644 --- a/site/layouts/airesponsemessage.php +++ b/site/layouts/airesponsemessage.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; + ?> diff --git a/site/layouts/getbibleappnote.php b/site/layouts/getbibleappnote.php index 333e3cc..2d646eb 100644 --- a/site/layouts/getbibleappnote.php +++ b/site/layouts/getbibleappnote.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; + ?> diff --git a/site/layouts/getbibleappnotelink.php b/site/layouts/getbibleappnotelink.php index 83e7f06..67e690f 100644 --- a/site/layouts/getbibleappnotelink.php +++ b/site/layouts/getbibleappnotelink.php @@ -18,7 +18,12 @@ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper as Html; +use Joomla\CMS\Layout\LayoutHelper; + ?> - + diff --git a/site/layouts/getbiblefavouriteverse.php b/site/layouts/getbiblefavouriteverse.php index 62bc38e..47d7f40 100644 --- a/site/layouts/getbiblefavouriteverse.php +++ b/site/layouts/getbiblefavouriteverse.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; + // chapters $chapters = array_map( function ($item) { return (object) ['key' => $item, 'value' => $item]; @@ -32,17 +37,17 @@ $verses = array_map( function ($item) {

- +

- +

'getbible_favourite_book', - 'label' => JText::_('COM_GETBIBLE_BOOKS'), + 'label' => Text::_('COM_GETBIBLE_BOOKS'), 'options' => $displayData['book_options'], 'default' => $displayData['book_default'] ]); ?> @@ -52,7 +57,7 @@ $verses = array_map( function ($item) {
'getbible_favourite_chapter', - 'label' => JText::_('COM_GETBIBLE_CHAPTERS'), + 'label' => Text::_('COM_GETBIBLE_CHAPTERS'), 'options' => $chapters, 'default' => $displayData['chapter_default'] ]); ?> @@ -62,7 +67,7 @@ $verses = array_map( function ($item) {
'getbible_favourite_verse', - 'label' => JText::_('COM_GETBIBLE_VERSES'), + 'label' => Text::_('COM_GETBIBLE_VERSES'), 'options' => $verses, 'default' => $displayData['verse_default'] ]); ?> @@ -70,18 +75,18 @@ $verses = array_map( function ($item) {

- +

'getbible_favourite_linker', 'class_other' => 'getbible-linker-guid-input uk-text-center', - 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'), + 'label' => Text::_('COM_GETBIBLE_SESSION_KEY'), 'class_other_label' => 'getbible-linker-name-value', - 'placeholder' => JText::_('COM_GETBIBLE_AUTO_GENERATED') + 'placeholder' => Text::_('COM_GETBIBLE_AUTO_GENERATED') ]); ?>

-
- +
+

diff --git a/site/layouts/getbiblefooter.php b/site/layouts/getbiblefooter.php index 6221706..f720adf 100644 --- a/site/layouts/getbiblefooter.php +++ b/site/layouts/getbiblefooter.php @@ -18,14 +18,19 @@ // 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; + ?>
- 'title: ' . JText::_('COM_GETBIBLE_THE_WORDS_OF_ETERNAL_LIFE') . '; pos: left']); ?> + 'title: ' . Text::_('COM_GETBIBLE_THE_WORDS_OF_ETERNAL_LIFE') . '; pos: left']); ?>
diff --git a/site/layouts/getbiblehashdetails.php b/site/layouts/getbiblehashdetails.php index 0dcd453..6043318 100644 --- a/site/layouts/getbiblehashdetails.php +++ b/site/layouts/getbiblehashdetails.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; + ?> diff --git a/site/layouts/getbiblelinkers.php b/site/layouts/getbiblelinkers.php index 3c8d42f..bdd69f7 100644 --- a/site/layouts/getbiblelinkers.php +++ b/site/layouts/getbiblelinkers.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; + $load = false; if (!empty($displayData)) @@ -38,12 +43,12 @@ if (!empty($displayData)) name !== null): ?>
  • - 'get-session-name-' . $linker->guid, 'label' => JText::_('COM_GETBIBLE_SESSION_NAME'), 'value' => $linker->name, 'readonly' => true]); ?> - 'get-session-key-' . $linker->guid, 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'), 'value' => $linker->guid, 'readonly' => true]); ?> + 'get-session-name-' . $linker->guid, 'label' => Text::_('COM_GETBIBLE_SESSION_NAME'), 'value' => $linker->name, 'readonly' => true]); ?> + 'get-session-key-' . $linker->guid, 'label' => Text::_('COM_GETBIBLE_SESSION_KEY'), 'value' => $linker->guid, 'readonly' => true]); ?>
    - - - + + +
  • @@ -51,7 +56,7 @@ if (!empty($displayData))
    -

    -

    +

    +

    diff --git a/site/layouts/getbibleparagraph.php b/site/layouts/getbibleparagraph.php index be30824..d3cc242 100644 --- a/site/layouts/getbibleparagraph.php +++ b/site/layouts/getbibleparagraph.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; + ?> diff --git a/site/layouts/getbibleverse.php b/site/layouts/getbibleverse.php index a4ba18f..71937f2 100644 --- a/site/layouts/getbibleverse.php +++ b/site/layouts/getbibleverse.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; + // set the modal target $target = $displayData['active']->target ?? ''; diff --git a/site/layouts/getbibleverses.php b/site/layouts/getbibleverses.php index 3a05551..b9c232b 100644 --- a/site/layouts/getbibleverses.php +++ b/site/layouts/getbibleverses.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; + ?> diff --git a/site/layouts/getbibleversetag.php b/site/layouts/getbibleversetag.php index fe4e1f5..762d5dc 100644 --- a/site/layouts/getbibleversetag.php +++ b/site/layouts/getbibleversetag.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; + $active = false; $style = ''; @@ -41,6 +46,6 @@ elseif ($displayData['tag'] == -1)  
    diff --git a/site/layouts/input.php b/site/layouts/input.php index 8af0c43..a5a78de 100644 --- a/site/layouts/input.php +++ b/site/layouts/input.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/inputbox.php b/site/layouts/inputbox.php index b7454ec..c28b419 100644 --- a/site/layouts/inputbox.php +++ b/site/layouts/inputbox.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'); $class_label = (isset($displayData['class_label'])) ? $displayData['class_label'] : 'uk-form-label'; $class_other_label = (isset($displayData['class_other_label'])) ? ' ' . $displayData['class_other_label'] : ''; $margin = (isset($displayData['margin'])) ? $displayData['margin'] : 'uk-margin-small'; diff --git a/site/layouts/modal.php b/site/layouts/modal.php index abbda95..b2825cf 100644 --- a/site/layouts/modal.php +++ b/site/layouts/modal.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\StringHelper; $id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7); @@ -72,7 +77,7 @@ if ($full) $id_ = $button['id'] ?? StringHelper::random(7); $class = $button['class'] ?? 'uk-button uk-button-default'; $class .= (isset($button['close']) && $button['close']) ? ' uk-modal-close' : ''; - $name = (isset($button['name'])) ? $button['name'] : ((isset($button['close']) && $button['close']) ? JText::_('COM_GETBIBLE_CANCEL') : JText::_('COM_GETBIBLE_SAVE')); + $name = (isset($button['name'])) ? $button['name'] : ((isset($button['close']) && $button['close']) ? Text::_('COM_GETBIBLE_CANCEL') : Text::_('COM_GETBIBLE_SAVE')); $onclick = (isset($button['onclick'])) ? ' onclick="' . $button['onclick'] . '"' : ''; ?> diff --git a/site/layouts/modulepositionerror.php b/site/layouts/modulepositionerror.php index 824f7f2..b0d32e9 100644 --- a/site/layouts/modulepositionerror.php +++ b/site/layouts/modulepositionerror.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; + ?>
    -

    -

    +

    +

    diff --git a/site/layouts/nextchapter.php b/site/layouts/nextchapter.php index aac359c..915e2e4 100644 --- a/site/layouts/nextchapter.php +++ b/site/layouts/nextchapter.php @@ -18,9 +18,14 @@ // 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; + $url = $displayData ? JRoute::_('index.php?option=com_getbible&view=app&t=' . $displayData->abbreviation . '&ref=' . $displayData->name . '&c=' . $displayData->chapter) : null; ?> - + diff --git a/site/layouts/previouschapter.php b/site/layouts/previouschapter.php index a2a1a68..c8e1b3a 100644 --- a/site/layouts/previouschapter.php +++ b/site/layouts/previouschapter.php @@ -18,9 +18,14 @@ // 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; + $url = $displayData ? JRoute::_('index.php?option=com_getbible&view=app&t=' . $displayData->abbreviation . '&ref=' . $displayData->name . '&c=' . $displayData->chapter) : null; ?> - + diff --git a/site/layouts/promptmessage.php b/site/layouts/promptmessage.php index 1932d27..0619272 100644 --- a/site/layouts/promptmessage.php +++ b/site/layouts/promptmessage.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; + ?> diff --git a/site/layouts/promptsettings.php b/site/layouts/promptsettings.php index f378fca..4f0639a 100644 --- a/site/layouts/promptsettings.php +++ b/site/layouts/promptsettings.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; + ?> @@ -25,10 +30,10 @@ defined('JPATH_BASE') or die('Restricted access');
    model; ?>

    language; ?>

      -
    • : max_tokens; ?>
    • -
    • : temperature; ?>
    • -
    • : top_p; ?>
    • -
    • : presence_penalty; ?>
    • -
    • : frequency_penalty; ?>
    • +
    • : max_tokens; ?>
    • +
    • : temperature; ?>
    • +
    • : top_p; ?>
    • +
    • : presence_penalty; ?>
    • +
    • : frequency_penalty; ?>
    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..7cf6798 100644 --- a/site/models/api.php +++ b/site/models/api.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\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; /** * Getbible List Model for Api @@ -48,19 +54,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 +92,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..1dd2c6a 100644 --- a/site/models/app.php +++ b/site/models/app.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\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 Joomla\CMS\Helper\TagsHelper; +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 +74,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 +95,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 +107,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 +122,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 +148,10 @@ class GetbibleModelApp extends ItemModel { $this->chapter = 1; } - + if ($this->_item === null) { - $this->_item = array(); + $this->_item = []; } if (!isset($this->_item[$pk])) @@ -150,21 +159,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 +182,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 +196,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 +212,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 +232,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 +256,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 +265,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 +289,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 +303,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 +317,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 +331,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 +380,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 +393,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 +407,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 +428,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 +460,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'); @@ -461,9 +470,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +498,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 +524,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'); @@ -525,9 +534,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +548,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 +572,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 +595,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'); @@ -596,9 +605,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +625,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 +639,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 +653,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 +679,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 +702,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 +714,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 +744,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 +758,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 +772,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 +786,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 +824,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 +836,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 +867,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 +881,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 +895,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 +909,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 +947,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 +956,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 +968,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 +991,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 +1027,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'); @@ -1028,9 +1037,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1051,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 +1065,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 +1092,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 +1125,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'); @@ -1126,9 +1135,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1147,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 +1163,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 +1177,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 +1204,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 +1237,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'); @@ -1238,9 +1247,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1274,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 +1307,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'); @@ -1308,9 +1317,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1337,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 +1351,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 +1380,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 +1413,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'); @@ -1414,9 +1423,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1437,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 +1459,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 +1482,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'); @@ -1483,9 +1492,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1516,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 +1532,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 +1546,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 +1578,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 +1611,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'); @@ -1612,9 +1621,9 @@ class GetbibleModelApp extends ItemModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +1633,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 +1660,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 +1692,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 +1771,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 +1783,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..a48f99b 100644 --- a/site/models/openai.php +++ b/site/models/openai.php @@ -18,11 +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\MVC\Model\ItemModel; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; use VDM\Joomla\Utilities\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 +74,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 +95,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 +114,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 +123,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 +132,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 +149,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 +161,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 +169,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 +177,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 +186,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 +201,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 +225,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 +234,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 +246,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 +269,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..a3e18c6 100644 --- a/site/models/search.php +++ b/site/models/search.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 Joomla\CMS\Helper\TagsHelper; 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 +58,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 +166,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'); @@ -169,9 +176,9 @@ class GetbibleModelSearch extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +204,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 +227,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'); @@ -230,9 +237,9 @@ class GetbibleModelSearch extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +251,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 +275,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 +298,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 +307,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 +319,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 +342,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 +651,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 +663,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..26e2ab8 100644 --- a/site/models/tag.php +++ b/site/models/tag.php @@ -18,11 +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\Component\ComponentHelper; use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Helper\TagsHelper; +use VDM\Joomla\Utilities\StringHelper; use VDM\Joomla\Utilities\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 +59,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 +101,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 +115,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 +158,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 +174,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 +211,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 +220,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 +232,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 +255,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 +291,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'); @@ -293,9 +301,9 @@ class GetbibleModelTag extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +328,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 +361,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'); @@ -363,9 +371,9 @@ class GetbibleModelTag extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +383,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 +410,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 +443,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 +452,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 +464,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 +489,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 +514,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'); @@ -516,9 +524,9 @@ class GetbibleModelTag extends ListModel } // Get the global params - $globalParams = JComponentHelper::getParams('com_getbible', true); + $globalParams = ComponentHelper::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 +554,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 +570,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 +584,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 +598,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 +633,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..8530620 100644 --- a/site/router.php +++ b/site/router.php @@ -18,13 +18,16 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; + /** * Routing class from com_getbible * * @since 3.3 */ class GetbibleRouter extends JComponentRouterBase -{ +{ /** * Build the route for the com_getbible component * @@ -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))); @@ -811,7 +814,7 @@ class GetbibleRouter extends JComponentRouterBase function GetbibleBuildRoute(&$query) { $router = new GetbibleRouter; - + return $router->build($query); } 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..c8d89b1 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 @@ -27,13 +36,13 @@ class GetbibleViewApi extends HtmlView { // Overwriting JView display method function display($tpl = null) - { + { // get combined params of both component and menu - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); $this->params = $this->app->getParams(); $this->menu = $this->app->getMenu()->getActive(); // get the user object - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); // Initialise variables. $this->items = $this->get('Items'); @@ -46,7 +55,7 @@ class GetbibleViewApi extends HtmlView // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new Exception(implode(PHP_EOL, $errors), 500); + throw new \Exception(implode(PHP_EOL, $errors), 500); } parent::display($tpl); @@ -61,12 +70,12 @@ 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' ); // Initialize the header checker. - $HeaderCheck = new getbibleHeaderCheck; + $HeaderCheck = new getbibleHeaderCheck(); // Load uikit options. $uikit = $this->params->get('uikit_load'); @@ -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']); } /** @@ -92,15 +101,15 @@ class GetbibleViewApi extends HtmlView */ protected function addToolBar() { - + // 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; + ?>