From 0ea223c113efd60537bdbe1b8a42209579484ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Dori=C4=87?= Date: Mon, 16 Jan 2017 19:27:18 +0100 Subject: [PATCH] Making Websites With October CMS - Part 28 - Search --- document.md | 0 octobermovies.sublime-workspace | 92 +++- plugins/offline/sitesearch/CONTRIBUTING.md | 7 + plugins/offline/sitesearch/LICENCE.md | 19 + plugins/offline/sitesearch/Plugin.php | 75 +++ plugins/offline/sitesearch/README.md | 252 +++++++++ plugins/offline/sitesearch/classes/Result.php | 268 ++++++++++ .../sitesearch/classes/ResultCollection.php | 96 ++++ .../ArrizalaminPortfolioResultsProvider.php | 104 ++++ .../providers/CmsPagesResultsProvider.php | 126 +++++ ...eglewebOctoshopProductsResultsProvider.php | 107 ++++ .../providers/GenericResultsProvider.php | 102 ++++ .../IndikatorNewsResultsProvider.php | 107 ++++ .../providers/JiriJKShopResultsProvider.php | 117 +++++ .../OfflineSnipcartShopResultsProvider.php | 116 ++++ .../RadiantWebProBlogResultsProvider.php | 131 +++++ .../providers/RainlabBlogResultsProvider.php | 186 +++++++ .../providers/RainlabPagesResultsProvider.php | 157 ++++++ .../ResponsivShowcaseResultsProvider.php | 102 ++++ .../classes/providers/ResultsProvider.php | 158 ++++++ .../VojtaSvobodaBrandsResultsProvider.php | 101 ++++ .../sitesearch/components/SearchResults.php | 256 +++++++++ .../components/SiteSearchInclude.php | 26 + .../components/searchresults/content.htm | 19 + .../components/searchresults/default.htm | 11 + .../components/searchresults/no-results.htm | 1 + .../components/searchresults/pagination.htm | 4 + .../components/searchresults/searchresult.htm | 9 + .../components/searchresults/thumbnail.htm | 5 + plugins/offline/sitesearch/composer.json | 9 + plugins/offline/sitesearch/lang/cs/lang.php | 56 ++ plugins/offline/sitesearch/lang/de/lang.php | 64 +++ plugins/offline/sitesearch/lang/en/lang.php | 66 +++ plugins/offline/sitesearch/lang/fa/lang.php | 64 +++ .../offline/sitesearch/lang/pt-br/lang.php | 66 +++ plugins/offline/sitesearch/lang/ru/lang.php | 59 +++ .../offline/sitesearch/models/Settings.php | 28 + .../models/settings/_cmspages_info.htm | 12 + .../models/settings/_experimental.htm | 8 + .../sitesearch/models/settings/fields.yaml | 251 +++++++++ .../offline/sitesearch/updates/version.yaml | 77 +++ .../offline/sitesearch/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 413 +++++++++++++++ .../sitesearch/vendor/composer/LICENSE | 21 + .../vendor/composer/autoload_classmap.php | 9 + .../vendor/composer/autoload_namespaces.php | 9 + .../vendor/composer/autoload_psr4.php | 10 + .../vendor/composer/autoload_real.php | 45 ++ .../sitesearch/vendor/composer/installed.json | 111 ++++ .../vendor/composer/installers/LICENSE | 19 + .../vendor/composer/installers/README.md | 220 ++++++++ .../vendor/composer/installers/composer.json | 92 ++++ .../composer/installers/phpunit.xml.dist | 25 + .../src/Composer/Installers/AglInstaller.php | 21 + .../Composer/Installers/AimeosInstaller.php | 9 + .../Installers/AnnotateCmsInstaller.php | 11 + .../Composer/Installers/AsgardInstaller.php | 49 ++ .../Composer/Installers/AttogramInstaller.php | 9 + .../src/Composer/Installers/BaseInstaller.php | 136 +++++ .../Composer/Installers/BitrixInstaller.php | 126 +++++ .../Composer/Installers/BonefishInstaller.php | 9 + .../Composer/Installers/CakePHPInstaller.php | 84 +++ .../src/Composer/Installers/ChefInstaller.php | 11 + .../Installers/ClanCatsFrameworkInstaller.php | 10 + .../Composer/Installers/CockpitInstaller.php | 34 ++ .../Installers/CodeIgniterInstaller.php | 11 + .../Installers/Concrete5Installer.php | 12 + .../Composer/Installers/CraftInstaller.php | 35 ++ .../Composer/Installers/CroogoInstaller.php | 21 + .../Composer/Installers/DecibelInstaller.php | 10 + .../Composer/Installers/DokuWikiInstaller.php | 50 ++ .../Composer/Installers/DolibarrInstaller.php | 16 + .../Composer/Installers/DrupalInstaller.php | 16 + .../src/Composer/Installers/ElggInstaller.php | 9 + .../Installers/ExpressionEngineInstaller.php | 29 + .../src/Composer/Installers/FuelInstaller.php | 11 + .../Composer/Installers/FuelphpInstaller.php | 9 + .../src/Composer/Installers/GravInstaller.php | 30 ++ .../Composer/Installers/HuradInstaller.php | 25 + .../Composer/Installers/ImageCMSInstaller.php | 11 + .../src/Composer/Installers/Installer.php | 189 +++++++ .../Composer/Installers/JoomlaInstaller.php | 15 + .../Composer/Installers/KirbyInstaller.php | 11 + .../Composer/Installers/KodiCMSInstaller.php | 10 + .../Composer/Installers/KohanaInstaller.php | 9 + .../Composer/Installers/LaravelInstaller.php | 9 + .../Composer/Installers/LithiumInstaller.php | 10 + .../Installers/MODULEWorkInstaller.php | 9 + .../Composer/Installers/MODXEvoInstaller.php | 16 + .../Composer/Installers/MagentoInstaller.php | 11 + .../src/Composer/Installers/MakoInstaller.php | 9 + .../Composer/Installers/MauticInstaller.php | 25 + .../Installers/MediaWikiInstaller.php | 50 ++ .../Installers/MicroweberInstaller.php | 111 ++++ .../Composer/Installers/MoodleInstaller.php | 56 ++ .../Composer/Installers/OctoberInstaller.php | 46 ++ .../src/Composer/Installers/OxidInstaller.php | 59 +++ .../src/Composer/Installers/PPIInstaller.php | 9 + .../Composer/Installers/PhiftyInstaller.php | 11 + .../Composer/Installers/PhpBBInstaller.php | 11 + .../Composer/Installers/PimcoreInstaller.php | 21 + .../Composer/Installers/PiwikInstaller.php | 32 ++ .../Installers/PlentymarketsInstaller.php | 29 + .../src/Composer/Installers/Plugin.php | 17 + .../Installers/PrestashopInstaller.php | 10 + .../Composer/Installers/PuppetInstaller.php | 11 + .../Composer/Installers/RadPHPInstaller.php | 24 + .../Composer/Installers/ReIndexInstaller.php | 10 + .../Composer/Installers/RedaxoInstaller.php | 10 + .../Installers/RoundcubeInstaller.php | 22 + .../src/Composer/Installers/SMFInstaller.php | 10 + .../Composer/Installers/ShopwareInstaller.php | 60 +++ .../Installers/SilverStripeInstaller.php | 36 ++ .../Composer/Installers/Symfony1Installer.php | 26 + .../Composer/Installers/TYPO3CmsInstaller.php | 16 + .../Installers/TYPO3FlowInstaller.php | 38 ++ .../Composer/Installers/TheliaInstaller.php | 12 + .../src/Composer/Installers/TuskInstaller.php | 14 + .../Composer/Installers/VanillaInstaller.php | 10 + .../Composer/Installers/WHMCSInstaller.php | 10 + .../Composer/Installers/WolfCMSInstaller.php | 9 + .../Installers/WordPressInstaller.php | 11 + .../Composer/Installers/YawikInstaller.php | 32 ++ .../src/Composer/Installers/ZendInstaller.php | 11 + .../Composer/Installers/ZikulaInstaller.php | 10 + .../composer/installers/src/bootstrap.php | 13 + .../Installers/Test/AsgardInstallerTest.php | 79 +++ .../Installers/Test/BitrixInstallerTest.php | 76 +++ .../Installers/Test/CakePHPInstallerTest.php | 115 ++++ .../Installers/Test/CraftInstallerTest.php | 83 +++ .../Installers/Test/DokuWikiInstallerTest.php | 89 ++++ .../Installers/Test/GravInstallerTest.php | 63 +++ .../Installers/Test/InstallerTest.php | 496 ++++++++++++++++++ .../Test/MediaWikiInstallerTest.php | 66 +++ .../Installers/Test/OctoberInstallerTest.php | 66 +++ .../Installers/Test/PimcoreInstallerTest.php | 44 ++ .../Installers/Test/PiwikInstallerTest.php | 63 +++ .../Composer/Installers/Test/TestCase.php | 64 +++ .../Installers/Test/YawikInstallerTest.php | 64 +++ .../composer/installers/tests/bootstrap.php | 4 + plugins/watchlearn/movies/Plugin.php | 40 ++ themes/olympos/pages/contact.htm | 5 + themes/olympos/pages/homepage.htm | 9 + themes/olympos/pages/search.htm | 12 + 144 files changed, 7914 insertions(+), 3 deletions(-) create mode 100644 document.md create mode 100644 plugins/offline/sitesearch/CONTRIBUTING.md create mode 100644 plugins/offline/sitesearch/LICENCE.md create mode 100644 plugins/offline/sitesearch/Plugin.php create mode 100644 plugins/offline/sitesearch/README.md create mode 100644 plugins/offline/sitesearch/classes/Result.php create mode 100644 plugins/offline/sitesearch/classes/ResultCollection.php create mode 100644 plugins/offline/sitesearch/classes/providers/ArrizalaminPortfolioResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/CmsPagesResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/FeeglewebOctoshopProductsResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/GenericResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/IndikatorNewsResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/JiriJKShopResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/OfflineSnipcartShopResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/RadiantWebProBlogResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/RainlabBlogResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/RainlabPagesResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/ResponsivShowcaseResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/ResultsProvider.php create mode 100644 plugins/offline/sitesearch/classes/providers/VojtaSvobodaBrandsResultsProvider.php create mode 100644 plugins/offline/sitesearch/components/SearchResults.php create mode 100644 plugins/offline/sitesearch/components/SiteSearchInclude.php create mode 100644 plugins/offline/sitesearch/components/searchresults/content.htm create mode 100644 plugins/offline/sitesearch/components/searchresults/default.htm create mode 100644 plugins/offline/sitesearch/components/searchresults/no-results.htm create mode 100644 plugins/offline/sitesearch/components/searchresults/pagination.htm create mode 100644 plugins/offline/sitesearch/components/searchresults/searchresult.htm create mode 100644 plugins/offline/sitesearch/components/searchresults/thumbnail.htm create mode 100644 plugins/offline/sitesearch/composer.json create mode 100644 plugins/offline/sitesearch/lang/cs/lang.php create mode 100644 plugins/offline/sitesearch/lang/de/lang.php create mode 100644 plugins/offline/sitesearch/lang/en/lang.php create mode 100644 plugins/offline/sitesearch/lang/fa/lang.php create mode 100644 plugins/offline/sitesearch/lang/pt-br/lang.php create mode 100644 plugins/offline/sitesearch/lang/ru/lang.php create mode 100644 plugins/offline/sitesearch/models/Settings.php create mode 100644 plugins/offline/sitesearch/models/settings/_cmspages_info.htm create mode 100644 plugins/offline/sitesearch/models/settings/_experimental.htm create mode 100644 plugins/offline/sitesearch/models/settings/fields.yaml create mode 100644 plugins/offline/sitesearch/updates/version.yaml create mode 100644 plugins/offline/sitesearch/vendor/autoload.php create mode 100644 plugins/offline/sitesearch/vendor/composer/ClassLoader.php create mode 100644 plugins/offline/sitesearch/vendor/composer/LICENSE create mode 100644 plugins/offline/sitesearch/vendor/composer/autoload_classmap.php create mode 100644 plugins/offline/sitesearch/vendor/composer/autoload_namespaces.php create mode 100644 plugins/offline/sitesearch/vendor/composer/autoload_psr4.php create mode 100644 plugins/offline/sitesearch/vendor/composer/autoload_real.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installed.json create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/LICENSE create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/README.md create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/composer.json create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/phpunit.xml.dist create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AglInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/GravInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Installer.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Plugin.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/src/bootstrap.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php create mode 100644 plugins/offline/sitesearch/vendor/composer/installers/tests/bootstrap.php create mode 100644 themes/olympos/pages/search.htm diff --git a/document.md b/document.md new file mode 100644 index 0000000..e69de29 diff --git a/octobermovies.sublime-workspace b/octobermovies.sublime-workspace index c5e0d55..dbe77a5 100644 --- a/octobermovies.sublime-workspace +++ b/octobermovies.sublime-workspace @@ -335,6 +335,24 @@ }, "buffers": [ + { + "file": "plugins/watchlearn/movies/updates/version.yaml", + "settings": + { + "buffer_size": 1162, + "encoding": "UTF-8", + "line_ending": "Unix" + } + }, + { + "file": "plugins/watchlearn/movies/updates/seed.php", + "settings": + { + "buffer_size": 652, + "encoding": "UTF-8", + "line_ending": "Unix" + } + } ], "build_system": "", "build_system_choices": @@ -553,10 +571,15 @@ }, "expanded_folders": [ - "/Users/idoric/Development/public/octobermovies" + "/Users/idoric/Development/public/octobermovies", + "/Users/idoric/Development/public/octobermovies/plugins", + "/Users/idoric/Development/public/octobermovies/plugins/watchlearn", + "/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies", + "/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/updates" ], "file_history": [ + "/Users/idoric/Development/public/octobermovies/CONTRIBUTING.md", "/Users/idoric/Development/public/starterkit/scss/components/_header.scss", "/Users/idoric/Development/public/starterkit/package.json", "/Users/idoric/Development/public/activenation/wp-content/themes/olympos/js/subpage-timetable.js", @@ -683,8 +706,7 @@ "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/sass/modules/_typeahead.scss", "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/lockeroom/issue-list.php", "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/lockeroom/featured-article.php", - "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/js/olympos.min.js", - "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/vendor/autoload.php" + "/Users/ivan/Development/public/activenation/wp-content/themes/olympos/js/olympos.min.js" ], "find": { @@ -895,8 +917,72 @@ "groups": [ { + "selected": 1, "sheets": [ + { + "buffer": 0, + "file": "plugins/watchlearn/movies/updates/version.yaml", + "semi_transient": false, + "settings": + { + "buffer_size": 1162, + "regions": + { + }, + "selection": + [ + [ + 1126, + 1126 + ] + ], + "settings": + { + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/YAML/YAML.sublime-syntax" + }, + "translation.x": 0.0, + "translation.y": 825.0, + "zoom_level": 1.0 + }, + "stack_index": 1, + "type": "text" + }, + { + "buffer": 1, + "file": "plugins/watchlearn/movies/updates/seed.php", + "semi_transient": false, + "settings": + { + "buffer_size": 652, + "regions": + { + }, + "selection": + [ + [ + 383, + 383 + ] + ], + "settings": + { + "_anf_new": "", + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/PHP/PHP.sublime-syntax" + }, + "translation.x": 0.0, + "translation.y": 205.0, + "zoom_level": 1.0 + }, + "stack_index": 0, + "type": "text" + } ] } ], diff --git a/plugins/offline/sitesearch/CONTRIBUTING.md b/plugins/offline/sitesearch/CONTRIBUTING.md new file mode 100644 index 0000000..f74dc2f --- /dev/null +++ b/plugins/offline/sitesearch/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# How to contribute + +Contributions to this project are highly welcome. + +1. Submit your pull requests to the `develop` branch +1. Adhere to the [PSR-2 coding](http://www.php-fig.org/psr/psr-2/) standard +1. If you are not sure if your ideas are fit for this project, create an issue and ask \ No newline at end of file diff --git a/plugins/offline/sitesearch/LICENCE.md b/plugins/offline/sitesearch/LICENCE.md new file mode 100644 index 0000000..38cee79 --- /dev/null +++ b/plugins/offline/sitesearch/LICENCE.md @@ -0,0 +1,19 @@ +# MIT license + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/plugins/offline/sitesearch/Plugin.php b/plugins/offline/sitesearch/Plugin.php new file mode 100644 index 0000000..05b76a4 --- /dev/null +++ b/plugins/offline/sitesearch/Plugin.php @@ -0,0 +1,75 @@ + 'offline.sitesearch::lang.plugin.name', + 'description' => 'offline.sitesearch::lang.plugin.description', + 'author' => 'offline.sitesearch::lang.plugin.author', + 'icon' => 'icon-search', + 'homepage' => 'https://github.com/OFFLINE-GmbH/oc-site-search-plugin', + ]; + } + + /** + * Registers any front-end components implemented in this plugin. + * + * @return array + */ + public function registerComponents() + { + return [ + 'OFFLINE\SiteSearch\Components\SearchResults' => 'searchResults', + 'OFFLINE\SiteSearch\Components\SiteSearchInclude' => 'siteSearchInclude', + ]; + } + + /** + * Registers any back-end permissions. + * + * @return array + */ + public function registerPermissions() + { + return [ + 'offline.sitesearch.manage_settings' => [ + 'tab' => 'offline.sitesearch::lang.plugin.name', + 'label' => 'offline.sitesearch::lang.plugin.manage_settings_permission', + ], + ]; + } + + /** + * Registers any back-end settings. + * + * @return array + */ + public function registerSettings() + { + return [ + 'config' => [ + 'label' => 'offline.sitesearch::lang.plugin.name', + 'description' => 'offline.sitesearch::lang.plugin.manage_settings', + 'category' => 'system::lang.system.categories.cms', + 'icon' => 'icon-search', + 'class' => 'Offline\SiteSearch\Models\Settings', + 'order' => 500, + 'keywords' => 'search', + 'permissions' => ['offline.sitesearch.manage_settings'] + ], + ]; + } +} diff --git a/plugins/offline/sitesearch/README.md b/plugins/offline/sitesearch/README.md new file mode 100644 index 0000000..5d6474a --- /dev/null +++ b/plugins/offline/sitesearch/README.md @@ -0,0 +1,252 @@ +# SiteSearch Plugin for OctoberCMS + +This plugin adds global search capabilities to OctoberCMS. + +## Available languages + +* English +* German +* Czech +* Russian +* Persian (Farsi) +* Portuguese + +You can translate all contents into your own language. + +## Currently supported content types + +* [RainLab.Pages](https://octobercms.com/plugin/rainlab-pages) +* [RainLab.Blog](https://octobercms.com/plugin/rainlab-blog) +* [Indikator.News](https://github.com/gergo85/oc-news) +* [Feegleweb.Octoshop](https://octobercms.com/plugin/feegleweb-octoshop) +* [Jiri.JKShop](http://octobercms.com/plugin/jiri-jkshop) +* [RadiantWeb.ProBlog](https://octobercms.com/plugin/radiantweb-problog) +* [Arrizalamin.Portfolio](https://octobercms.com/plugin/arrizalamin-portfolio) +* [Responsiv.Showcase](https://octobercms.com/plugin/responsiv-showcase) +* [VojtaSvoboda.Brands](https://octobercms.com/plugin/vojtasvoboda-brands) +* Native CMS pages (experimental) + +**Multilingual contents via RainLab.Translate are supported.** + +Support for more plugins is added upon request. + +**You can easily extend this plugin to search your custom plugin's contents as well. +See the documentation for further information.** + +### Get native support for your plugin + +If you are a plugin developer and wish to have native support for your contents in SiteSearch please submit a pull +request for your search provider or send us a copy of you plugin so we can create the provider for you. + +We cannot add support for every plugin but will add any plugin that has a notable project count on the October +Marketplace. + + +## Components + +### searchResults + +Place this component on your page to display search results. + +#### Usage example + +Create a search form that sends a query to your search page: + +##### Search form + +```html +
+ + +
+``` + +**Important**: Use the `q` parameter to send the user's query. + +##### Search results + +Create a page to display your search results. Add the `searchResults` component to it. +Use the `searchResults.query` parameter to display the user's search query. + +```html +title = "Search results" +url = "/search" +... + +[searchResults] +resultsPerPage = 10 +showProviderBadge = 1 +noResultsMessage = "Your search did not return any results." +visitPageMessage = "Visit page" +== +

Search results for {{ searchResults.query }}

+ +{% component 'searchResults' %} +``` + +##### Example css to style the component + +```css +.ss-result { + margin-bottom: 2em; +} +.ss-result__aside { + float: right; + margin-left: .5em; +} +.ss-result__title { + font-weight: bold; + margin-bottom: .5em; +} +.ss-result__badge { + font-size: .7em; + padding: .2em .5em; + border-radius: 4px; + margin-left: .75em; + background: #eee; + display: inline-block; +} +.ss-result__text { + margin-bottom: .5em; +} +.ss-result__url { +} +``` + +#### Properties + +The following properties are available to change the component's behaviour. + +##### resultsPerPage + +How many results to display on one page. + +##### showProviderBadge + +The search works by querying multiple providers (Pages, Blog, or other). If this option is enabled +each search result is marked with a badge to show which provider returned the result. + +This is useful if your site has many different entities (ex. teams, employees, pages, blog entries). + +##### noResultsMessage + +This message is shown if there are no results returned. + +##### visitPageMessage + +A link is placed below each search result. Use this property to change that link's text. + +## Add support for custom plugin contents + +To return search results for you own custom plugin, register an event listener for the `offline.sitesearch.query` +event in your plugin's boot method. + +Return an array containing a `provider` string and `results` array. Each result must provide at least a `title` key. + +### Example to search for custom `documents` + +```php +public function boot() +{ + \Event::listen('offline.sitesearch.query', function ($query) { + + // Search your plugin's contents + $items = YourCustomDocumentModel::where('title', 'like', "%${query}%") + ->orWhere('content', 'like', "%${query}%") + ->get(); + + // Now build a results array + $results = $items->map(function ($item) use ($query) { + + // If the query is found in the title, set a relevance of 2 + $relevance = mb_stripos($item->title, $query) !== false ? 2 : 1; + + return [ + 'title' => $item->title, + 'text' => $item->content, + 'url' => '/document/' . $item->slug, + 'thumb' => $item->images->first(), // Instance of System\Models\File + 'relevance' => $relevance, // higher relevance results in a higher + // position in the results listing + // 'meta' => 'data', // optional, any other information you want + // to associate with this result + ]; + }); + + return [ + 'provider' => 'Document', // The badge to display for this result + 'results' => $results, + ]; + }); +} +``` + +That's it! + +## Settings + +You can manage all of this plugin's settings in the October CMS backend. + +### Rainlab.Pages + +No special configuration is required. + +### Rainlab.Blog + +Make sure you select your CMS page with the `blogPost` component as the `blog post page` in the backend settings. + +You can access a post's published_at date in your search results via `{{ result.meta }}`. + +### Feegleweb.Octoshop + +Make sure you set the `Url of product detail page` setting to point to the right url. Only specify the fixed part of +the URL: `/product`. If your products are located under `/product/:slug` the default value is okay. + +### Jiri.JKShop + +Make sure you set the `Url of product detail page` setting to point to the right url. Only specify the fixed part of +the URL: `/product`. If your products are located under `/product/:slug` the default value is okay. + +You can access an article's price in your search results via `{{ result.meta }}`. + +### Indikator.News + +Make sure you set the `News post page` setting to point to the right url. Only specify the fixed part of +the URL: `/news/post`. If your products are located under `/news/post/:slug` the default value is okay. + +### RadiantWeb.ProBlog + +Make sure you set the `Url of blog post page` setting to point to the right url. Only specify the fixed part of +the URL: `/blog`. If your posts are located under `/blog/:category/:slug` the default value is okay. + +### ArrizalAmin.Portfolio + +Make sure you set the `Url of portfolio detail page` setting to point to the right url. Only specify the fixed part of +the URL: `/portfolio/project`. If your detail page is located under `/portfolio/project/:slug` the default value is okay. + +### VojtaSvoboda.Brands + +Make sure you set the `Url of brand detail page` setting to point to the right URL. Only specify the fixed part of the URL: `/brand`. If your brand detail page is located under `/brand/:slug` then insert only `/brand` without the slug parameter. + +### CMS pages (experimental) + +If you want to provide search results for CMS pages change the `enabled` setting to `On`. + +You have to specifically add the component `siteSearchInclude` to every CMS page you want to be searched. +Pages **without** this component will **not** be searched. + +Components on CMS pages will **not** be rendered. Use this provider only for simple html pages. All Twig syntax will be stripped out to prevent the leaking of source code to the search results. + +CMS pages with dynamic URLs (like `/page/:slug`) won't be linked correctly from the search results listing. + +If you have CMS pages with dynamic contents consider writing your own search provider (see `Add support for custom +plugin contents`) + + +## Overwrite default markup + +To overwrite the default markup copy all files from `plugins/offline/sitesearch/components/searchresults` to +`themes/your-theme/partials/searchResults` and modify them as needed. + +If you gave an alias to the `searchResults` component make sure to put the markup in the appropriate partials directory `themes/your-theme/partials/your-given-alias`. + diff --git a/plugins/offline/sitesearch/classes/Result.php b/plugins/offline/sitesearch/classes/Result.php new file mode 100644 index 0000000..145e07f --- /dev/null +++ b/plugins/offline/sitesearch/classes/Result.php @@ -0,0 +1,268 @@ +setQuery($query); + $this->setRelevance($relevance); + $this->setProvider($provider); + } + + /** + * Set a property on the Result. + * + * Since only public properties can be accessed via Twig and it + * does not support __get, we need to make all properties public. + * This method tries to ensure that only valid properties + * are set and all values are passed through the respective + * setter method. + * + * @param $property + * @param $value + * + * @throws \InvalidArgumentException + */ + public function __set($property, $value) + { + $method = 'set' . ucfirst($property); + if ( ! method_exists($this, $method)) { + throw new \InvalidArgumentException(sprintf('"%s" is not a valid property to set.', $property)); + } + + call_user_func([$this, $method], $value); + } + + /** + * @param $query + * + * @return Result + */ + public function setQuery($query) + { + $this->query = $query; + + return $this; + } + + /** + * @param $meta + * + * @return Result + */ + public function setMeta($meta) + { + $this->meta = $meta; + + return $this; + } + + /** + * @param float $relevance + * + * @return $this + */ + public function setRelevance($relevance) + { + $this->relevance = (float)$relevance; + + return $this; + } + + /** + * @param string $provider + * + * @return $this + */ + public function setProvider($provider) + { + $this->provider = $provider; + + return $this; + } + + /** + * @param string $title + * + * @return Result + */ + public function setTitle($title) + { + $this->title = $this->markQuery($this->prepare($title)); + + return $this; + } + + /** + * Sets the text property and creates + * a separate excerpt to display in the results + * listing. + * + * @param string $text + * + * @return Result + */ + public function setText($text) + { + $this->text = $this->prepare($text); + $this->excerpt = $this->createExcerpt( + $this->markQuery($this->text) + ); + + return $this; + } + + /** + * @param string $url + * + * @return Result + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * @param File $thumb + * + * @return Result + */ + public function setThumb(File $thumb = null) + { + $this->thumb = $thumb; + + return $this; + } + + /** + * Shortens a string and removes all HTML. + * + * @param string $string + * + * @return string + */ + protected function prepare($string) + { + // Add a space before each tag to prevent + // paragraphs from sticking together after + // removing the html. + $string = str_replace('<', ' <', $string); + + return Html::strip($string); + } + + /** + * Creates an excerpt of the query-relevant parts of $text + * to display below a search result. + * + * @param $text + * + * @return string + */ + protected function createExcerpt($text) + { + $length = Settings::get('excerpt_length', 250); + + $loweredText = mb_strtolower($text); + $loweredQuery = mb_strtolower($this->query); + + $position = mb_strpos($loweredText, '' . $loweredQuery . ''); + $start = (int)$position - ($length / 2); + + if ($start < 0) { + $excerpt = Str::limit($text, $length); + } else { + // The relevant part is in the middle of the string, + // so surround it with "..." + $excerpt = '...' . trim(mb_substr($text, $start, $length)) . '...'; + } + + return $this->checkBorders($excerpt); + } + + + /** + * Surrounds all instances of the query + * in $text with tags. + * + * @param $text + * + * @return string + */ + private function markQuery($text) + { + // Only mark the query if this feature is enabled + if ( ! Settings::get('mark_results', true)) { + return $text; + } + + return (string)preg_replace('/(' . preg_quote($this->query, '/') . ')/i', '$0', $text); + } + + + /** + * Checks for unclosed/broken tags on the + * end of the excerpt and removes it if found. + * + * @param string $excerpt + * + * @return string + */ + protected function checkBorders($excerpt) + { + // count opening and closing tags + $openings = substr_count($excerpt, ''); + $closings = substr_count($excerpt, ''); + if ($openings !== $closings) { + // last mark tag seems to be broken, remove it + $position = mb_strrpos($excerpt, ''); + $excerpt = trim(mb_substr($excerpt, 0, $position)) . '...'; + } + + return $excerpt; + } + +} diff --git a/plugins/offline/sitesearch/classes/ResultCollection.php b/plugins/offline/sitesearch/classes/ResultCollection.php new file mode 100644 index 0000000..e9920eb --- /dev/null +++ b/plugins/offline/sitesearch/classes/ResultCollection.php @@ -0,0 +1,96 @@ +query = $query; + } + + /** + * Adds results from multiple providers at once. + * + * @param array $resultsArray + * + * @return ResultCollection + * @throws \DomainException + */ + public function addMany(array $resultsArray) + { + foreach ($resultsArray as $results) { + $this->add($results); + } + + return $this; + } + + /** + * Adds all the results from a single provider. + * + * @param $results + * + * @throws DomainException + * @return ResultCollection + */ + public function add($results) + { + if ( ! is_array($results)) { + $results = [$results]; + } + + foreach ($results as $result) { + $this->isValidResult($result) + ->push($result); + } + + return $this; + } + + /** + * Checks if the given $result is a Result instance. + * + * @param $result + * + * @throws DomainException + * @return ResultCollection + */ + protected function isValidResult($result) + { + if ( ! $result instanceof Result) { + throw new DomainException('You can only put Result instances into a ResultCollection'); + } + + return $this; + } + + /** + * Return all results as an array. + * + * @return array + */ + public function results() + { + return $this->all(); + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/classes/providers/ArrizalaminPortfolioResultsProvider.php b/plugins/offline/sitesearch/classes/providers/ArrizalaminPortfolioResultsProvider.php new file mode 100644 index 0000000..ae9e088 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/ArrizalaminPortfolioResultsProvider.php @@ -0,0 +1,104 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->items() as $item) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($item->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $item->title; + $result->text = $item->description; + $result->url = $this->getUrl($item); + $result->thumb = $this->getThumb($item->images); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function items() + { + return Item::with(['images']) + ->where('title', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->get(); + } + + /** + * Checks if the ArrizalAmin.Portfolio Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('arrizalamin_portfolio_enabled', true); + } + + /** + * Generates the url to a blog post. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(Settings::get('arrizalamin_portfolio_url', '/portfolio/project'), '/'); + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return implode('/', [$langPrefix, $url, $post->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('arrizalamin_portfolio_label', 'Portfolio'); + } + + /** + * Return the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'ArrizalAmin.Portfolio'; + } + +} diff --git a/plugins/offline/sitesearch/classes/providers/CmsPagesResultsProvider.php b/plugins/offline/sitesearch/classes/providers/CmsPagesResultsProvider.php new file mode 100644 index 0000000..ec5a95b --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/CmsPagesResultsProvider.php @@ -0,0 +1,126 @@ +isEnabled()) { + return $this; + } + + foreach ($this->pages() as $page) { + $contents = $this->removeTwigTags($page->markup); + + if ( ! $page->hasComponent('siteSearchInclude') || ! $this->containsQueryIn($contents, $page)) { + continue; + } + + $relevance = $this->containsQuery($page->settings['title']) ? 2 : 1; + + $result = new Result($this->query, $relevance); + $result->title = $page->settings['title']; + $result->text = $contents; + $result->url = $page->settings['url']; + + $this->addResult($result); + } + + return $this; + } + + /** + * Checks if this provider is enabled + * in the config. + * + * @return bool + */ + protected function isEnabled() + { + return Settings::get('cms_pages_enabled', false); + } + + /** + * Removes {{ }} and {% %} markup blocks. + * + * @param $html + * + * @return mixed + */ + private function removeTwigTags($html) + { + return preg_replace('/\{[%\{][^\}]*[%\}]\}/', '', $html); + } + + /** + * Get all cms pages. + * + * @return Collection + */ + protected function pages() + { + return Page::listInTheme(Theme::getActiveTheme(), true); + } + + /** + * Checks if $subjects contains the query string. + * + * @param $subject + * + * @return bool + */ + protected function containsQuery($subject) + { + return mb_strpos(strtolower($subject), strtolower($this->query)) !== false; + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('cms_pages_label', 'Page'); + } + + /** + * Search the query in the title and contents of the page. + * + * @param $contents + * @param $page + * + * @return bool + */ + protected function containsQueryIn($contents, $page) + { + return $this->containsQuery($contents) || $this->containsQuery($page->settings['title']); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return ''; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/FeeglewebOctoshopProductsResultsProvider.php b/plugins/offline/sitesearch/classes/providers/FeeglewebOctoshopProductsResultsProvider.php new file mode 100644 index 0000000..5124643 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/FeeglewebOctoshopProductsResultsProvider.php @@ -0,0 +1,107 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->products() as $product) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($product->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $product->title; + $result->text = $product->intro; + $result->url = $this->getUrl($product); + $result->thumb = $this->getThumb($product->images); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all products with matching title or content. + * + * @return Collection + */ + protected function products() + { + return Product::enabled()->withImages() + ->where('title', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->orderBy('updated_at', 'desc') + ->get(); + } + + /** + * Checks if the Feegleweb.Octoshop Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('octoshop_products_enabled', true); + } + + /** + * Generates the url to a shop product. + * + * @param $product + * + * @return string + */ + protected function getUrl($product) + { + $url = trim(Settings::get('octoshop_products_itemurl', '/product'), '/'); + + return implode('/', [$url, $product->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get( + 'octoshop_products_label', + trans('offline.sitesearch::lang.settings.octoshop_itemurl_badge') + ); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'Feegleweb.Octoshop'; + } + +} diff --git a/plugins/offline/sitesearch/classes/providers/GenericResultsProvider.php b/plugins/offline/sitesearch/classes/providers/GenericResultsProvider.php new file mode 100644 index 0000000..732df72 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/GenericResultsProvider.php @@ -0,0 +1,102 @@ +query); + + foreach ($returns as $return) { + $results = array_key_exists('results', $return) ? $return['results'] : []; + $provider = array_key_exists('provider', $return) ? $return['provider'] : ''; + + $this->addResultsForProvider($results, $provider); + } + + return $this; + } + + /** + * Adds a result to the ResultBag. + * + * @param $returns + * @param $provider + * + * @throws DomainException + */ + protected function addResultsForProvider($returns, $provider) + { + foreach ($returns as $return) { + if ( ! $this->validate($return)) { + continue; + }; + + $relevance = isset($return['relevance']) ? $return['relevance'] : 1; + + $result = new Result($this->query, $relevance, $provider); + foreach ($return as $key => $value) { + $result->{$key} = $value; + } + + $this->addResult($result, $provider); + } + } + + /** + * Validates that all mandatory keys are + * available in the provided results array + * + * @param $return + * + * @throws DomainException + * @return array + */ + protected function validate($return) + { + if ( ! is_array($return)) { + return false; + } + if ( ! array_key_exists('title', $return)) { + return false; + } + + return true; + } + + /** + * Display name for this provider. + * + * @return string + */ + public function displayName() + { + return 'Generic'; + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return ''; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/IndikatorNewsResultsProvider.php b/plugins/offline/sitesearch/classes/providers/IndikatorNewsResultsProvider.php new file mode 100644 index 0000000..bba1dc5 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/IndikatorNewsResultsProvider.php @@ -0,0 +1,107 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->posts() as $post) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($post->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $post->title; + $result->text = $post->introductory; + $result->url = $this->getUrl($post); + $result->meta = $post->published_at; + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function posts() + { + return Posts::isPublished() + ->where(function ($query) { + $query->where('title', 'like', "%{$this->query}%") + ->orWhere('introductory', 'like', "%{$this->query}%") + ->orWhere('content', 'like', "%{$this->query}%"); + }) + ->orderBy('published_at', 'desc') + ->get(); + } + + /** + * Checks if the Indikator.News Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('indikator_news_enabled', true); + } + + /** + * Generates the url to a blog post. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(Settings::get('indikator_news_posturl', '/news/post'), '/'); + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return implode('/', [$langPrefix, $url, $post->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('indikator_news_label', 'News'); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'Indikator.News'; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/JiriJKShopResultsProvider.php b/plugins/offline/sitesearch/classes/providers/JiriJKShopResultsProvider.php new file mode 100644 index 0000000..f5c04d0 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/JiriJKShopResultsProvider.php @@ -0,0 +1,117 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->products() as $product) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($product->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $product->title; + $result->text = $product->short_description; + $result->url = $this->getUrl($product); + $result->meta = $product->getFinalPriceFormated(); + + if (count($product->images) > 0) { + $image = $product->images->first(); + if ($image instanceof File) { + $result->thumb = $image; + } + } + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all products with matching title or content. + * + * @return Collection + */ + protected function products() + { + return Product::with(['images']) + ->where('title', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->orWhere('short_description', 'like', "%{$this->query}%") + ->having('active', '=', true) + ->orderBy('updated_at', 'desc') + ->get(); + } + + /** + * Checks if the Jiri.JKShop Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('jiri_jkshop_enabled', false); + } + + /** + * Generates the url to a shop product. + * + * @param $product + * + * @return string + */ + protected function getUrl($product) + { + $url = trim(Settings::get('jiri_jkshop_itemurl', '/product'), '/'); + + return implode('/', [$url, $product->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get( + 'jiri_jkshop_label', + trans('offline.sitesearch::lang.settings.jiri_jkshop_itemurl_badge') + ); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'Jiri.JKShop'; + } + +} diff --git a/plugins/offline/sitesearch/classes/providers/OfflineSnipcartShopResultsProvider.php b/plugins/offline/sitesearch/classes/providers/OfflineSnipcartShopResultsProvider.php new file mode 100644 index 0000000..77839b4 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/OfflineSnipcartShopResultsProvider.php @@ -0,0 +1,116 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->products() as $product) { + // Make this result more relevant, if the query is found in the name + $relevance = mb_stripos($product->name, $this->query) === false ? 1 : 2; + $description = $product->description_short ?: $product->description; + + $result = new Result($this->query, $relevance); + $result->title = $product->name; + $result->text = $description; + $result->url = $this->getUrl($product); + $result->thumb = $product->image; + $result->meta = [ + 'price' => $product->price, + ]; + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all products with matching title or content. + * + * @return Collection + */ + protected function products() + { + return Product::published()->with(['main_image', 'images']) + ->where('name', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->orWhere('description_short', 'like', "%{$this->query}%") + ->orWhere('meta_title', 'like', "%{$this->query}%") + ->orWhere('meta_description', 'like', "%{$this->query}%") + ->orderBy('updated_at', 'desc') + ->get(); + } + + /** + * Checks if the OFFLINE.SnipcartShop Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('snipcartshop_products_enabled', true); + } + + /** + * Generates the url to a shop product. + * + * @param $product + * + * @return string + */ + protected function getUrl($product) + { + $page = GeneralSettings::get('product_page'); + + return (new Controller())->pageUrl($page, ['slug' => $product->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get( + 'snipcartshop_products_label', + trans('offline.sitesearch::lang.settings.snipcartshop_itemurl_badge') + ); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'OFFLINE.SnipcartShop'; + } + +} diff --git a/plugins/offline/sitesearch/classes/providers/RadiantWebProBlogResultsProvider.php b/plugins/offline/sitesearch/classes/providers/RadiantWebProBlogResultsProvider.php new file mode 100644 index 0000000..959a862 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/RadiantWebProBlogResultsProvider.php @@ -0,0 +1,131 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->posts() as $post) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($post->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $post->title; + $result->text = $this->getSummary($post); + $result->url = $this->getUrl($post); + $result->thumb = $this->getThumb($post->featured_images); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function posts() + { + return Post::with(['categories', 'featured_images']) + ->isPublished() + ->where('title', 'like', "%{$this->query}%") + ->orWhere('content', 'like', "%{$this->query}%") + ->orWhere('excerpt', 'like', "%{$this->query}%") + ->orderBy('published_at', 'desc') + ->get(); + } + + /** + * Checks if the Radiantweb.Problog Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && SiteSearchSettings::get('radiantweb_problog_enabled', true); + } + + /** + * Generates the url to a blog post. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(SiteSearchSettings::get('radiantweb_problog_posturl', '/blog'), '/'); + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return implode('/', [$langPrefix, $url, $post->categories->slug, $post->slug]); + } + + /** + * Get the post's excerpt if available + * otherwise fall back to a limited content string. + * + * @param $post + * + * @return string + */ + private function getSummary($post) + { + $excerpt = $post->excerpt; + if (mb_strlen(trim($excerpt))) { + return $excerpt; + } + + $content = $post->content; + if (Settings::get('markdownMode')) { + $content = Post::formatHtml($content); + } + + return $content; + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return SiteSearchSettings::get('radiantweb_problog_label', 'Blog'); + } + + /** + * Return the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'Radiantweb.Problog'; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/RainlabBlogResultsProvider.php b/plugins/offline/sitesearch/classes/providers/RainlabBlogResultsProvider.php new file mode 100644 index 0000000..fec3b49 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/RainlabBlogResultsProvider.php @@ -0,0 +1,186 @@ +controller = $controller; + } + + /** + * Runs the search for this provider. + * + * @return ResultsProvider + */ + public function search() + { + if ( ! $this->isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->posts() as $post) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($post->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $post->title; + $result->text = $post->summary; + $result->meta = $post->created_at; + + // Maintain compatibility with old setting + if (Settings::get('rainlab_blog_page') !== null) { + $result->url = $post->setUrl(Settings::get('rainlab_blog_page', ''), $this->controller); + } else { + $result->url = $this->getUrl($post); + } + + $result->thumb = $this->getThumb($post->featured_images); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function posts() + { + // If Rainlab.Translate is not installed or we are currently, + // using the default locale we simply query the default table. + $translator = $this->translator(); + if ( ! $translator || $translator->getDefaultLocale() === $translator->getLocale()) { + return $this->postsFromDefaultLocale(); + } + + // If Rainlab.Translate is available we also have to + // query the rainlab_translate_attributes table for translated + // contents since the title and content attributes on the Post + // model are not indexed. + return $this->postsFromCurrentLocale(); + } + + /** + * Returns all matching posts from the default locale. + * Translated attributes are ignored. + * + * @return Collection + */ + protected function postsFromDefaultLocale() + { + return $this->defaultModelQuery() + ->where(function ($query) { + $query->where('title', 'like', "%{$this->query}%") + ->orWhere('content', 'like', "%{$this->query}%") + ->orWhere('excerpt', 'like', "%{$this->query}%"); + }) + ->get(); + } + + /** + * Returns all matching posts with translated contents. + * + * @return Collection + */ + protected function postsFromCurrentLocale() + { + // First fetch all model ids with maching contents. + $results = DB::table('rainlab_translate_attributes') + ->where('model_type', Post::class) + ->where('attribute_data', 'LIKE', "%{$this->query}%") + ->get(['model_id']); + + $ids = collect($results)->pluck('model_id'); + + // Then return all maching posts via Eloquent. + return $this->defaultModelQuery() + ->whereIn('id', $ids) + ->get(); + } + + /** + * This is the default "base query" for quering + * matching models. + */ + protected function defaultModelQuery() + { + return Post::isPublished() + ->with(['featured_images']) + ->orderBy('published_at', 'desc'); + } + + /** + * Checks if the RainLab.Blog Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('rainlab_blog_enabled', true); + } + + /** + * Generates the url to a blog post. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(Settings::get('rainlab_blog_posturl', '/blog/post'), '/'); + + return implode('/', [$url, $post->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('rainlab_blog_label', 'Blog'); + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'RainLab.Blog'; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/RainlabPagesResultsProvider.php b/plugins/offline/sitesearch/classes/providers/RainlabPagesResultsProvider.php new file mode 100644 index 0000000..ced74d5 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/RainlabPagesResultsProvider.php @@ -0,0 +1,157 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->pages() as $page) { + // Make this result more relevant, if the query is found in the title + $relevance = $this->containsQuery($page->viewBag['title']) ? 2 : 1; + + $result = new Result($this->query, $relevance); + $result->title = $page->viewBag['title']; + $result->text = $page->parsedMarkup; + $result->url = $this->getUrl($page); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all pages with matching title or content. + * + * @return Collection + */ + protected function pages() + { + + $pages = Page::all()->filter(function ($page) { + return $this->containsQuery($page->parsedMarkup) + || $this->viewBagContainsQuery($page->viewBag); + }); + + return $pages; + } + + /** + * Checks if the RainLab.Pages Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('rainlab_pages_enabled', true); + } + + /** + * Checks if $subject contains the query string. + * + * @param $subject + * + * @return bool + */ + protected function containsQuery($subject) + { + return is_array($subject) + ? $this->arrayContainsQuery($subject) + : mb_strpos(mb_strtolower($subject), mb_strtolower($this->query)) !== false; + } + + /** + * Checks if a viewBag contains the query string. + * + * @param $viewBag + * + * @return bool + */ + protected function viewBagContainsQuery($viewBag) + { + $ignoreViewBagKeys = [ + 'url', + 'layout', + 'is_hidden', + 'navigation_hidden', + ]; + + $properties = collect($viewBag)->except($ignoreViewBagKeys)->toArray(); + + return $this->arrayContainsQuery($properties); + } + + /** + * Checks if an array contains the query string. + * + * @param $array + * + * @return bool + */ + protected function arrayContainsQuery(array $array) + { + foreach ($array as $value) { + if ($this->containsQuery($value)) { + return true; + } + } + + return false; + } + + /** + * Display name for this provider. + * + * @return string + */ + public function displayName() + { + return Settings::get('rainlab_pages_label', 'Page'); + } + + /** + * Get the page's (translated) url. + * + * @param $page + * + * @return string + */ + protected function getUrl($page) + { + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return $langPrefix . $page->viewBag['url']; + } + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'RainLab.Pages'; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/ResponsivShowcaseResultsProvider.php b/plugins/offline/sitesearch/classes/providers/ResponsivShowcaseResultsProvider.php new file mode 100644 index 0000000..926dd0d --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/ResponsivShowcaseResultsProvider.php @@ -0,0 +1,102 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->items() as $item) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($item->title, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $item->title; + $result->text = $item->description; + $result->url = $this->getUrl($item); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function items() + { + return Item::where('title', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->orWhere('content', 'like', "%{$this->query}%") + ->get(); + } + + /** + * Checks if the Responsiv.Showcase Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('responsiv_showcase_enabled', true); + } + + /** + * Generates the url to a blog post. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(Settings::get('responsiv_showcase_url', '/showcase/project'), '/'); + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return implode('/', [$langPrefix, $url, $post->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('responsiv_showcase_label', 'Showcase'); + } + + /** + * Return the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'Responsiv.Showcase'; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/ResultsProvider.php b/plugins/offline/sitesearch/classes/providers/ResultsProvider.php new file mode 100644 index 0000000..28a5cbe --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/ResultsProvider.php @@ -0,0 +1,158 @@ +query = $query; + $this->identifier = $this->identifier(); + $this->displayName = $this->displayName(); + $this->translator = $this->translator(); + } + + /** + * Search for results. + * + * @return ResultsProvider + */ + abstract public function search(); + + /** + * The display name for a provider. + * Displayed as badge for each result. + * + * @return string + */ + abstract public function displayName(); + + /** + * Returns the plugin's identifier string. + * + * @return string + */ + abstract public function identifier(); + + /** + * Adds a result to the results array. + * + * @param Result $result + * @param null $provider + * + * @return ResultsProvider + */ + public function addResult(Result $result, $provider = null) + { + if ($provider === null) { + $result->provider = $this->displayName; + } + + $this->results[] = $result; + + return $this; + } + + /** + * Return this provider's results array. + * + * @return array + */ + public function results() + { + return $this->results; + } + + /** + * Check's if a plugin is installed and enabled. + * + * @param string Plugin identifier + * + * @return bool + */ + protected function isPluginAvailable($name) + { + return PluginManager::instance()->hasPlugin($name) + && ! PluginManager::instance()->isDisabled($name); + } + + + /** + * Check if the Rainlab.Translate plugin is installed + * and if yes, get the translator instance. + * + * @return Translator|bool + */ + protected function translator() + { + return $this->isPluginAvailable('RainLab.Translate') + ? Translator::instance() + : false; + } + + /** + * Extract the item's thumb. + * + * @param $images + * + * @return null|File + */ + protected function getThumb($images) + { + if (count($images) < 1) { + return null; + } + + $image = $images->first(); + if ( ! $image instanceof File) { + return null; + } + + return $image; + } +} diff --git a/plugins/offline/sitesearch/classes/providers/VojtaSvobodaBrandsResultsProvider.php b/plugins/offline/sitesearch/classes/providers/VojtaSvobodaBrandsResultsProvider.php new file mode 100644 index 0000000..4954e94 --- /dev/null +++ b/plugins/offline/sitesearch/classes/providers/VojtaSvobodaBrandsResultsProvider.php @@ -0,0 +1,101 @@ +isInstalledAndEnabled()) { + return $this; + } + + foreach ($this->items() as $item) { + // Make this result more relevant, if the query is found in the title + $relevance = mb_stripos($item->name, $this->query) === false ? 1 : 2; + + $result = new Result($this->query, $relevance); + $result->title = $item->name; + $result->text = $item->description; + $result->url = $this->getUrl($item); + $result->thumb = $this->getThumb($item->logo); + + $this->addResult($result); + } + + return $this; + } + + /** + * Get all posts with matching title or content. + * + * @return Collection + */ + protected function items() + { + return Brand::with(['logo']) + ->where('name', 'like', "%{$this->query}%") + ->orWhere('description', 'like', "%{$this->query}%") + ->get(); + } + + /** + * Checks if the VojtaSvoboda.Brands Plugin is installed and + * enabled in the config. + * + * @return bool + */ + protected function isInstalledAndEnabled() + { + return $this->isPluginAvailable($this->identifier) + && Settings::get('vojtasvoboda_brands_enabled', true); + } + + /** + * Generates the url to a brand. + * + * @param $post + * + * @return string + */ + protected function getUrl($post) + { + $url = trim(Settings::get('vojtasvoboda_brands_url', '/brand'), '/'); + $langPrefix = $this->translator ? $this->translator->getLocale() : ''; + + return implode('/', [$langPrefix, $url, $post->slug]); + } + + /** + * Display name for this provider. + * + * @return mixed + */ + public function displayName() + { + return Settings::get('vojtasvoboda_brands_label', 'Brands'); + } + + /** + * Return the plugin's identifier string. + * + * @return string + */ + public function identifier() + { + return 'VojtaSvoboda.Brands'; + } +} diff --git a/plugins/offline/sitesearch/components/SearchResults.php b/plugins/offline/sitesearch/components/SearchResults.php new file mode 100644 index 0000000..ac678cc --- /dev/null +++ b/plugins/offline/sitesearch/components/SearchResults.php @@ -0,0 +1,256 @@ + 'offline.sitesearch::lang.searchResults.title', + 'description' => 'offline.sitesearch::lang.searchResults.description', + ]; + } + + /** + * The component's properties. + * + * @return array + */ + public function defineProperties() + { + return [ + 'resultsPerPage' => [ + 'title' => 'offline.sitesearch::lang.searchResults.properties.results_per_page.title', + 'type' => 'string', + 'validationPattern' => '^[0-9]+$', + 'validationMessage' => 'Please enter only numbers', + 'default' => '10', + ], + 'showProviderBadge' => [ + 'title' => 'offline.sitesearch::lang.searchResults.properties.provider_badge.title', + 'description' => 'offline.sitesearch::lang.searchResults.properties.provider_badge.description', + 'type' => 'checkbox', + 'default' => 1, + ], + 'noResultsMessage' => [ + 'title' => 'offline.sitesearch::lang.searchResults.properties.no_results.title', + 'description' => 'offline.sitesearch::lang.searchResults.properties.no_results.description', + 'type' => 'string', + 'default' => 'Your search returned no results.', + 'showExternalParam' => false, + ], + 'visitPageMessage' => [ + 'title' => 'offline.sitesearch::lang.searchResults.properties.visit_page.title', + 'description' => 'offline.sitesearch::lang.searchResults.properties.visit_page.description', + 'type' => 'string', + 'default' => 'Visit page', + 'showExternalParam' => false, + ], + ]; + } + + /** + * Component setup. + * + * @return void + */ + public function onRun() + { + $this->prepareVars(); + + $this->resultCollection = $this->buildResultCollection(); + } + + /** + * Setup all needed variables. + * + * @return void + */ + protected function prepareVars() + { + $this->setVar('pageNumber', Request::get('page', 1)); + $this->setVar('query', Request::get('q', '')); + $this->setVar('noResultsMessage'); + $this->setVar('visitPageMessage'); + $this->setVar('showProviderBadge'); + $this->setVar('resultsPerPage'); + } + + /** + * Sets a var as a property on this class + * and as a key in $this->page. + * + * If no value is specified the component property + * named $var is set as value. + * + * @param $var + * @param null $value + */ + protected function setVar($var, $value = null) + { + if ($value === null) { + $value = $this->property($var); + } + $this->{$var} = $this->page[$var] = $value; + } + + /** + * Call all result providers and combine + * their results in a ResultCollection. + * + * @throws DomainException + * @return ResultCollection + */ + protected function buildResultCollection() + { + $results = new ResultCollection(); + $results->setQuery($this->query); + if ($this->query !== '') { + $results->addMany([ + (new OfflineSnipcartShopResultsProvider($this->query))->search()->results(), + (new RadiantWebProBlogResultsProvider($this->query))->search()->results(), + (new FeeglewebOctoshopProductsResultsProvider($this->query))->search()->results(), + (new JiriJKShopResultsProvider($this->query))->search()->results(), + (new IndikatorNewsResultsProvider($this->query))->search()->results(), + (new ArrizalaminPortfolioResultsProvider($this->query))->search()->results(), + (new ResponsivShowcaseResultsProvider($this->query))->search()->results(), + (new RainlabBlogResultsProvider($this->query, $this->controller))->search()->results(), + (new RainlabPagesResultsProvider($this->query))->search()->results(), + (new CmsPagesResultsProvider($this->query))->search()->results(), + (new GenericResultsProvider($this->query))->search()->results(), + (new VojtaSvobodaBrandsResultsProvider($this->query))->search()->results(), + ]); + } + + $results = $results->sortByDesc('relevance'); + + return $results; + } + + /** + * Return the paginated results. + * + * @return Paginator + */ + public function results() + { + $paginator = new LengthAwarePaginator( + $this->getPaginatorSlice($this->resultCollection), + $this->resultCollection->count(), + $this->resultsPerPage, + $this->pageNumber + ); + + return $paginator->setPath(\Url::to($this->getPageUrl()))->appends('q', $this->query); + } + + /** + * Try to get the page's url. + * + * @return string + */ + public function getPageUrl() + { + // Component sits in cms page + if (isset($this->page->settings['url'])) { + return $this->page->settings['url']; + } + + // Component sits in static page via snippet + if (isset($this->page->apiBag['staticPage'])) { + return $this->page->apiBag['staticPage']->viewBag['url']; + } + + return ''; + } + + /** + * Return number of last page. + * + * @return int + */ + public function lastPage() + { + return (int)ceil($this->resultCollection->count() / $this->resultsPerPage); + } + + /** + * Returns the slice for the current page + 1 + * extra element to make the pagination work. + * + * @param $results + * + * @return ResultCollection + */ + protected function getPaginatorSlice($results) + { + return $results->slice(($this->pageNumber - 1) * $this->resultsPerPage, $this->resultsPerPage); + } +} diff --git a/plugins/offline/sitesearch/components/SiteSearchInclude.php b/plugins/offline/sitesearch/components/SiteSearchInclude.php new file mode 100644 index 0000000..734d564 --- /dev/null +++ b/plugins/offline/sitesearch/components/SiteSearchInclude.php @@ -0,0 +1,26 @@ + 'offline.sitesearch::lang.siteSearchInclude.title', + 'description' => 'offline.sitesearch::lang.siteSearchInclude.description', + ]; + } + + public function defineProperties() + { + return []; + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/components/searchresults/content.htm b/plugins/offline/sitesearch/components/searchresults/content.htm new file mode 100644 index 0000000..a0e99e8 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/content.htm @@ -0,0 +1,19 @@ +

+ {{ result.title | raw }} + {% if __SELF__.showProviderBadge %} + + {{ result.provider }} + + {% endif %} + + {# Some results contain meta information. #} + {# You can access it using {{ result.meta }} #} +

+ +

+ {{ result.excerpt | raw }} +

+ +

+ {{ __SELF__.visitPageMessage }} → +

\ No newline at end of file diff --git a/plugins/offline/sitesearch/components/searchresults/default.htm b/plugins/offline/sitesearch/components/searchresults/default.htm new file mode 100644 index 0000000..03cd699 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/default.htm @@ -0,0 +1,11 @@ +{% set results = __SELF__.results %} + +{% for result in results %} + {# Display all results #} + {% partial __SELF__ ~ '::searchresult.htm' result = result %} +{% else %} + {# No results found #} + {% partial __SELF__ ~ '::no-results.htm' %} +{% endfor %} + +{% partial __SELF__ ~ '::pagination.htm' results = results %} diff --git a/plugins/offline/sitesearch/components/searchresults/no-results.htm b/plugins/offline/sitesearch/components/searchresults/no-results.htm new file mode 100644 index 0000000..97e3192 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/no-results.htm @@ -0,0 +1 @@ +

{{ __SELF__.noResultsMessage }}

\ No newline at end of file diff --git a/plugins/offline/sitesearch/components/searchresults/pagination.htm b/plugins/offline/sitesearch/components/searchresults/pagination.htm new file mode 100644 index 0000000..a4845b3 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/pagination.htm @@ -0,0 +1,4 @@ +{% if results.hasPages %} + {{ results | raw }} +{% endif %} + diff --git a/plugins/offline/sitesearch/components/searchresults/searchresult.htm b/plugins/offline/sitesearch/components/searchresults/searchresult.htm new file mode 100644 index 0000000..b246b05 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/searchresult.htm @@ -0,0 +1,9 @@ +
+ {% if result.thumb %} + {% partial __SELF__ ~ '::thumbnail' result = result %} + {% endif %} +
+ {% partial __SELF__ ~ '::content' result = result %} +
+
+
\ No newline at end of file diff --git a/plugins/offline/sitesearch/components/searchresults/thumbnail.htm b/plugins/offline/sitesearch/components/searchresults/thumbnail.htm new file mode 100644 index 0000000..13cf250 --- /dev/null +++ b/plugins/offline/sitesearch/components/searchresults/thumbnail.htm @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/plugins/offline/sitesearch/composer.json b/plugins/offline/sitesearch/composer.json new file mode 100644 index 0000000..dbd5480 --- /dev/null +++ b/plugins/offline/sitesearch/composer.json @@ -0,0 +1,9 @@ +{ + "name": "offline/oc-site-search-plugin", + "description": "This plugin adds global search capabiliies to OctoberCMS.", + "type": "october-plugin", + "license": "MIT", + "require": { + "composer/installers": "~1.0" + } +} diff --git a/plugins/offline/sitesearch/lang/cs/lang.php b/plugins/offline/sitesearch/lang/cs/lang.php new file mode 100644 index 0000000..f5e8154 --- /dev/null +++ b/plugins/offline/sitesearch/lang/cs/lang.php @@ -0,0 +1,56 @@ + [ + 'name' => 'SiteSearch', + 'description' => 'Globální vyhledávání pro váš frontend', + 'author' => 'OFFLINE LLC', + 'manage_settings' => 'Správa SiteSearch nastavení', + 'manage_settings_permission' => 'Možnost měnit SiteSearch nastavení', + ], + 'settings' => [ + 'mark_results' => 'Označit hledanou frázi ve výsledcích vyhledávání', + 'mark_results_comment' => 'Obalit vyhledávaný výraz tagem ', + 'excerpt_length' => 'Délka ústižku', + 'excerpt_length_comment' => 'Délka ústřižku výsledku vyhledávání.', + 'use_this_provider' => 'Použít tuto službu', + 'use_this_provider_comment' => 'Povolit zobrazení výsledků vyhledávání z této služby', + 'provider_badge' => 'Označení služby', + 'provider_badge_comment' => 'Textové označení služby které se zobrazí vedle výsledku vyhledávání', + 'blog_posturl' => 'URL detailu blogového článku', + 'blog_posturl_comment' => 'Zadejte pevnou část URL bez dynamických parametrů, jako je konkrétní URL článku, nebo stránkování', + 'portfolio_itemurl' => 'Url of portfolio detail page', + 'portfolio_itemurl_comment' => 'Zadejte pevnou část URL bez dynamických parametrů, jako je konkrétní URL článku, nebo stránkování', + 'brands_itemurl' => 'URL detailní stránky značky', + 'brands_itemurl_comment' => 'Zadejte pevnou část URL bez dynamických parametrů, jako je konkrétní URL článku, nebo stránkování', + 'octoshop_itemurl' => 'Url der Produkt Detail-Seite', + 'octoshop_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'octoshop_itemurl_badge' => 'Produkt', + 'snipcartshop_itemurl_badge' => 'Produkt', + 'experimental' => 'Experimentalní funkce:', + 'experimental_refer_to_docs' => 'Tato služba je zatím v testování! Před použitím doporučujeme přečíst stránku dokumentace.', + ], + 'searchResults' => [ + 'title' => 'Výsledky vyhledávání', + 'description' => 'Zobrazí seznam výsledků vyhledávání', + 'properties' => [ + 'no_results' => [ + 'title' => 'Žádný výsledek vyhledávání', + 'description' => 'Tento text se zobrazí, když se nepovede nic najít', + ], + 'provider_badge' => [ + 'title' => 'Zobrazit označení služby', + 'description' => 'Vedle každého výsledku vyhledávání zobrazí označení služby (jestli je to článek, nebo stránka, atd)', + ], + 'results_per_page' => [ + 'title' => 'Výsledků na stránku', + ], + 'visit_page' => [ + 'title' => 'Text odkazu pro detail', + 'description' => 'Text odkazu který se zobrazí pod každým výsledkem vyhledávání', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'Zahrnout do SiteSearch', + 'description' => 'Přidejte toto do CMS stránky aby byla zahrnutá do SiteSearch vyhledávání', + ], +]; \ No newline at end of file diff --git a/plugins/offline/sitesearch/lang/de/lang.php b/plugins/offline/sitesearch/lang/de/lang.php new file mode 100644 index 0000000..4783937 --- /dev/null +++ b/plugins/offline/sitesearch/lang/de/lang.php @@ -0,0 +1,64 @@ + [ + 'name' => 'SiteSearch', + 'description' => 'Globale Suchfunktion für dein Frontend', + 'author' => 'OFFLINE GmbH', + 'manage_settings' => 'Konfigurieren Sie Ihre Suchfunktion', + 'manage_settings_permission' => 'Kann Einstellungen verwalten', + ], + 'settings' => [ + 'mark_results' => 'Markiere Treffer in Suchergebnissen', + 'mark_results_comment' => 'Suchbegriff wird mit Tags umschlossen', + 'excerpt_length' => 'Länge des Textauszuges', + 'excerpt_length_comment' => 'Länge des Textauszuges, der in den Suchresultaten angezeigt wird', + 'use_this_provider' => 'Diesen Provider verwenden', + 'use_this_provider_comment' => 'Aktivieren, um Suchergebnisse von diesem Provider miteinzubeziehen', + 'provider_badge' => 'Provider-Badge', + 'provider_badge_comment' => 'Dieser Text wird neben jedem Suchresultat angezeigt.', + 'blog_posturl' => 'URL der Blog-Post Seite', + 'blog_posturl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'blog_page' => 'Blog-Post Seite', + 'blog_page_comment' => 'Wähle die Seite aus, auf der dein Blog-Post angezeigt wird.', + 'portfolio_itemurl' => 'URL der Portfolio Detail-Seite', + 'portfolio_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'brands_itemurl' => 'URL der Brands Detail-Seite', + 'brands_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'showcase_itemurl' => 'URL der Shpwcase Detail-Seite', + 'showcase_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'octoshop_itemurl' => 'Url der Produkt Detail-Seite', + 'octoshop_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'octoshop_itemurl_badge' => 'Produkt', + 'snipcartshop_itemurl_badge' => 'Produkt', + 'jkshop_itemurl' => 'Url der Produkt Detail-Seite', + 'jkshop_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'jkshop_itemurl_badge' => 'Produkt', + 'experimental' => 'Experimentelle Funktion:', + 'experimental_refer_to_docs' => 'Dieser Provider ist experimentell! Bitte lies die Dokumentation, bevor du ihn benutzt!', + ], + 'searchResults' => [ + 'title' => 'Suchresultate', + 'description' => 'Listet Suchresultate auf', + 'properties' => [ + 'no_results' => [ + 'title' => '«Nichts gefunden» Text', + 'description' => 'Was angezeigt werden soll, wenn nichts gefunden wird', + ], + 'provider_badge' => [ + 'title' => 'Provider-Label anzeigen', + 'description' => 'Ob der Name des jeweiligen Suchproviders neben einem Resultat angezeigt werden soll', + ], + 'results_per_page' => [ + 'title' => 'Treffer pro Seite', + ], + 'visit_page' => [ + 'title' => '«Treffer anzeigen» Text', + 'description' => 'Dieser Text wird unterhalb jedes Suchresultates angezeigt', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'In SiteSearch beachten', + 'description' => 'Zu einer CMS Seite hinzufügen, um diese bei der Suche zu berücksichtigen', + ], +]; \ No newline at end of file diff --git a/plugins/offline/sitesearch/lang/en/lang.php b/plugins/offline/sitesearch/lang/en/lang.php new file mode 100644 index 0000000..bc52032 --- /dev/null +++ b/plugins/offline/sitesearch/lang/en/lang.php @@ -0,0 +1,66 @@ + [ + 'name' => 'SiteSearch', + 'description' => 'Global search for your frontend', + 'author' => 'OFFLINE LLC', + 'manage_settings' => 'Manage SiteSearch settings', + 'manage_settings_permission' => 'Can manage SiteSearch settings', + ], + 'settings' => [ + 'mark_results' => 'Mark matches in search results', + 'mark_results_comment' => 'Wrap the search term in tags', + 'excerpt_length' => 'Excerpt length', + 'excerpt_length_comment' => 'Length of the excerpt shown in the search results listing.', + 'use_this_provider' => 'Use this provider', + 'use_this_provider_comment' => 'Enable to display results for this provider', + 'provider_badge' => 'Provider badge', + 'provider_badge_comment' => 'Text to display in a search result\'s badge', + 'blog_posturl' => 'Url of blog post page', + 'blog_posturl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'blog_page' => 'Blog post page', + 'blog_page_comment' => 'Select a page used to display a single blog post. Needed to form URL for posts.', + 'news_page' => 'News post page', + 'news_page_comment' => 'Select a page used to display a single news post. Needed to form URL for news.', + 'portfolio_itemurl' => 'Url of portfolio detail page', + 'portfolio_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'brands_itemurl' => 'Url of brand detail page', + 'brands_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'showcase_itemurl' => 'Url of showcase detail page', + 'showcase_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'octoshop_itemurl' => 'Url of product detail page', + 'octoshop_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'octoshop_itemurl_badge' => 'Product', + 'snipcartshop_itemurl_badge' => 'Product', + 'jkshop_itemurl' => 'Url of product detail page', + 'jkshop_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'jkshop_itemurl_badge' => 'Product', + 'experimental' => 'Experimental feature:', + 'experimental_refer_to_docs' => 'This provider is experimental! Please refer to the documentation before using it.', + ], + 'searchResults' => [ + 'title' => 'Search results', + 'description' => 'Displays a list of search results', + 'properties' => [ + 'no_results' => [ + 'title' => 'No results message', + 'description' => 'What to display, if there are no results returned', + ], + 'provider_badge' => [ + 'title' => 'Show provider badge', + 'description' => 'Display the name of the search provider for each result', + ], + 'results_per_page' => [ + 'title' => 'Results per page', + ], + 'visit_page' => [ + 'title' => 'Visit page label', + 'description' => 'This link text is placed below each result', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'Include in SiteSearch', + 'description' => 'Add this to a CMS page to include it in the search results', + ], +]; diff --git a/plugins/offline/sitesearch/lang/fa/lang.php b/plugins/offline/sitesearch/lang/fa/lang.php new file mode 100644 index 0000000..c830f6f --- /dev/null +++ b/plugins/offline/sitesearch/lang/fa/lang.php @@ -0,0 +1,64 @@ + [ + 'name' => 'جستجو در سایت', + 'description' => 'جستجوی جهانی توسعه دهنده رابط کاربری', + 'author' => 'Offline LLC', + 'manage_settings' => 'مدیریت تنظیمات جستجوی سایت', + 'manage_settings_permission' => 'آیا می توانید تنظیمات جستجوی سایت را مدیریت کنید؟', + ], + 'settings' => [ + 'mark_results' => 'علامتگذاری به عنوان همخوانی داشتن در نتیجه جستجو', + 'mark_results_comment' => 'قرار دادن عبارت جستجو در <علامت> برچسب ها', + 'excerpt_length' => 'رشته منتخب', + 'excerpt_length_comment' => 'نمایش رشته انتخابی در لیست نتایج جستجو', + 'use_this_provider' => 'استفاده از این ارائه دهنده ها', + 'use_this_provider_comment' => 'قادر به نمایش نتایج برای این ارائه دهنده', + 'provider_badge' => 'نشان دهنده', + 'provider_badge_comment' => 'متن جهت نمایش در نتیجه', + 'blog_posturl' => 'آدرس وبلاگ صفحه پست', + 'blog_posturl_comment' => 'تنها بخش ثابت از آدرس بدون هیچ پارامترهای پویا و مشخص است.', + 'blog_page' => 'صفحه پست وبلاگ', + 'blog_page_comment' => 'صفحه مورد استفاده برای نمایش یک پست وبلاگ را انتخاب کنید.برای تشکیل آدرس برای پست مورد نیاز است.', + 'portfolio_itemurl' => 'آدرس صفحه جزئیات نمونه کارها', + 'portfolio_itemurl_comment' => 'تنها بخش ثابت از آدرس بدون هیچ پارامترهای پویا و مشخص است.', + 'brands_itemurl' => 'آدرس صفحه جزئیات نمونه کارها', + 'brands_itemurl_comment' => 'تنها بخش ثابت از آدرس بدون هیچ پارامترهای پویا و مشخص است.', + 'showcase_itemurl' => 'آدرس صفحه جزئیات ویترین', + 'showcase_itemurl_comment' => 'تنها بخش ثابت از آدرس بدون هیچ پارامترهای پویا و مشخص است.', + 'octoshop_itemurl' => 'آدرس صفحه جزئیات محصول', + 'octoshop_itemurl_comment' => 'تنها بخش ثابت از آدرس بدون هیچ پارامترهای پویا و مشخص است.', + 'octoshop_itemurl_badge' => 'محصول', + 'snipcartshop_itemurl_badge' => 'محصول', + 'jkshop_itemurl' => 'آدرس محصول', + 'jkshop_itemurl_comment' => 'Gib nur den statischen Teil der URL ein, keine dynamischen Parameter', + 'jkshop_itemurl_badge' => 'محصولات', + 'experimental' => 'ویژگی های تجربی:', + 'experimental_refer_to_docs' => 'این ارائه دهنده تجربی است. لطفا به اسنادو مدارکقبل از استفاده از آن است.', + ], + 'searchResults' => [ + 'title' => 'نتایج جستجو', + 'description' => 'نمایش یک لیست از نتایج جستجو', + 'properties' => [ + 'no_results' => [ + 'title' => 'هیچ موردی یافت نشد.', + 'description' => 'متنی که مایلید در صورت نداشتن نتیجه نمایش داده شود', + ], + 'provider_badge' => [ + 'title' => 'نمایش ارائه دهنده', + 'description' => 'نمایش نام ارائه دهنده جستجو برای هر نتیجه', + ], + 'results_per_page' => [ + 'title' => 'نتایج در هر صفحه', + ], + 'visit_page' => [ + 'title' => 'برچسب صفحه مشاهده', + 'description' => 'این متن لینک قرار داده شده است زیر هر نتیجه', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'شامل جستجو در سایت', + 'description' => 'به صفحات محتوایی اضافه کنید تا در نتیجه جستجوها نمایش داده شوند', + ], +]; diff --git a/plugins/offline/sitesearch/lang/pt-br/lang.php b/plugins/offline/sitesearch/lang/pt-br/lang.php new file mode 100644 index 0000000..6f7075f --- /dev/null +++ b/plugins/offline/sitesearch/lang/pt-br/lang.php @@ -0,0 +1,66 @@ + [ + 'name' => 'SiteSearch', + 'description' => 'Pesquisa global para o seu frontend', + 'author' => 'OFFLINE LLC', + 'manage_settings' => 'Gerenciar configurações do SiteSearch', + 'manage_settings_permission' => 'Pode gerenciar as configurações do SiteSearch', + ], + 'settings' => [ + 'mark_results' => 'Marcar correspondências nos resultados de pesquisa', + 'mark_results_comment' => 'Envolver o termo de pesquisa em tags ', + 'excerpt_length' => 'Comprimento do trecho', + 'excerpt_length_comment' => 'Comprimento do trecho mostrado na lista de resultados da pesquisa.', + 'use_this_provider' => 'Utilize este provedor', + 'use_this_provider_comment' => 'Ativar para exibir resultados para esse provedor', + 'provider_badge' => 'Distintivo do provedor', + 'provider_badge_comment' => 'Texto a ser exibido em um distitivo no resultado de pesquisa', + 'blog_posturl' => 'URL da página de postagem do blog', + 'blog_posturl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'blog_page' => 'Página de postagem do blog', + 'blog_page_comment' => 'Selecione uma página usada para exibir uma única postagem no blog. Necessário para formar URL para postagens.', + 'news_page' => 'Página de publicação de notícias', + 'news_page_comment' => 'Selecione uma página usada para exibir uma única postagem de notícias. Necessário para formar URL para a notícia.', + 'portfolio_itemurl' => 'URL da página de detalhes do portfólio', + 'portfolio_itemurl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'brands_itemurl' => 'URL da página de detalhes da marca', + 'brands_itemurl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'showcase_itemurl' => 'URL da página de detalhes do showcase', + 'showcase_itemurl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'octoshop_itemurl' => 'URL da página de detalhes do produto', + 'octoshop_itemurl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'octoshop_itemurl_badge' => 'Produto', + 'snipcartshop_itemurl_badge' => 'Produto', + 'jkshop_itemurl' => 'URL da página de detalhes do produto', + 'jkshop_itemurl_comment' => 'Apenas especifique a parte fixa do URL sem parâmetros dinâmicos', + 'jkshop_itemurl_badge' => 'Produto', + 'experimental' => 'Recurso experimental:', + 'experimental_refer_to_docs' => 'Este provedor é experimental! Por favor, consulte the documentation antes de usá-lo.', + ], + 'searchResults' => [ + 'title' => 'Resultados da pesquisa', + 'description' => 'Exibe uma lista de resultados de pesquisa', + 'properties' => [ + 'no_results' => [ + 'title' => 'Nenhuma mensagem de resultados', + 'description' => 'O que exibir, se não houver resultados retornados', + ], + 'provider_badge' => [ + 'title' => 'Mostrar o distintivo do provedor', + 'description' => 'Exibir o nome do provedor de pesquisa para cada resultado', + ], + 'results_per_page' => [ + 'title' => 'Resultados por página', + ], + 'visit_page' => [ + 'title' => 'Etiqueta da página de Visita', + 'description' => 'Este texto do link é colocado abaixo de cada resultado', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'Incluir no SiteSearch', + 'description' => 'Adicionar a uma página do CMS para incluí-la nos resultados da pesquisa', + ], +]; diff --git a/plugins/offline/sitesearch/lang/ru/lang.php b/plugins/offline/sitesearch/lang/ru/lang.php new file mode 100644 index 0000000..95ea68c --- /dev/null +++ b/plugins/offline/sitesearch/lang/ru/lang.php @@ -0,0 +1,59 @@ + [ + 'name' => 'SiteSearch', + 'description' => 'Глобальный поиск для вашего frontend-а', + 'author' => 'OFFLINE LLC', + 'manage_settings' => 'Управление настройками SiteSearch', + 'manage_settings_permission' => 'Разрешить управлять настройками SiteSearch', + ], + 'settings' => [ + 'mark_results' => 'Пометить совпадения в результатах поиска', + 'mark_results_comment' => 'Обернуть искомый текст в тэги ', + 'excerpt_length' => 'Длина выборки текста', + 'excerpt_length_comment' => 'Длина выборки текста, показываемого в результатах поиска.', + 'use_this_provider' => 'Использовать этот провайдер', + 'use_this_provider_comment' => 'Включить отображение результатов для этого провайдера', + 'provider_badge' => 'Badge провайдера', + 'provider_badge_comment' => 'Текст, отображаемый в Bage результата поиска', + 'blog_posturl' => 'Url поста из блога', + 'blog_posturl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'blog_page' => 'Страница поста из блога', + 'blog_page_comment' => 'Укажите страницу, используемую для вывода поста из блога. Это нужно для правильной генерации URL поста.', + 'portfolio_itemurl' => 'Url of portfolio detail page', + 'portfolio_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'brands_itemurl' => 'Url of brand detail page', + 'brands_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'octoshop_itemurl' => 'Url of product detail page', + 'octoshop_itemurl_comment' => 'Only specify the fixed part of the URL without any dynamic parameters', + 'octoshop_itemurl_badge' => 'Product', + 'snipcartshop_itemurl_badge' => 'Product', + 'experimental' => 'Эксперементальная фитча":', + 'experimental_refer_to_docs' => 'Этот провайдер является эксперементальным! Пожалуйста, обратитесь к документации перед использованием его.', + ], + 'searchResults' => [ + 'title' => 'Результаты поиска', + 'description' => 'Отображает список результатов поиска', + 'properties' => [ + 'no_results' => [ + 'title' => 'Сообщение отсутсвия искомой информации', + 'description' => 'Что показывать, когда ничего не найдено', + ], + 'provider_badge' => [ + 'title' => 'Показывать bage провайдера', + 'description' => 'Отображает имя поискового провайдера для каждого результата', + ], + 'results_per_page' => [ + 'title' => 'Результатов на страницу', + ], + 'visit_page' => [ + 'title' => 'Метка Посетить страницу', + 'description' => 'Эта текстовая ссылка помещается под каждым результатом поиска', + ], + ], + ], + 'siteSearchInclude' => [ + 'title' => 'Включить в SiteSearch', + 'description' => 'Добавьте это на страницу CMS, чтобы включить в результаты поиска', + ], +]; diff --git a/plugins/offline/sitesearch/models/Settings.php b/plugins/offline/sitesearch/models/Settings.php new file mode 100644 index 0000000..34671a1 --- /dev/null +++ b/plugins/offline/sitesearch/models/Settings.php @@ -0,0 +1,28 @@ +lists('baseFileName', 'baseFileName'); + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/models/settings/_cmspages_info.htm b/plugins/offline/sitesearch/models/settings/_cmspages_info.htm new file mode 100644 index 0000000..0a3e5d3 --- /dev/null +++ b/plugins/offline/sitesearch/models/settings/_cmspages_info.htm @@ -0,0 +1,12 @@ +

Important information

+

You have to specifically add the component `siteSearchInclude` to every CMS page you want to be searched.

+

Pages without this component will not be searched.

+ +

Components on CMS pages will not be rendered. Use this provider only for simple html pages. All Twig syntax will be stripped out to prevent the leaking of source code to the search results.

+ +

CMS pages with dynamic URLs (like /page/:slug) won't be linked correctly from the search results listing + .

+ +

If you have CMS pages with dynamic contents consider writing your own search provider (see +Add support for custom plugin contents) in the documentation.

\ No newline at end of file diff --git a/plugins/offline/sitesearch/models/settings/_experimental.htm b/plugins/offline/sitesearch/models/settings/_experimental.htm new file mode 100644 index 0000000..54e5fff --- /dev/null +++ b/plugins/offline/sitesearch/models/settings/_experimental.htm @@ -0,0 +1,8 @@ +
+
+

+ + +

+
+
\ No newline at end of file diff --git a/plugins/offline/sitesearch/models/settings/fields.yaml b/plugins/offline/sitesearch/models/settings/fields.yaml new file mode 100644 index 0000000..6be38b5 --- /dev/null +++ b/plugins/offline/sitesearch/models/settings/fields.yaml @@ -0,0 +1,251 @@ +fields: + mark_results: + span: left + type: switch + label: offline.sitesearch::lang.settings.mark_results + comment: offline.sitesearch::lang.settings.mark_results_comment + default: true + excerpt_length: + span: right + type: text + label: offline.sitesearch::lang.settings.excerpt_length + comment: offline.sitesearch::lang.settings.excerpt_length_comment + default: 250 + +tabs: + fields: + rainlab_blog_enabled: + type: switch + tab: RainLab.Blog + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + rainlab_blog_label: + type: text + tab: RainLab.Blog + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Blog + + rainlab_blog_page: + type: dropdown + options: blogPageOptions + tab: RainLab.Blog + label: offline.sitesearch::lang.settings.blog_page + comment: offline.sitesearch::lang.settings.blog_page_comment + span: auto + + rainlab_pages_enabled: + type: switch + tab: RainLab.Pages + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + rainlab_pages_label: + type: text + tab: RainLab.Pages + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Page + + indikator_news_enabled: + type: switch + tab: Indikator.News + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + indikator_news_label: + type: text + tab: Indikator.News + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: News + + indikator_news_posturl: + type: text + tab: Indikator.News + label: offline.sitesearch::lang.settings.news_page + comment: offline.sitesearch::lang.settings.news_page_comment + default: /news + span: auto + + octoshop_products_enabled: + type: switch + tab: Feegleweb.Octoshop + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + octoshop_products_label: + type: text + tab: Feegleweb.Octoshop + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + + octoshop_products_itemurl: + type: text + tab: Feegleweb.Octoshop + label: offline.sitesearch::lang.settings.octoshop_itemurl + comment: offline.sitesearch::lang.settings.octoshop_itemurl_comment + span: auto + default: /product + + snipcartshop_products_enabled: + type: switch + tab: OFFLINE.SnipcartShop + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + snipcartshop_products_label: + type: text + tab: OFFLINE.SnipcartShop + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + + jiri_jkshop_enabled: + type: switch + tab: Jiri.JKShop + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + jiri_jkshop_label: + type: text + tab: Jiri.JKShop + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + + jiri_jkshop_itemurl: + type: text + tab: Jiri.JKShop + label: offline.sitesearch::lang.settings.jkshop_itemurl + comment: offline.sitesearch::lang.settings.jkshop_itemurl_comment + span: auto + default: /product + + radiantweb_problog_enabled: + type: switch + tab: RadiantWeb.ProBlog + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + radiantweb_problog_label: + type: text + tab: RadiantWeb.ProBlog + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Blog + + radiantweb_problog_posturl: + type: text + tab: RadiantWeb.ProBlog + label: offline.sitesearch::lang.settings.blog_posturl + comment: offline.sitesearch::lang.settings.blog_posturl_comment + span: auto + default: /blog + + arrizalamin_portfolio_enabled: + type: switch + tab: ArrizalAmin.Portfolio + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + arrizalamin_portfolio_label: + type: text + tab: ArrizalAmin.Portfolio + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Portfolio + + arrizalamin_portfolio_url: + type: text + tab: ArrizalAmin.Portfolio + label: offline.sitesearch::lang.settings.portfolio_itemurl + comment: offline.sitesearch::lang.settings.portfolio_itemurl_comment + span: auto + default: /portfolio/project + + vojtasvoboda_brands_enabled: + type: switch + tab: VojtaSvoboda.Brands + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + vojtasvoboda_brands_label: + type: text + tab: VojtaSvoboda.Brands + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Brands + + vojtasvoboda_brands_url: + type: text + tab: VojtaSvoboda.Brands + label: offline.sitesearch::lang.settings.brands_itemurl + comment: offline.sitesearch::lang.settings.brands_itemurl_comment + span: auto + default: /brand + + responsiv_showcase_enabled: + type: switch + tab: Responsiv.Showcase + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: true + + responsiv_showcase_label: + type: text + tab: Responsiv.Showcase + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Showcase + + responsiv_showcase_url: + type: text + tab: Responsiv.Showcase + label: offline.sitesearch::lang.settings.showcase_itemurl + comment: offline.sitesearch::lang.settings.showcase_itemurl_comment + span: auto + default: /showcase/project + + cms_pages_warning: + type: partial + path: $/offline/sitesearch/models/settings/_experimental.htm + tab: CMS pages + + cms_pages_hint: + type: hint + path: $/offline/sitesearch/models/settings/_cmspages_info.htm + tab: CMS pages + + cms_pages_enabled: + type: switch + tab: CMS pages + label: offline.sitesearch::lang.settings.use_this_provider + comment: offline.sitesearch::lang.settings.use_this_provider_comment + default: false + + cms_pages_label: + type: text + tab: CMS pages + label: offline.sitesearch::lang.settings.provider_badge + comment: offline.sitesearch::lang.settings.provider_badge_comment + span: auto + default: Page diff --git a/plugins/offline/sitesearch/updates/version.yaml b/plugins/offline/sitesearch/updates/version.yaml new file mode 100644 index 0000000..90035cb --- /dev/null +++ b/plugins/offline/sitesearch/updates/version.yaml @@ -0,0 +1,77 @@ +1.0.1: 'First version of SiteSearch' +1.0.2: 'Added experimental CMS pages results provider' +1.0.3: 'Added missing component' +1.0.4: + - 'Added support for RadiantWeb.ProBlog' +1.0.5: + - 'Moved configuration to the backend' +1.0.6: + - 'Fixed hardcoded url in pagination' +1.0.7: + - 'Add function for getting last page number (Thanks to vojtasvoboda)' +1.0.8: + - 'Add cs_CZ locale (Thanks to vojtasvoboda)' +1.0.9: + - 'Added support for ArrizalAmin.Portfolio plugin' +1.0.10: + - 'Removed unused component' +1.1.0: + - Added support for translated contents in RainLab.Pages, ArrizalAmin.Portfolio and RadiantWeb.ProBlog + - Fixed bug where RainLab.Pages results were displayed twice + - Honor disabled plugins setting + - Generate absolute URLs in search results by default +1.1.1: + - Added optimized siteSearchInclude component for cms pages search +1.1.2: + - Fixed backend permissions +1.1.3: + - Added ru_RU locale (Thanks to mokeev1995) +1.2.1: + - 'Added support for Feegleweb.Octoshop (Thanks to billyzduke)' + - Refactored search providers and results page +1.2.2: + - 'Minor bugfix in Feegleweb.Octoshop settings page translation' +1.2.3: + - 'Fixed bug where the search results sometimes broke the page layout' +1.2.4: + - 'Fixed bug where unavailable thumbnails lead to an error' +1.2.5: + - 'Fixed bug where the provider badge is not displayed for custom search providers' +1.2.6: + - 'Added support for Responsiv.Showcase (Thanks to MichiReich)' +1.2.7: + - 'Fixed bug where custom url settings were ignored in search results for some providers' +1.2.8: + - 'Added support for viewBag properties in RainLab.Pages' +1.2.9: + - 'Added support for static page component hosts' +1.2.10: + - 'Added support for multiple variables in Rainlab.Blog urls (Thanks to graker)' +1.2.11: + - 'Optimized handling of multibyte strings' +1.2.12: + - 'Added support for Jiri.Jkshop' +1.2.13: + - 'Minor bugfixes for marked queries in search results and Rainlab.Blog provider (Thanks to graker)' +1.2.14: + - 'Fixed bug in Jiri.JKShop provider' +1.2.15: + - 'Added a new meta property for search results (thanks to cracki)' +1.2.16: + - 'Added Persian (Farsi) translations (thanks to cracki)' +1.2.17: + - 'Added support for Indikator.News (thanks to gergo85)' +1.2.18: + - 'Fixed bug where titles of static pages where not searched (thanks to beenen445)' +1.2.19: + - 'Added support for OFFLINE.SnipcartShop' +1.2.20: + - 'Added support for VojtaSvoboda.Brands (thanks to vojtasvoboda)' +1.2.21: + - 'Added Portuguese translations (thanks to ribsousa)' +1.2.22: + - 'Fixed Portuguese translations' +1.2.23: + - 'Fixed support for translated Rainlab.Blog contents' +1.2.24: + - 'Added composer.json to allow loading plugin as dependency (thanks to adduc)' diff --git a/plugins/offline/sitesearch/vendor/autoload.php b/plugins/offline/sitesearch/vendor/autoload.php new file mode 100644 index 0000000..012b801 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + + private $classMapAuthoritative = false; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative) { + return false; + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if ($file === null && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if ($file === null) { + // Remember that this class does not exist. + return $this->classMap[$class] = false; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/plugins/offline/sitesearch/vendor/composer/LICENSE b/plugins/offline/sitesearch/vendor/composer/LICENSE new file mode 100644 index 0000000..1a28124 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) 2016 Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/plugins/offline/sitesearch/vendor/composer/autoload_classmap.php b/plugins/offline/sitesearch/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($vendorDir . '/composer/installers/src/Composer/Installers'), +); diff --git a/plugins/offline/sitesearch/vendor/composer/autoload_real.php b/plugins/offline/sitesearch/vendor/composer/autoload_real.php new file mode 100644 index 0000000..345d769 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/autoload_real.php @@ -0,0 +1,45 @@ + $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(true); + + return $loader; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installed.json b/plugins/offline/sitesearch/vendor/composer/installed.json new file mode 100644 index 0000000..99df1e7 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installed.json @@ -0,0 +1,111 @@ +[ + { + "name": "composer/installers", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "d78064c68299743e0161004f2de3a0204e33b804" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804", + "reference": "d78064c68299743e0161004f2de3a0204e33b804", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "time": "2016-08-13 20:53:52", + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "https://composer.github.io/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Hurad", + "ImageCMS", + "MODX Evo", + "Mautic", + "OXID", + "Plentymarkets", + "RadPHP", + "SMF", + "Thelia", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "attogram", + "bitrix", + "cakephp", + "chef", + "cockpit", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "elgg", + "expressionengine", + "fuelphp", + "grav", + "installer", + "joomla", + "kohana", + "laravel", + "lithium", + "magento", + "mako", + "mediawiki", + "modulework", + "moodle", + "phpbb", + "piwik", + "ppi", + "puppet", + "reindex", + "roundcube", + "shopware", + "silverstripe", + "symfony", + "typo3", + "wordpress", + "yawik", + "zend", + "zikula" + ] + } +] diff --git a/plugins/offline/sitesearch/vendor/composer/installers/LICENSE b/plugins/offline/sitesearch/vendor/composer/installers/LICENSE new file mode 100644 index 0000000..85f97fc --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Kyle Robinson Young + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/README.md b/plugins/offline/sitesearch/vendor/composer/installers/README.md new file mode 100644 index 0000000..ed38d22 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/README.md @@ -0,0 +1,220 @@ +# A Multi-Framework [Composer](http://getcomposer.org) Library Installer + +[![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers) + +This is for PHP package authors to require in their `composer.json`. It will +install their package to the correct location based on the specified package +type. + +The goal of `installers` is to be a simple package type to install path map. +Users can also customize the install path per package and package authors can +modify the package name upon installing. + +`installers` isn't intended on replacing all custom installers. If your +package requires special installation handling then by all means, create a +custom installer to handle it. + +**Natively Supported Frameworks**: + +The following frameworks natively work with Composer and will be +installed to the default `vendor` directory. `composer/installers` +is not needed to install packages with these frameworks: + +* Aura +* Symfony2 +* Yii +* Yii2 + +**Current Supported Package Types**: + +> Stable types are marked as **bold**, this means that installation paths +> for those type will not be changed. Any adjustment for those types would +> require creation of brand new type that will cover required changes. + +| Framework | Types +| --------- | ----- +| Aimeos | `aimeos-extension` +| Asgard | `asgard-module`
`asgard-theme` +| Attogram | `attogram-module` +| AGL | `agl-module` +| Bonefish | `bonefish-package` +| AnnotateCms | `annotatecms-module`
`annotatecms-component`
`annotatecms-service` +| Bitrix | `bitrix-module` (deprecated)
`bitrix-component` (deprecated)
`bitrix-theme` (deprecated)

`bitrix-d7-module`
`bitrix-d7-component`
`bitrix-d7-template` +| CakePHP 2+ | **`cakephp-plugin`** +| Chef | `chef-cookbook`
`chef-role` +| CCFramework | `ccframework-ship`
`ccframework-theme` +| Cockpit | `cockpit-module` +| CodeIgniter | `codeigniter-library`
`codeigniter-third-party`
`codeigniter-module` +| concrete5 | `concrete5-block`
`concrete5-package`
`concrete5-theme`
`concrete5-update` +| Craft | `craft-plugin` +| Croogo | `croogo-plugin`
`croogo-theme` +| Decibel | `decibel-app` +| DokuWiki | `dokuwiki-plugin`
`dokuwiki-template` +| Dolibarr | `dolibarr-module` +| Drupal | `drupal-core`
`drupal-module`
`drupal-theme`

`drupal-library`
`drupal-profile`
`drupal-drush` +| Elgg | `elgg-plugin` +| ExpressionEngine 3 | `ee3-addon`
`ee3-theme` +| FuelPHP v1.x | `fuel-module`
`fuel-package`
`fuel-theme` +| FuelPHP v2.x | `fuelphp-component` +| Grav | `grav-plugin`
`grav-theme` +| Hurad | `hurad-plugin`
`hurad-theme` +| ImageCMS | `imagecms-template`
`imagecms-module`
`imagecms-library` +| Joomla | `joomla-component`
`joomla-module`
`joomla-template`
`joomla-plugin`
`joomla-library` +| Kirby | **`kirby-plugin`**
`kirby-field`
`kirby-tag` +| KodiCMS | `kodicms-plugin`
`kodicms-media` +| Kohana | **`kohana-module`** +| Laravel | `laravel-library` +| Lithium | **`lithium-library`
`lithium-source`** +| Magento | `magento-library`
`magento-skin`
`magento-theme` +| Mako | `mako-package` +| Mautic | `mautic-plugin`
`mautic-theme` +| MODX Evo | `modxevo-snippet`
`modxevo-plugin`
`modxevo-module`
`modxevo-template`
`modxevo-lib` +| MediaWiki | `mediawiki-extension` +| October | **`october-module`
`october-plugin`
`october-theme`** +| OXID | `oxid-module`
`oxid-theme`
`oxid-out` +| MODULEWork | `modulework-module` +| Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types) +| Piwik | `piwik-plugin` +| phpBB | `phpbb-extension`
`phpbb-style`
`phpbb-language` +| Pimcore | `pimcore-plugin` +| Plentymarkets | `plentymarkets-plugin` +| PPI | **`ppi-module`** +| Puppet | `puppet-module` +| RadPHP | `radphp-bundle` +| REDAXO | `redaxo-addon` +| ReIndex | **`reindex-plugin`**
**`reindex-theme`** +| Roundcube | `roundcube-plugin` +| shopware | `shopware-backend-plugin`
`shopware-core-plugin`
`shopware-frontend-plugin`
`shopware-theme`
`shopware-plugin`
`shopware-frontend-theme` +| SilverStripe | `silverstripe-module`
`silverstripe-theme` +| SMF | `smf-module`
`smf-theme` +| symfony1 | **`symfony1-plugin`** +| Tusk | `tusk-task`
`tusk-command`
`tusk-asset` +| TYPO3 Flow | `typo3-flow-package`
`typo3-flow-framework`
`typo3-flow-plugin`
`typo3-flow-site`
`typo3-flow-boilerplate`
`typo3-flow-build` +| TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead) +| Vanilla | `vanilla-plugin`
`vanilla-theme` +| Wolf CMS | `wolfcms-plugin` +| WordPress | `wordpress-plugin`
`wordpress-theme`

`wordpress-muplugin` +| YAWIK | `yawik-module` +| Zend | `zend-library`
`zend-extra`
`zend-module` +| Zikula | `zikula-module`
`zikula-theme` +| Prestashop | `prestashop-module`
`prestashop-theme` +| Phifty | `phifty-bundle`
`phifty-framework`
`phifty-library` + +## Example `composer.json` File + +This is an example for a CakePHP plugin. The only important parts to set in your +composer.json file are `"type": "cakephp-plugin"` which describes what your +package is and `"require": { "composer/installers": "~1.0" }` which tells composer +to load the custom installers. + +```json +{ + "name": "you/ftp", + "type": "cakephp-plugin", + "require": { + "composer/installers": "~1.0" + } +} +``` + +This would install your package to the `Plugin/Ftp/` folder of a CakePHP app +when a user runs `php composer.phar install`. + +So submit your packages to [packagist.org](http://packagist.org)! + +## Custom Install Paths + +If you are consuming a package that uses the `composer/installers` you can +override the install path with the following extra in your `composer.json`: + +```json +{ + "extra": { + "installer-paths": { + "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"] + } + } +} +``` + +A package type can have a custom installation path with a `type:` prefix. + +``` json +{ + "extra": { + "installer-paths": { + "your/custom/path/{$name}/": ["type:wordpress-plugin"] + } + } +} +``` + +You can also have the same vendor packages with a custom installation path by +using the `vendor:` prefix. + +``` json +{ + "extra": { + "installer-paths": { + "your/custom/path/{$name}/": ["vendor:my_organization"] + } + } +} +``` + +These would use your custom path for each of the listed packages. The available +variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`. + +## Custom Install Names + +If you're a package author and need your package to be named differently when +installed consider using the `installer-name` extra. + +For example you have a package named `shama/cakephp-ftp` with the type +`cakephp-plugin`. Installing with `composer/installers` would install to the +path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a +package author actually need the package to be named and installed to +`Plugin/Ftp`. Using the following config within your **package** `composer.json` +will allow this: + +```json +{ + "name": "shama/cakephp-ftp", + "type": "cakephp-plugin", + "extra": { + "installer-name": "Ftp" + } +} +``` + +Please note the name entered into `installer-name` will be the final and will +not be inflected. + +## Contribute! + +* [Fork and clone](https://help.github.com/articles/fork-a-repo). +* Run the command `php composer.phar install` to install the dependencies. + This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install). +* Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de). +* Create a branch, commit, push and send us a + [pull request](https://help.github.com/articles/using-pull-requests). + +To ensure a consistent code base, you should make sure the code follows the +[Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html) +which we borrowed from Symfony. + +If you would like to help, please take a look at the list of +[issues](https://github.com/composer/installers/issues). + +### Should we allow dynamic package types or paths? No. +What are they? The ability for a package author to determine where a package +will be installed either through setting the path directly in their +`composer.json` or through a dynamic package type: `"type": +"framework-install-here"`. + +It has been proposed many times. Even implemented once early on and then +removed. `installers` won't do this because it would allow a single package +author to wipe out entire folders without the user's consent. That user would +then come here to yell at us. + +Anyone still wanting this capability should consider requiring https://github.com/oomphinc/composer-installers-extender. diff --git a/plugins/offline/sitesearch/vendor/composer/installers/composer.json b/plugins/offline/sitesearch/vendor/composer/installers/composer.json new file mode 100644 index 0000000..3b12fa5 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/composer.json @@ -0,0 +1,92 @@ +{ + "name": "composer/installers", + "type": "composer-plugin", + "license": "MIT", + "description": "A multi-framework Composer library installer", + "keywords": [ + "installer", + "Aimeos", + "AGL", + "AnnotateCms", + "Attogram", + "Bitrix", + "CakePHP", + "Chef", + "Cockpit", + "CodeIgniter", + "concrete5", + "Craft", + "Croogo", + "DokuWiki", + "Dolibarr", + "Drupal", + "Elgg", + "ExpressionEngine", + "FuelPHP", + "Grav", + "Hurad", + "ImageCMS", + "Joomla", + "Kohana", + "Laravel", + "Lithium", + "Magento", + "Mako", + "Mautic", + "MODX Evo", + "MediaWiki", + "OXID", + "MODULEWork", + "Moodle", + "Piwik", + "phpBB", + "Plentymarkets", + "PPI", + "Puppet", + "RadPHP", + "ReIndex", + "Roundcube", + "shopware", + "SilverStripe", + "SMF", + "symfony", + "Thelia", + "TYPO3", + "WolfCMS", + "WordPress", + "YAWIK", + "Zend", + "Zikula" + ], + "homepage": "https://composer.github.io/installers/", + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "autoload": { + "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" } + }, + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "replace": { + "shama/baton": "*", + "roundcube/plugin-installer": "*" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "scripts": { + "test": "phpunit" + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/phpunit.xml.dist b/plugins/offline/sitesearch/vendor/composer/installers/phpunit.xml.dist new file mode 100644 index 0000000..cc5cc99 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + tests/Composer/Installers + + + + + + src/Composer/Installers + + + \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AglInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AglInstaller.php new file mode 100644 index 0000000..01b8a41 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AglInstaller.php @@ -0,0 +1,21 @@ + 'More/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) { + return strtoupper($matches[1]); + }, $vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php new file mode 100644 index 0000000..79a0e95 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php @@ -0,0 +1,9 @@ + 'ext/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php new file mode 100644 index 0000000..89d7ad9 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php @@ -0,0 +1,11 @@ + 'addons/modules/{$name}/', + 'component' => 'addons/components/{$name}/', + 'service' => 'addons/services/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php new file mode 100644 index 0000000..22dad1b --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php @@ -0,0 +1,49 @@ + 'Modules/{$name}/', + 'theme' => 'Themes/{$name}/' + ); + + /** + * Format package name. + * + * For package type asgard-module, cut off a trailing '-plugin' if present. + * + * For package type asgard-theme, cut off a trailing '-theme' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'asgard-module') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'asgard-theme') { + return $this->inflectThemeVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-module$/', '', $vars['name']); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } + + protected function inflectThemeVars($vars) + { + $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php new file mode 100644 index 0000000..d62fd8f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php new file mode 100644 index 0000000..7082bf2 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php @@ -0,0 +1,136 @@ +composer = $composer; + $this->package = $package; + $this->io = $io; + } + + /** + * Return the install path based on package type. + * + * @param PackageInterface $package + * @param string $frameworkType + * @return string + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + $type = $this->package->getType(); + + $prettyName = $this->package->getPrettyName(); + if (strpos($prettyName, '/') !== false) { + list($vendor, $name) = explode('/', $prettyName); + } else { + $vendor = ''; + $name = $prettyName; + } + + $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type')); + + $extra = $package->getExtra(); + if (!empty($extra['installer-name'])) { + $availableVars['name'] = $extra['installer-name']; + } + + if ($this->composer->getPackage()) { + $extra = $this->composer->getPackage()->getExtra(); + if (!empty($extra['installer-paths'])) { + $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor); + if ($customPath !== false) { + return $this->templatePath($customPath, $availableVars); + } + } + } + + $packageType = substr($type, strlen($frameworkType) + 1); + $locations = $this->getLocations(); + if (!isset($locations[$packageType])) { + throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type)); + } + + return $this->templatePath($locations[$packageType], $availableVars); + } + + /** + * For an installer to override to modify the vars per installer. + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + return $vars; + } + + /** + * Gets the installer's locations + * + * @return array + */ + public function getLocations() + { + return $this->locations; + } + + /** + * Replace vars in a path + * + * @param string $path + * @param array $vars + * @return string + */ + protected function templatePath($path, array $vars = array()) + { + if (strpos($path, '{') !== false) { + extract($vars); + preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches); + if (!empty($matches[1])) { + foreach ($matches[1] as $var) { + $path = str_replace('{$' . $var . '}', $$var, $path); + } + } + } + + return $path; + } + + /** + * Search through a passed paths array for a custom install path. + * + * @param array $paths + * @param string $name + * @param string $type + * @param string $vendor = NULL + * @return string + */ + protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL) + { + foreach ($paths as $path => $names) { + if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) { + return $path; + } + } + + return false; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php new file mode 100644 index 0000000..e80cd1e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php @@ -0,0 +1,126 @@ +.`. + * - `bitrix-d7-component` — copy the component to directory `bitrix/components//`. + * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/_`. + * + * You can set custom path to directory with Bitrix kernel in `composer.json`: + * + * ```json + * { + * "extra": { + * "bitrix-dir": "s1/bitrix" + * } + * } + * ``` + * + * @author Nik Samokhvalov + * @author Denis Kulichkin + */ +class BitrixInstaller extends BaseInstaller +{ + protected $locations = array( + 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) + 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) + 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) + 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/', + 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/', + 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/', + ); + + /** + * @var array Storage for informations about duplicates at all the time of installation packages. + */ + private static $checkedDuplicates = array(); + + /** + * {@inheritdoc} + */ + public function inflectPackageVars($vars) + { + if ($this->composer->getPackage()) { + $extra = $this->composer->getPackage()->getExtra(); + + if (isset($extra['bitrix-dir'])) { + $vars['bitrix_dir'] = $extra['bitrix-dir']; + } + } + + if (!isset($vars['bitrix_dir'])) { + $vars['bitrix_dir'] = 'bitrix'; + } + + return parent::inflectPackageVars($vars); + } + + /** + * {@inheritdoc} + */ + protected function templatePath($path, array $vars = array()) + { + $templatePath = parent::templatePath($path, $vars); + $this->checkDuplicates($templatePath, $vars); + + return $templatePath; + } + + /** + * Duplicates search packages. + * + * @param string $path + * @param array $vars + */ + protected function checkDuplicates($path, array $vars = array()) + { + $packageType = substr($vars['type'], strlen('bitrix') + 1); + $localDir = explode('/', $vars['bitrix_dir']); + array_pop($localDir); + $localDir[] = 'local'; + $localDir = implode('/', $localDir); + + $oldPath = str_replace( + array('{$bitrix_dir}', '{$name}'), + array($localDir, $vars['name']), + $this->locations[$packageType] + ); + + if (in_array($oldPath, static::$checkedDuplicates)) { + return; + } + + if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) { + + $this->io->writeError(' Duplication of packages:'); + $this->io->writeError(' Package ' . $oldPath . ' will be called instead package ' . $path . ''); + + while (true) { + switch ($this->io->ask(' Delete ' . $oldPath . ' [y,n,?]? ', '?')) { + case 'y': + $fs = new Filesystem(); + $fs->removeDirectory($oldPath); + break 2; + + case 'n': + break 2; + + case '?': + default: + $this->io->writeError(array( + ' y - delete package ' . $oldPath . ' and to continue with the installation', + ' n - don\'t delete and to continue with the installation', + )); + $this->io->writeError(' ? - print help'); + break; + } + } + } + + static::$checkedDuplicates[] = $oldPath; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php new file mode 100644 index 0000000..da3aad2 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php @@ -0,0 +1,9 @@ + 'Packages/{$vendor}/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php new file mode 100644 index 0000000..176c91a --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php @@ -0,0 +1,84 @@ + 'Plugin/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + if ($this->matchesCakeVersion('>=', '3.0.0')) { + return $vars; + } + + $nameParts = explode('/', $vars['name']); + foreach ($nameParts as &$value) { + $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); + $value = str_replace(array('-', '_'), ' ', $value); + $value = str_replace(' ', '', ucwords($value)); + } + $vars['name'] = implode('/', $nameParts); + + return $vars; + } + + /** + * Change the default plugin location when cakephp >= 3.0 + */ + public function getLocations() + { + if ($this->matchesCakeVersion('>=', '3.0.0')) { + $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; + } + return $this->locations; + } + + /** + * Check if CakePHP version matches against a version + * + * @param string $matcher + * @param string $version + * @return bool + */ + protected function matchesCakeVersion($matcher, $version) + { + if (class_exists('Composer\Semver\Constraint\MultiConstraint')) { + $multiClass = 'Composer\Semver\Constraint\MultiConstraint'; + $constraintClass = 'Composer\Semver\Constraint\Constraint'; + } else { + $multiClass = 'Composer\Package\LinkConstraint\MultiConstraint'; + $constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint'; + } + + $repositoryManager = $this->composer->getRepositoryManager(); + if ($repositoryManager) { + $repos = $repositoryManager->getLocalRepository(); + if (!$repos) { + return false; + } + $cake3 = new $multiClass(array( + new $constraintClass($matcher, $version), + new $constraintClass('!=', '9999999-dev'), + )); + $pool = new Pool('dev'); + $pool->addRepository($repos); + $packages = $pool->whatProvides('cakephp/cakephp'); + foreach ($packages as $package) { + $installed = new $constraintClass('=', $package->getVersion()); + if ($cake3->matches($installed)) { + return true; + break; + } + } + } + return false; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php new file mode 100644 index 0000000..ab2f9aa --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php @@ -0,0 +1,11 @@ + 'Chef/{$vendor}/{$name}/', + 'role' => 'Chef/roles/{$name}/', + ); +} + diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php new file mode 100644 index 0000000..c887815 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php @@ -0,0 +1,10 @@ + 'CCF/orbit/{$name}/', + 'theme' => 'CCF/app/themes/{$name}/', + ); +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php new file mode 100644 index 0000000..c7816df --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php @@ -0,0 +1,34 @@ + 'cockpit/modules/addons/{$name}/', + ); + + /** + * Format module name. + * + * Strip `module-` prefix from package name. + * + * @param array @vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] == 'cockpit-module') { + return $this->inflectModuleVars($vars); + } + + return $vars; + } + + public function inflectModuleVars($vars) + { + $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php new file mode 100644 index 0000000..3b4a4ec --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php @@ -0,0 +1,11 @@ + 'application/libraries/{$name}/', + 'third-party' => 'application/third_party/{$name}/', + 'module' => 'application/modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php new file mode 100644 index 0000000..4d398a4 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php @@ -0,0 +1,12 @@ + 'blocks/{$name}/', + 'package' => 'packages/{$name}/', + 'theme' => 'themes/{$name}/', + 'update' => 'updates/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php new file mode 100644 index 0000000..d37a77a --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php @@ -0,0 +1,35 @@ + 'craft/plugins/{$name}/', + ); + + /** + * Strip `craft-` prefix and/or `-plugin` suffix from package names + * + * @param array $vars + * + * @return array + */ + final public function inflectPackageVars($vars) + { + return $this->inflectPluginVars($vars); + } + + private function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']); + $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php new file mode 100644 index 0000000..d94219d --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php @@ -0,0 +1,21 @@ + 'Plugin/{$name}/', + 'theme' => 'View/Themed/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name'])); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php new file mode 100644 index 0000000..f4837a6 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php @@ -0,0 +1,10 @@ + 'app/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php new file mode 100644 index 0000000..cfd638d --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php @@ -0,0 +1,50 @@ + 'lib/plugins/{$name}/', + 'template' => 'lib/tpl/{$name}/', + ); + + /** + * Format package name. + * + * For package type dokuwiki-plugin, cut off a trailing '-plugin', + * or leading dokuwiki_ if present. + * + * For package type dokuwiki-template, cut off a trailing '-template' if present. + * + */ + public function inflectPackageVars($vars) + { + + if ($vars['type'] === 'dokuwiki-plugin') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'dokuwiki-template') { + return $this->inflectTemplateVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']); + $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']); + + return $vars; + } + + protected function inflectTemplateVars($vars) + { + $vars['name'] = preg_replace('/-template$/', '', $vars['name']); + $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']); + + return $vars; + } + +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php new file mode 100644 index 0000000..21f7e8e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php @@ -0,0 +1,16 @@ + + */ +class DolibarrInstaller extends BaseInstaller +{ + //TODO: Add support for scripts and themes + protected $locations = array( + 'module' => 'htdocs/custom/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php new file mode 100644 index 0000000..a41ee2e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php @@ -0,0 +1,16 @@ + 'core/', + 'module' => 'modules/{$name}/', + 'theme' => 'themes/{$name}/', + 'library' => 'libraries/{$name}/', + 'profile' => 'profiles/{$name}/', + 'drush' => 'drush/{$name}/', + 'custom-theme' => 'themes/custom/{$name}/', + 'custom-module' => 'modules/custom/{$name}', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php new file mode 100644 index 0000000..c0bb609 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php @@ -0,0 +1,9 @@ + 'mod/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php new file mode 100644 index 0000000..d5321a8 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php @@ -0,0 +1,29 @@ + 'system/expressionengine/third_party/{$name}/', + 'theme' => 'themes/third_party/{$name}/', + ); + + private $ee3Locations = array( + 'addon' => 'system/user/addons/{$name}/', + 'theme' => 'themes/user/{$name}/', + ); + + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + + $version = "{$frameworkType}Locations"; + $this->locations = $this->$version; + + return parent::getInstallPath($package, $frameworkType); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php new file mode 100644 index 0000000..6eba2e3 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php @@ -0,0 +1,11 @@ + 'fuel/app/modules/{$name}/', + 'package' => 'fuel/packages/{$name}/', + 'theme' => 'fuel/app/themes/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php new file mode 100644 index 0000000..29d980b --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php @@ -0,0 +1,9 @@ + 'components/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/GravInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/GravInstaller.php new file mode 100644 index 0000000..dbe63e0 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/GravInstaller.php @@ -0,0 +1,30 @@ + 'user/plugins/{$name}/', + 'theme' => 'user/themes/{$name}/', + ); + + /** + * Format package name + * + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $restrictedWords = implode('|', array_keys($this->locations)); + + $vars['name'] = strtolower($vars['name']); + $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui', + '$1', + $vars['name'] + ); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php new file mode 100644 index 0000000..8fe017f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php @@ -0,0 +1,25 @@ + 'plugins/{$name}/', + 'theme' => 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $nameParts = explode('/', $vars['name']); + foreach ($nameParts as &$value) { + $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); + $value = str_replace(array('-', '_'), ' ', $value); + $value = str_replace(' ', '', ucwords($value)); + } + $vars['name'] = implode('/', $nameParts); + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php new file mode 100644 index 0000000..5e2142e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php @@ -0,0 +1,11 @@ + 'templates/{$name}/', + 'module' => 'application/modules/{$name}/', + 'library' => 'application/libraries/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Installer.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Installer.php new file mode 100644 index 0000000..5b6c553 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Installer.php @@ -0,0 +1,189 @@ + 'AimeosInstaller', + 'asgard' => 'AsgardInstaller', + 'attogram' => 'AttogramInstaller', + 'agl' => 'AglInstaller', + 'annotatecms' => 'AnnotateCmsInstaller', + 'bitrix' => 'BitrixInstaller', + 'bonefish' => 'BonefishInstaller', + 'cakephp' => 'CakePHPInstaller', + 'chef' => 'ChefInstaller', + 'ccframework' => 'ClanCatsFrameworkInstaller', + 'cockpit' => 'CockpitInstaller', + 'codeigniter' => 'CodeIgniterInstaller', + 'concrete5' => 'Concrete5Installer', + 'craft' => 'CraftInstaller', + 'croogo' => 'CroogoInstaller', + 'dokuwiki' => 'DokuWikiInstaller', + 'dolibarr' => 'DolibarrInstaller', + 'decibel' => 'DecibelInstaller', + 'drupal' => 'DrupalInstaller', + 'elgg' => 'ElggInstaller', + 'ee3' => 'ExpressionEngineInstaller', + 'ee2' => 'ExpressionEngineInstaller', + 'fuel' => 'FuelInstaller', + 'fuelphp' => 'FuelphpInstaller', + 'grav' => 'GravInstaller', + 'hurad' => 'HuradInstaller', + 'imagecms' => 'ImageCMSInstaller', + 'joomla' => 'JoomlaInstaller', + 'kirby' => 'KirbyInstaller', + 'kodicms' => 'KodiCMSInstaller', + 'kohana' => 'KohanaInstaller', + 'laravel' => 'LaravelInstaller', + 'lithium' => 'LithiumInstaller', + 'magento' => 'MagentoInstaller', + 'mako' => 'MakoInstaller', + 'mautic' => 'MauticInstaller', + 'mediawiki' => 'MediaWikiInstaller', + 'microweber' => 'MicroweberInstaller', + 'modulework' => 'MODULEWorkInstaller', + 'modxevo' => 'MODXEvoInstaller', + 'moodle' => 'MoodleInstaller', + 'october' => 'OctoberInstaller', + 'oxid' => 'OxidInstaller', + 'phpbb' => 'PhpBBInstaller', + 'pimcore' => 'PimcoreInstaller', + 'piwik' => 'PiwikInstaller', + 'plentymarkets'=> 'PlentymarketsInstaller', + 'ppi' => 'PPIInstaller', + 'puppet' => 'PuppetInstaller', + 'radphp' => 'RadPHPInstaller', + 'phifty' => 'PhiftyInstaller', + 'redaxo' => 'RedaxoInstaller', + 'reindex' => 'ReIndexInstaller', + 'roundcube' => 'RoundcubeInstaller', + 'shopware' => 'ShopwareInstaller', + 'silverstripe' => 'SilverStripeInstaller', + 'smf' => 'SMFInstaller', + 'symfony1' => 'Symfony1Installer', + 'thelia' => 'TheliaInstaller', + 'tusk' => 'TuskInstaller', + 'typo3-cms' => 'TYPO3CmsInstaller', + 'typo3-flow' => 'TYPO3FlowInstaller', + 'vanilla' => 'VanillaInstaller', + 'whmcs' => 'WHMCSInstaller', + 'wolfcms' => 'WolfCMSInstaller', + 'wordpress' => 'WordPressInstaller', + 'yawik' => 'YawikInstaller', + 'zend' => 'ZendInstaller', + 'zikula' => 'ZikulaInstaller', + 'prestashop' => 'PrestashopInstaller' + ); + + /** + * {@inheritDoc} + */ + public function getInstallPath(PackageInterface $package) + { + $type = $package->getType(); + $frameworkType = $this->findFrameworkType($type); + + if ($frameworkType === false) { + throw new \InvalidArgumentException( + 'Sorry the package type of this package is not yet supported.' + ); + } + + $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType]; + $installer = new $class($package, $this->composer, $this->getIO()); + + return $installer->getInstallPath($package, $frameworkType); + } + + public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) + { + if (!$repo->hasPackage($package)) { + throw new \InvalidArgumentException('Package is not installed: '.$package); + } + + $repo->removePackage($package); + + $installPath = $this->getInstallPath($package); + $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? 'deleted' : 'not deleted')); + } + + /** + * {@inheritDoc} + */ + public function supports($packageType) + { + $frameworkType = $this->findFrameworkType($packageType); + + if ($frameworkType === false) { + return false; + } + + $locationPattern = $this->getLocationPattern($frameworkType); + + return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1; + } + + /** + * Finds a supported framework type if it exists and returns it + * + * @param string $type + * @return string + */ + protected function findFrameworkType($type) + { + $frameworkType = false; + + krsort($this->supportedTypes); + + foreach ($this->supportedTypes as $key => $val) { + if ($key === substr($type, 0, strlen($key))) { + $frameworkType = substr($type, 0, strlen($key)); + break; + } + } + + return $frameworkType; + } + + /** + * Get the second part of the regular expression to check for support of a + * package type + * + * @param string $frameworkType + * @return string + */ + protected function getLocationPattern($frameworkType) + { + $pattern = false; + if (!empty($this->supportedTypes[$frameworkType])) { + $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType]; + /** @var BaseInstaller $framework */ + $framework = new $frameworkClass(null, $this->composer, $this->getIO()); + $locations = array_keys($framework->getLocations()); + $pattern = $locations ? '(' . implode('|', $locations) . ')' : false; + } + + return $pattern ? : '(\w+)'; + } + + /** + * Get I/O object + * + * @return IOInterface + */ + private function getIO() + { + return $this->io; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php new file mode 100644 index 0000000..9ee7759 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php @@ -0,0 +1,15 @@ + 'components/{$name}/', + 'module' => 'modules/{$name}/', + 'template' => 'templates/{$name}/', + 'plugin' => 'plugins/{$name}/', + 'library' => 'libraries/{$name}/', + ); + + // TODO: Add inflector for mod_ and com_ names +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php new file mode 100644 index 0000000..36b2f84 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php @@ -0,0 +1,11 @@ + 'site/plugins/{$name}/', + 'field' => 'site/fields/{$name}/', + 'tag' => 'site/tags/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php new file mode 100644 index 0000000..7143e23 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php @@ -0,0 +1,10 @@ + 'cms/plugins/{$name}/', + 'media' => 'cms/media/vendor/{$name}/' + ); +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php new file mode 100644 index 0000000..dcd6d26 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php new file mode 100644 index 0000000..be4d53a --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php @@ -0,0 +1,9 @@ + 'libraries/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php new file mode 100644 index 0000000..47bbd4c --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php @@ -0,0 +1,10 @@ + 'libraries/{$name}/', + 'source' => 'libraries/_source/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php new file mode 100644 index 0000000..9c2e9fb --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php new file mode 100644 index 0000000..5a66460 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php @@ -0,0 +1,16 @@ + 'assets/snippets/{$name}/', + 'plugin' => 'assets/plugins/{$name}/', + 'module' => 'assets/modules/{$name}/', + 'template' => 'assets/templates/{$name}/', + 'lib' => 'assets/lib/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php new file mode 100644 index 0000000..cf18e94 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php @@ -0,0 +1,11 @@ + 'app/design/frontend/{$name}/', + 'skin' => 'skin/frontend/default/{$name}/', + 'library' => 'lib/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php new file mode 100644 index 0000000..ca3cfac --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php @@ -0,0 +1,9 @@ + 'app/packages/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php new file mode 100644 index 0000000..3e1ce2b --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php @@ -0,0 +1,25 @@ + 'plugins/{$name}/', + 'theme' => 'themes/{$name}/', + ); + + /** + * Format package name of mautic-plugins to CamelCase + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] == 'mautic-plugin') { + $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) { + return strtoupper($matches[0][1]); + }, ucfirst($vars['name'])); + } + + return $vars; + } + +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php new file mode 100644 index 0000000..01008c6 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php @@ -0,0 +1,50 @@ + 'extensions/{$name}/', + 'skin' => 'skins/{$name}/', + ); + + /** + * Format package name. + * + * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform + * to CamelCase keeping existing uppercase chars. + * + * For package type mediawiki-skin, cut off a trailing '-skin' if present. + * + */ + public function inflectPackageVars($vars) + { + + if ($vars['type'] === 'mediawiki-extension') { + return $this->inflectExtensionVars($vars); + } + + if ($vars['type'] === 'mediawiki-skin') { + return $this->inflectSkinVars($vars); + } + + return $vars; + } + + protected function inflectExtensionVars($vars) + { + $vars['name'] = preg_replace('/-extension$/', '', $vars['name']); + $vars['name'] = str_replace('-', ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } + + protected function inflectSkinVars($vars) + { + $vars['name'] = preg_replace('/-skin$/', '', $vars['name']); + + return $vars; + } + +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php new file mode 100644 index 0000000..4bbbec8 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php @@ -0,0 +1,111 @@ + 'userfiles/modules/{$name}/', + 'module-skin' => 'userfiles/modules/{$name}/templates/', + 'template' => 'userfiles/templates/{$name}/', + 'element' => 'userfiles/elements/{$name}/', + 'vendor' => 'vendor/{$name}/', + 'components' => 'components/{$name}/' + ); + + /** + * Format package name. + * + * For package type microweber-module, cut off a trailing '-module' if present + * + * For package type microweber-template, cut off a trailing '-template' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'microweber-template') { + return $this->inflectTemplateVars($vars); + } + if ($vars['type'] === 'microweber-templates') { + return $this->inflectTemplatesVars($vars); + } + if ($vars['type'] === 'microweber-core') { + return $this->inflectCoreVars($vars); + } + if ($vars['type'] === 'microweber-adapter') { + return $this->inflectCoreVars($vars); + } + if ($vars['type'] === 'microweber-module') { + return $this->inflectModuleVars($vars); + } + if ($vars['type'] === 'microweber-modules') { + return $this->inflectModulesVars($vars); + } + if ($vars['type'] === 'microweber-skin') { + return $this->inflectSkinVars($vars); + } + if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') { + return $this->inflectElementVars($vars); + } + + return $vars; + } + + protected function inflectTemplateVars($vars) + { + $vars['name'] = preg_replace('/-template$/', '', $vars['name']); + $vars['name'] = preg_replace('/template-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectTemplatesVars($vars) + { + $vars['name'] = preg_replace('/-templates$/', '', $vars['name']); + $vars['name'] = preg_replace('/templates-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectCoreVars($vars) + { + $vars['name'] = preg_replace('/-providers$/', '', $vars['name']); + $vars['name'] = preg_replace('/-provider$/', '', $vars['name']); + $vars['name'] = preg_replace('/-adapter$/', '', $vars['name']); + + return $vars; + } + + protected function inflectModuleVars($vars) + { + $vars['name'] = preg_replace('/-module$/', '', $vars['name']); + $vars['name'] = preg_replace('/module-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectModulesVars($vars) + { + $vars['name'] = preg_replace('/-modules$/', '', $vars['name']); + $vars['name'] = preg_replace('/modules-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectSkinVars($vars) + { + $vars['name'] = preg_replace('/-skin$/', '', $vars['name']); + $vars['name'] = preg_replace('/skin-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectElementVars($vars) + { + $vars['name'] = preg_replace('/-elements$/', '', $vars['name']); + $vars['name'] = preg_replace('/elements-$/', '', $vars['name']); + $vars['name'] = preg_replace('/-element$/', '', $vars['name']); + $vars['name'] = preg_replace('/element-$/', '', $vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php new file mode 100644 index 0000000..3cdda6c --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php @@ -0,0 +1,56 @@ + 'mod/{$name}/', + 'admin_report' => 'admin/report/{$name}/', + 'atto' => 'lib/editor/atto/plugins/{$name}/', + 'tool' => 'admin/tool/{$name}/', + 'assignment' => 'mod/assignment/type/{$name}/', + 'assignsubmission' => 'mod/assign/submission/{$name}/', + 'assignfeedback' => 'mod/assign/feedback/{$name}/', + 'auth' => 'auth/{$name}/', + 'availability' => 'availability/condition/{$name}/', + 'block' => 'blocks/{$name}/', + 'booktool' => 'mod/book/tool/{$name}/', + 'cachestore' => 'cache/stores/{$name}/', + 'cachelock' => 'cache/locks/{$name}/', + 'calendartype' => 'calendar/type/{$name}/', + 'format' => 'course/format/{$name}/', + 'coursereport' => 'course/report/{$name}/', + 'datafield' => 'mod/data/field/{$name}/', + 'datapreset' => 'mod/data/preset/{$name}/', + 'editor' => 'lib/editor/{$name}/', + 'enrol' => 'enrol/{$name}/', + 'filter' => 'filter/{$name}/', + 'gradeexport' => 'grade/export/{$name}/', + 'gradeimport' => 'grade/import/{$name}/', + 'gradereport' => 'grade/report/{$name}/', + 'gradingform' => 'grade/grading/form/{$name}/', + 'local' => 'local/{$name}/', + 'logstore' => 'admin/tool/log/store/{$name}/', + 'ltisource' => 'mod/lti/source/{$name}/', + 'ltiservice' => 'mod/lti/service/{$name}/', + 'message' => 'message/output/{$name}/', + 'mnetservice' => 'mnet/service/{$name}/', + 'plagiarism' => 'plagiarism/{$name}/', + 'portfolio' => 'portfolio/{$name}/', + 'qbehaviour' => 'question/behaviour/{$name}/', + 'qformat' => 'question/format/{$name}/', + 'qtype' => 'question/type/{$name}/', + 'quizaccess' => 'mod/quiz/accessrule/{$name}/', + 'quiz' => 'mod/quiz/report/{$name}/', + 'report' => 'report/{$name}/', + 'repository' => 'repository/{$name}/', + 'scormreport' => 'mod/scorm/report/{$name}/', + 'theme' => 'theme/{$name}/', + 'tinymce' => 'lib/editor/tinymce/plugins/{$name}/', + 'profilefield' => 'user/profile/field/{$name}/', + 'webservice' => 'webservice/{$name}/', + 'workshopallocation' => 'mod/workshop/allocation/{$name}/', + 'workshopeval' => 'mod/workshop/eval/{$name}/', + 'workshopform' => 'mod/workshop/form/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php new file mode 100644 index 0000000..6bf53fd --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php @@ -0,0 +1,46 @@ + 'modules/{$name}/', + 'plugin' => 'plugins/{$vendor}/{$name}/', + 'theme' => 'themes/{$name}/' + ); + + /** + * Format package name. + * + * For package type october-plugin, cut off a trailing '-plugin' if present. + * + * For package type october-theme, cut off a trailing '-theme' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'october-plugin') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'october-theme') { + return $this->inflectThemeVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']); + + return $vars; + } + + protected function inflectThemeVars($vars) + { + $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); + + return $vars; + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php new file mode 100644 index 0000000..49940ff --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php @@ -0,0 +1,59 @@ +.+)\/.+/'; + + protected $locations = array( + 'module' => 'modules/{$name}/', + 'theme' => 'application/views/{$name}/', + 'out' => 'out/{$name}/', + ); + + /** + * getInstallPath + * + * @param PackageInterface $package + * @param string $frameworkType + * @return void + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + $installPath = parent::getInstallPath($package, $frameworkType); + $type = $this->package->getType(); + if ($type === 'oxid-module') { + $this->prepareVendorDirectory($installPath); + } + return $installPath; + } + + /** + * prepareVendorDirectory + * + * Makes sure there is a vendormetadata.php file inside + * the vendor folder if there is a vendor folder. + * + * @param string $installPath + * @return void + */ + protected function prepareVendorDirectory($installPath) + { + $matches = ''; + $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches); + if (!$hasVendorDirectory) { + return; + } + + $vendorDirectory = $matches['vendor']; + $vendorPath = getcwd() . '/modules/' . $vendorDirectory; + if (!file_exists($vendorPath)) { + mkdir($vendorPath, 0755, true); + } + + $vendorMetaDataPath = $vendorPath . '/vendormetadata.php'; + touch($vendorMetaDataPath); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php new file mode 100644 index 0000000..170136f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php new file mode 100644 index 0000000..4e59a8a --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php @@ -0,0 +1,11 @@ + 'bundles/{$name}/', + 'library' => 'libraries/{$name}/', + 'framework' => 'frameworks/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php new file mode 100644 index 0000000..deb2b77 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php @@ -0,0 +1,11 @@ + 'ext/{$vendor}/{$name}/', + 'language' => 'language/{$name}/', + 'style' => 'styles/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php new file mode 100644 index 0000000..4781fa6 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php @@ -0,0 +1,21 @@ + 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php new file mode 100644 index 0000000..c17f457 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php @@ -0,0 +1,32 @@ + 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php new file mode 100644 index 0000000..903e55f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php @@ -0,0 +1,29 @@ + '{$name}/' + ); + + /** + * Remove hyphen, "plugin" and format to camelcase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = explode("-", $vars['name']); + foreach ($vars['name'] as $key => $name) { + $vars['name'][$key] = ucfirst($vars['name'][$key]); + if (strcasecmp($name, "Plugin") == 0) { + unset($vars['name'][$key]); + } + } + $vars['name'] = implode("",$vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Plugin.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Plugin.php new file mode 100644 index 0000000..5eb04af --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Plugin.php @@ -0,0 +1,17 @@ +getInstallationManager()->addInstaller($installer); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php new file mode 100644 index 0000000..4c8421e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php @@ -0,0 +1,10 @@ + 'modules/{$name}/', + 'theme' => 'themes/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php new file mode 100644 index 0000000..77cc3dd --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php @@ -0,0 +1,11 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php new file mode 100644 index 0000000..0f78b5c --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php @@ -0,0 +1,24 @@ + 'src/{$name}/' + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $nameParts = explode('/', $vars['name']); + foreach ($nameParts as &$value) { + $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); + $value = str_replace(array('-', '_'), ' ', $value); + $value = str_replace(' ', '', ucwords($value)); + } + $vars['name'] = implode('/', $nameParts); + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php new file mode 100644 index 0000000..252c733 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php @@ -0,0 +1,10 @@ + 'themes/{$name}/', + 'plugin' => 'plugins/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php new file mode 100644 index 0000000..0954457 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php @@ -0,0 +1,10 @@ + 'redaxo/include/addons/{$name}/', + 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php new file mode 100644 index 0000000..d8d795b --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php @@ -0,0 +1,22 @@ + 'plugins/{$name}/', + ); + + /** + * Lowercase name and changes the name to a underscores + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(str_replace('-', '_', $vars['name'])); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php new file mode 100644 index 0000000..1acd3b1 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php @@ -0,0 +1,10 @@ + 'Sources/{$name}/', + 'theme' => 'Themes/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php new file mode 100644 index 0000000..d0193cb --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php @@ -0,0 +1,60 @@ + 'engine/Shopware/Plugins/Local/Backend/{$name}/', + 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/', + 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/', + 'theme' => 'templates/{$name}/', + 'plugin' => 'custom/plugins/{$name}/', + 'frontend-theme' => 'themes/Frontend/{$name}/', + ); + + /** + * Transforms the names + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'shopware-theme') { + return $this->correctThemeName($vars); + } else { + return $this->correctPluginName($vars); + } + } + + /** + * Changes the name to a camelcased combination of vendor and name + * @param array $vars + * @return array + */ + private function correctPluginName($vars) + { + $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { + return strtoupper($matches[0][1]); + }, $vars['name']); + + $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName); + + return $vars; + } + + /** + * Changes the name to a underscore separated name + * @param array $vars + * @return array + */ + private function correctThemeName($vars) + { + $vars['name'] = str_replace('-', '_', $vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php new file mode 100644 index 0000000..17ca543 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php @@ -0,0 +1,36 @@ + '{$name}/', + 'theme' => 'themes/{$name}/', + ); + + /** + * Return the install path based on package type. + * + * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework + * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0 + * + * @param PackageInterface $package + * @param string $frameworkType + * @return string + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + if ( + $package->getName() == 'silverstripe/framework' + && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion()) + && version_compare($package->getVersion(), '2.999.999') < 0 + ) { + return $this->templatePath($this->locations['module'], array('name' => 'sapphire')); + } else { + return parent::getInstallPath($package, $frameworkType); + } + + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php new file mode 100644 index 0000000..1675c4f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php @@ -0,0 +1,26 @@ + + */ +class Symfony1Installer extends BaseInstaller +{ + protected $locations = array( + 'plugin' => 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) { + return strtoupper($matches[0][1]); + }, $vars['name']); + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php new file mode 100644 index 0000000..b1663e8 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php @@ -0,0 +1,16 @@ + + */ +class TYPO3CmsInstaller extends BaseInstaller +{ + protected $locations = array( + 'extension' => 'typo3conf/ext/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php new file mode 100644 index 0000000..42572f4 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php @@ -0,0 +1,38 @@ + 'Packages/Application/{$name}/', + 'framework' => 'Packages/Framework/{$name}/', + 'plugin' => 'Packages/Plugins/{$name}/', + 'site' => 'Packages/Sites/{$name}/', + 'boilerplate' => 'Packages/Boilerplates/{$name}/', + 'build' => 'Build/{$name}/', + ); + + /** + * Modify the package name to be a TYPO3 Flow style key. + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + $autoload = $this->package->getAutoload(); + if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) { + $namespace = key($autoload['psr-0']); + $vars['name'] = str_replace('\\', '.', $namespace); + } + if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) { + $namespace = key($autoload['psr-4']); + $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.'); + } + + return $vars; + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php new file mode 100644 index 0000000..158af52 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php @@ -0,0 +1,12 @@ + 'local/modules/{$name}/', + 'frontoffice-template' => 'templates/frontOffice/{$name}/', + 'backoffice-template' => 'templates/backOffice/{$name}/', + 'email-template' => 'templates/email/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php new file mode 100644 index 0000000..7c0113b --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php @@ -0,0 +1,14 @@ + + */ + class TuskInstaller extends BaseInstaller + { + protected $locations = array( + 'task' => '.tusk/tasks/{$name}/', + 'command' => '.tusk/commands/{$name}/', + 'asset' => 'assets/tusk/{$name}/', + ); + } diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php new file mode 100644 index 0000000..24ca645 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php @@ -0,0 +1,10 @@ + 'plugins/{$name}/', + 'theme' => 'themes/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php new file mode 100644 index 0000000..2cbb4a4 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php @@ -0,0 +1,10 @@ + 'modules/gateways/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php new file mode 100644 index 0000000..cb38788 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php @@ -0,0 +1,9 @@ + 'wolf/plugins/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php new file mode 100644 index 0000000..b03219c --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php @@ -0,0 +1,11 @@ + 'wp-content/plugins/{$name}/', + 'theme' => 'wp-content/themes/{$name}/', + 'muplugin' => 'wp-content/mu-plugins/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php new file mode 100644 index 0000000..27f429f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php @@ -0,0 +1,32 @@ + 'module/{$name}/', + ); + + /** + * Format package name to CamelCase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php new file mode 100644 index 0000000..bde9bc8 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php @@ -0,0 +1,11 @@ + 'library/{$name}/', + 'extra' => 'extras/library/{$name}/', + 'module' => 'module/{$name}/', + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php new file mode 100644 index 0000000..56cdf5d --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php @@ -0,0 +1,10 @@ + 'modules/{$vendor}-{$name}/', + 'theme' => 'themes/{$vendor}-{$name}/' + ); +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/src/bootstrap.php b/plugins/offline/sitesearch/vendor/composer/installers/src/bootstrap.php new file mode 100644 index 0000000..0de276e --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/src/bootstrap.php @@ -0,0 +1,13 @@ +installer = new AsgardInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + array('name' => $expected, 'type' => $type), + $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)) + ); + } + + public function packageNameInflectionProvider() + { + return array( + // Should keep module name StudlyCase + array( + 'asgard-module', + 'user-profile', + 'UserProfile' + ), + array( + 'asgard-module', + 'asgard-module', + 'Asgard' + ), + array( + 'asgard-module', + 'blog', + 'Blog' + ), + // tests that exactly one '-module' is cut off + array( + 'asgard-module', + 'some-module-module', + 'SomeModule', + ), + // tests that exactly one '-theme' is cut off + array( + 'asgard-theme', + 'some-theme-theme', + 'SomeTheme', + ), + // tests that names without '-theme' suffix stay valid + array( + 'asgard-theme', + 'someothertheme', + 'Someothertheme', + ), + // Should keep theme name StudlyCase + array( + 'asgard-theme', + 'adminlte-advanced', + 'AdminlteAdvanced' + ), + ); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php new file mode 100644 index 0000000..e909bb4 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php @@ -0,0 +1,76 @@ +composer = new Composer(); + } + + /** + * @param string $vars + * @param string $expectedVars + * + * @covers ::inflectPackageVars + * + * @dataProvider provideExpectedInflectionResults + */ + final public function testInflectPackageVars($vars, $expectedVars) + { + + $this->installer = new BitrixInstaller( + new Package($vars['name'], '4.2', '4.2'), + $this->composer + ); + $actual = $this->installer->inflectPackageVars($vars); + $this->assertEquals($actual, $expectedVars); + } + + /** + * Provides various parameters for packages and the expected result after inflection + * + * @return array + */ + final public function provideExpectedInflectionResults() + { + return array( + //check bitrix-dir is correct + array( + array('name' => 'Nyan/Cat'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') + ), + array( + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') + ), + array( + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local') + ), + ); + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php new file mode 100644 index 0000000..523e847 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php @@ -0,0 +1,115 @@ +package = new Package('CamelCased', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + $this->composer->setConfig(new Config(false)); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'CamelCased')); + $this->assertEquals($result, array('name' => 'CamelCased')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with-dash')); + $this->assertEquals($result, array('name' => 'WithDash')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with_underscore')); + $this->assertEquals($result, array('name' => 'WithUnderscore')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'cake/acl')); + $this->assertEquals($result, array('name' => 'Cake/Acl')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'cake/debug-kit')); + $this->assertEquals($result, array('name' => 'Cake/DebugKit')); + } + + /** + * Test getLocations returning appropriate values based on CakePHP version + * + */ + public function testGetLocations() { + $package = new RootPackage('CamelCased', '1.0', '1.0'); + $composer = $this->composer; + $rm = new RepositoryManager( + $this->getMock('Composer\IO\IOInterface'), + $this->getMock('Composer\Config') + ); + $composer->setRepositoryManager($rm); + $installer = new CakePHPInstaller($package, $composer); + + // 2.0 < cakephp < 3.0 + $this->setCakephpVersion($rm, '2.0.0'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '2.5.9'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '~2.5'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + // special handling for 2.x versions when 3.x is still in development + $this->setCakephpVersion($rm, 'dev-master'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '>=2.5'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + // cakephp >= 3.0 + $this->setCakephpVersion($rm, '3.0.*-dev'); + $result = $installer->getLocations(); + $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']); + + $this->setCakephpVersion($rm, '~8.8'); + $result = $installer->getLocations(); + $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']); + } + + protected function setCakephpVersion($rm, $version) { + $parser = new VersionParser(); + list(, $version) = explode(' ', $parser->parseConstraints($version)); + $installed = new InstalledArrayRepository(); + $package = new Package('cakephp/cakephp', $version, $version); + $installed->addPackage($package); + $rm->setLocalRepository($installed); + } + +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php new file mode 100644 index 0000000..31ccecd --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php @@ -0,0 +1,83 @@ +installer = new CraftInstaller(); + } + + /** + * @param string $packageName + * @param string $expectedName + * + * @covers ::inflectPackageVars + * + * @dataProvider provideExpectedInflectionResults + */ + final public function testInflectPackageVars($packageName, $expectedName) + { + $installer = $this->installer; + + $vars = array('name' => $packageName); + $expected = array('name' => $expectedName); + + $actual = $installer->inflectPackageVars($vars); + + $this->assertEquals($actual, $expected); + } + + /** + * Provides various names for packages and the expected result after inflection + * + * @return array + */ + final public function provideExpectedInflectionResults() + { + return array( + // lowercase + array('foo', 'foo'), + array('craftfoo', 'craftfoo'), + array('fooplugin', 'fooplugin'), + array('craftfooplugin', 'craftfooplugin'), + // lowercase - dash + array('craft-foo', 'foo'), + array('foo-plugin', 'foo'), + array('craft-foo-plugin', 'foo'), + // lowercase - underscore + array('craft_foo', 'craft_foo'), + array('foo_plugin', 'foo_plugin'), + array('craft_foo_plugin', 'craft_foo_plugin'), + // CamelCase + array('Foo', 'Foo'), + array('CraftFoo', 'CraftFoo'), + array('FooPlugin', 'FooPlugin'), + array('CraftFooPlugin', 'CraftFooPlugin'), + // CamelCase - Dash + array('Craft-Foo', 'Foo'), + array('Foo-Plugin', 'Foo'), + array('Craft-Foo-Plugin', 'Foo'), + // CamelCase - underscore + array('Craft_Foo', 'Craft_Foo'), + array('Foo_Plugin', 'Foo_Plugin'), + array('Craft_Foo_Plugin', 'Craft_Foo_Plugin'), + ); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php new file mode 100644 index 0000000..9e385e6 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php @@ -0,0 +1,89 @@ +installer = new DokuWikiInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)), + array('name' => $expected, 'type'=>$type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'dokuwiki-plugin', + 'dokuwiki-test-plugin', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test-plugin', + 'test', + ), + array( + 'dokuwiki-plugin', + 'dokuwiki_test', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test-template', + 'test-template', + ), + array( + 'dokuwiki-template', + 'dokuwiki-test-template', + 'test', + ), + array( + 'dokuwiki-template', + 'test-template', + 'test', + ), + array( + 'dokuwiki-template', + 'dokuwiki_test', + 'test', + ), + array( + 'dokuwiki-template', + 'test', + 'test', + ), + array( + 'dokuwiki-template', + 'test-plugin', + 'test-plugin', + ), + ); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php new file mode 100644 index 0000000..b757799 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php @@ -0,0 +1,63 @@ +composer = new Composer(); + } + + public function testInflectPackageVars() + { + $package = $this->getPackage('vendor/name', '0.0.0'); + $installer = new GravInstaller($package, $this->composer); + $packageVars = $this->getPackageVars($package); + + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => 'test'))); + $this->assertEquals('test', $result['name']); + + foreach ($installer->getLocations() as $name => $location) { + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-$name"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test-test"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-test-$name"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-$name"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test-test"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-test-$name"))); + $this->assertEquals('test-test', $result['name']); + } + } + + /** + * @param $package \Composer\Package\PackageInterface + */ + public function getPackageVars($package) + { + $type = $package->getType(); + + $prettyName = $package->getPrettyName(); + if (strpos($prettyName, '/') !== false) { + list($vendor, $name) = explode('/', $prettyName); + } else { + $vendor = ''; + $name = $prettyName; + } + + return compact('name', 'vendor', 'type'); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php new file mode 100644 index 0000000..df699da --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php @@ -0,0 +1,496 @@ +fs = new Filesystem; + + $this->composer = new Composer(); + $this->config = new Config(); + $this->composer->setConfig($this->config); + + $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor'; + $this->ensureDirectoryExistsAndClear($this->vendorDir); + + $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin'; + $this->ensureDirectoryExistsAndClear($this->binDir); + + $this->config->merge(array( + 'config' => array( + 'vendor-dir' => $this->vendorDir, + 'bin-dir' => $this->binDir, + ), + )); + + $this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager') + ->disableOriginalConstructor() + ->getMock(); + $this->composer->setDownloadManager($this->dm); + + $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); + $this->io = $this->getMock('Composer\IO\IOInterface'); + } + + /** + * tearDown + * + * @return void + */ + public function tearDown() + { + $this->fs->removeDirectory($this->vendorDir); + $this->fs->removeDirectory($this->binDir); + } + + /** + * testSupports + * + * @return void + * + * @dataProvider dataForTestSupport + */ + public function testSupports($type, $expected) + { + $installer = new Installer($this->io, $this->composer); + $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type)); + } + + /** + * dataForTestSupport + */ + public function dataForTestSupport() + { + return array( + array('agl-module', true), + array('aimeos-extension', true), + array('annotatecms-module', true), + array('annotatecms-component', true), + array('annotatecms-service', true), + array('attogram-module', true), + array('bitrix-module', true), + array('bitrix-component', true), + array('bitrix-theme', true), + array('bonefish-package', true), + array('cakephp', false), + array('cakephp-', false), + array('cakephp-app', false), + array('cakephp-plugin', true), + array('chef-cookbook', true), + array('chef-role', true), + array('cockpit-module', true), + array('codeigniter-app', false), + array('codeigniter-library', true), + array('codeigniter-third-party', true), + array('codeigniter-module', true), + array('concrete5-block', true), + array('concrete5-package', true), + array('concrete5-theme', true), + array('concrete5-update', true), + array('craft-plugin', true), + array('croogo-plugin', true), + array('croogo-theme', true), + array('decibel-app', true), + array('dokuwiki-plugin', true), + array('dokuwiki-template', true), + array('drupal-module', true), + array('dolibarr-module', true), + array('ee3-theme', true), + array('ee3-addon', true), + array('ee2-theme', true), + array('ee2-addon', true), + array('elgg-plugin', true), + array('fuel-module', true), + array('fuel-package', true), + array('fuel-theme', true), + array('fuelphp-component', true), + array('hurad-plugin', true), + array('hurad-theme', true), + array('imagecms-template', true), + array('imagecms-module', true), + array('imagecms-library', true), + array('joomla-library', true), + array('kirby-plugin', true), + array('kohana-module', true), + array('laravel-library', true), + array('lithium-library', true), + array('magento-library', true), + array('mako-package', true), + array('modxevo-snippet', true), + array('modxevo-plugin', true), + array('modxevo-module', true), + array('modxevo-template', true), + array('modxevo-lib', true), + array('mediawiki-extension', true), + array('mediawiki-skin', true), + array('microweber-module', true), + array('modulework-module', true), + array('moodle-mod', true), + array('october-module', true), + array('october-plugin', true), + array('piwik-plugin', true), + array('phpbb-extension', true), + array('pimcore-plugin', true), + array('plentymarkets-plugin', true), + array('ppi-module', true), + array('prestashop-module', true), + array('prestashop-theme', true), + array('puppet-module', true), + array('radphp-bundle', true), + array('redaxo-addon', true), + array('redaxo-bestyle-plugin', true), + array('reindex-theme', true), + array('reindex-plugin', true), + array('roundcube-plugin', true), + array('shopware-backend-plugin', true), + array('shopware-core-plugin', true), + array('shopware-frontend-plugin', true), + array('shopware-theme', true), + array('shopware-plugin', true), + array('shopware-frontend-theme', true), + array('silverstripe-module', true), + array('silverstripe-theme', true), + array('smf-module', true), + array('smf-theme', true), + array('symfony1-plugin', true), + array('thelia-module', true), + array('thelia-frontoffice-template', true), + array('thelia-backoffice-template', true), + array('thelia-email-template', true), + array('tusk-task', true), + array('tusk-asset', true), + array('typo3-flow-plugin', true), + array('typo3-cms-extension', true), + array('vanilla-plugin', true), + array('vanilla-theme', true), + array('whmcs-gateway', true), + array('wolfcms-plugin', true), + array('wordpress-plugin', true), + array('wordpress-core', false), + array('yawik-module', true), + array('zend-library', true), + array('zikula-module', true), + array('zikula-theme', true), + array('kodicms-plugin', true), + array('kodicms-media', true), + array('phifty-bundle', true), + array('phifty-library', true), + array('phifty-framework', true), + ); + } + + /** + * testInstallPath + * + * @dataProvider dataForTestInstallPath + */ + public function testInstallPath($type, $path, $name, $version = '1.0.0') + { + $installer = new Installer($this->io, $this->composer); + $package = new Package($name, $version, $version); + + $package->setType($type); + $result = $installer->getInstallPath($package); + $this->assertEquals($path, $result); + } + + /** + * dataFormTestInstallPath + */ + public function dataForTestInstallPath() + { + return array( + array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'), + array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'), + array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'), + array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'), + array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'), + array('attogram-module', 'modules/my_module/', 'author/my_module'), + array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'), + array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'), + array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'), + array('bitrix-d7-module', 'bitrix/modules/author.my_module/', 'author/my_module'), + array('bitrix-d7-component', 'bitrix/components/author/my_component/', 'author/my_component'), + array('bitrix-d7-template', 'bitrix/templates/author_my_template/', 'author/my_template'), + array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'), + array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'), + array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'), + array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'), + array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'), + array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'), + array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'), + array('concrete5-block', 'blocks/concrete5_block/', 'remo/concrete5_block'), + array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'), + array('concrete5-theme', 'themes/concrete5_theme/', 'remo/concrete5_theme'), + array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'), + array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'), + array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'), + array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'), + array('decibel-app', 'app/someapp/', 'author/someapp'), + array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'), + array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'), + array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'), + array('drupal-module', 'modules/my_module/', 'shama/my_module'), + array('drupal-theme', 'themes/my_module/', 'shama/my_module'), + array('drupal-profile', 'profiles/my_module/', 'shama/my_module'), + array('drupal-drush', 'drush/my_module/', 'shama/my_module'), + array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'), + array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'), + array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'), + array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'), + array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'), + array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'), + array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'), + array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'), + array('fuelphp-component', 'components/demo/', 'fuelphp/demo'), + array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'), + array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'), + array('imagecms-template', 'templates/my_template/', 'shama/my_template'), + array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'), + array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'), + array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'), + array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'), + array('kohana-module', 'modules/my_package/', 'shama/my_package'), + array('laravel-library', 'libraries/my_package/', 'shama/my_package'), + array('lithium-library', 'libraries/li3_test/', 'user/li3_test'), + array('magento-library', 'lib/foo/', 'test/foo'), + array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'), + array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'), + array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'), + array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'), + array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'), + array('mako-package', 'app/packages/my_package/', 'shama/my_package'), + array('mediawiki-extension', 'extensions/APC/', 'author/APC'), + array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'), + array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'), + array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'), + array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'), + array('mediawiki-skin', 'skins/someskin/', 'author/someskin'), + array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'), + array('modulework-module', 'modules/my_package/', 'shama/my_package'), + array('moodle-mod', 'mod/my_package/', 'shama/my_package'), + array('october-module', 'modules/my_plugin/', 'shama/my_plugin'), + array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'), + array('october-theme', 'themes/my_theme/', 'shama/my_theme'), + array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'), + array('prestashop-module', 'modules/a-module/', 'vendor/a-module'), + array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'), + array('phpbb-extension', 'ext/test/foo/', 'test/foo'), + array('phpbb-style', 'styles/foo/', 'test/foo'), + array('phpbb-language', 'language/foo/', 'test/foo'), + array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'), + array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'), + array('ppi-module', 'modules/foo/', 'test/foo'), + array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'), + array('radphp-bundle', 'src/Migration/', 'atkrad/migration'), + array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'), + array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'), + array('reindex-theme', 'themes/my_module/', 'author/my_module'), + array('reindex-plugin', 'plugins/my_module/', 'author/my_module'), + array('roundcube-plugin', 'plugins/base/', 'test/base'), + array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'), + array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'), + array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'), + array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'), + array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'), + array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'), + array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'), + array('silverstripe-module', 'my_module/', 'shama/my_module'), + array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'), + array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'), + array('smf-module', 'Sources/my_module/', 'shama/my_module'), + array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'), + array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'), + array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'), + array('thelia-module', 'local/modules/my_module/', 'shama/my_module'), + array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'), + array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'), + array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'), + array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'), + array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'), + array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'), + array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'), + array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'), + array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'), + array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'), + array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'), + array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'), + array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'), + array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'), + array('zikula-module', 'modules/my-test_module/', 'my/test_module'), + array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'), + array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'), + array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'), + array('phifty-bundle', 'bundles/core/', 'shama/core'), + array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'), + array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'), + array('yawik-module', 'module/MyModule/', 'shama/my_module'), + ); + } + + /** + * testGetCakePHPInstallPathException + * + * @return void + * + * @expectedException \InvalidArgumentException + */ + public function testGetCakePHPInstallPathException() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/ftp', '1.0.0', '1.0.0'); + + $package->setType('cakephp-whoops'); + $result = $installer->getInstallPath($package); + } + + /** + * testCustomInstallPath + */ + public function testCustomInstallPath() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/ftp', '1.0.0', '1.0.0'); + $package->setType('cakephp-plugin'); + $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0'); + $this->composer->setPackage($consumerPackage); + $consumerPackage->setExtra(array( + 'installer-paths' => array( + 'my/custom/path/{$name}/' => array( + 'shama/ftp', + 'foo/bar', + ), + ), + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('my/custom/path/Ftp/', $result); + } + + /** + * testCustomInstallerName + */ + public function testCustomInstallerName() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0'); + $package->setType('cakephp-plugin'); + $package->setExtra(array( + 'installer-name' => 'FTP', + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('Plugin/FTP/', $result); + } + + /** + * testCustomTypePath + */ + public function testCustomTypePath() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0'); + $package->setType('wordpress-plugin'); + $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0'); + $this->composer->setPackage($consumerPackage); + $consumerPackage->setExtra(array( + 'installer-paths' => array( + 'my/custom/path/{$name}/' => array( + 'type:wordpress-plugin' + ), + ), + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('my/custom/path/my_plugin/', $result); + } + + /** + * testVendorPath + */ + public function testVendorPath() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('penyaskito/my_module', '1.0.0', '1.0.0'); + $package->setType('drupal-module'); + $consumerPackage = new RootPackage('drupal/drupal', '1.0.0', '1.0.0'); + $this->composer->setPackage($consumerPackage); + $consumerPackage->setExtra(array( + 'installer-paths' => array( + 'modules/custom/{$name}/' => array( + 'vendor:penyaskito' + ), + ), + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('modules/custom/my_module/', $result); + } + + /** + * testNoVendorName + */ + public function testNoVendorName() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0'); + + $package->setType('symfony1-plugin'); + $result = $installer->getInstallPath($package); + $this->assertEquals('plugins/sfPhpunitPlugin/', $result); + } + + /** + * testTypo3Inflection + */ + public function testTypo3Inflection() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('typo3/fluid', '1.0.0', '1.0.0'); + + $package->setAutoload(array( + 'psr-0' => array( + 'TYPO3\\Fluid' => 'Classes', + ), + )); + + $package->setType('typo3-flow-package'); + $result = $installer->getInstallPath($package); + $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result); + } + + public function testUninstallAndDeletePackageFromLocalRepo() + { + $package = new Package('foo', '1.0.0', '1.0.0'); + + $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer)); + $installer->expects($this->once())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo')); + + $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); + $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true)); + $repo->expects($this->once())->method('removePackage')->with($package); + + $installer->uninstall($repo, $package); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php new file mode 100644 index 0000000..3675e18 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php @@ -0,0 +1,66 @@ +installer = new MediaWikiInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)), + array('name' => $expected, 'type'=>$type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'mediawiki-extension', + 'sub-page-list', + 'SubPageList', + ), + array( + 'mediawiki-extension', + 'sub-page-list-extension', + 'SubPageList', + ), + array( + 'mediawiki-extension', + 'semantic-mediawiki', + 'SemanticMediawiki', + ), + // tests that exactly one '-skin' is cut off, and that skins do not get ucwords treatment like extensions + array( + 'mediawiki-skin', + 'some-skin-skin', + 'some-skin', + ), + // tests that names without '-skin' suffix stay valid + array( + 'mediawiki-skin', + 'someotherskin', + 'someotherskin', + ), + ); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php new file mode 100644 index 0000000..fd427cd --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php @@ -0,0 +1,66 @@ +installer = new OctoberInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)), + array('name' => $expected, 'type' => $type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'october-plugin', + 'subpagelist', + 'subpagelist', + ), + array( + 'october-plugin', + 'subpagelist-plugin', + 'subpagelist', + ), + array( + 'october-plugin', + 'semanticoctober', + 'semanticoctober', + ), + // tests that exactly one '-theme' is cut off + array( + 'october-theme', + 'some-theme-theme', + 'some-theme', + ), + // tests that names without '-theme' suffix stay valid + array( + 'october-theme', + 'someothertheme', + 'someothertheme', + ), + ); + } +} \ No newline at end of file diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php new file mode 100644 index 0000000..ea79374 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php @@ -0,0 +1,44 @@ +package = new Package('CamelCased', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'CamelCased')); + $this->assertEquals($result, array('name' => 'CamelCased')); + + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with-dash')); + $this->assertEquals($result, array('name' => 'WithDash')); + + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with_underscore')); + $this->assertEquals($result, array('name' => 'WithUnderscore')); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php new file mode 100644 index 0000000..8d9ff3f --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php @@ -0,0 +1,63 @@ +package = new Package('VisitSummary', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'VisitSummary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'visit-summary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'visit_summary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + } + +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php new file mode 100644 index 0000000..6418a03 --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php @@ -0,0 +1,64 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Installers\Test; + +use Composer\Package\Version\VersionParser; +use Composer\Package\Package; +use Composer\Package\AliasPackage; +use Composer\Package\LinkConstraint\VersionConstraint; +use Composer\Util\Filesystem; + +abstract class TestCase extends \PHPUnit_Framework_TestCase +{ + private static $parser; + + protected static function getVersionParser() + { + if (!self::$parser) { + self::$parser = new VersionParser(); + } + + return self::$parser; + } + + protected function getVersionConstraint($operator, $version) + { + return new VersionConstraint( + $operator, + self::getVersionParser()->normalize($version) + ); + } + + protected function getPackage($name, $version) + { + $normVersion = self::getVersionParser()->normalize($version); + + return new Package($name, $normVersion, $version); + } + + protected function getAliasPackage($package, $version) + { + $normVersion = self::getVersionParser()->normalize($version); + + return new AliasPackage($package, $normVersion, $version); + } + + protected function ensureDirectoryExistsAndClear($directory) + { + $fs = new Filesystem(); + if (is_dir($directory)) { + $fs->removeDirectory($directory); + } + mkdir($directory, 0777, true); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php new file mode 100644 index 0000000..d8d35ff --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php @@ -0,0 +1,64 @@ +package = new Package('YawikCompanyRegistration', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @dataProvider packageNameProvider + * @return void + */ + public function testInflectPackageVars($input) + { + $installer = new YawikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => $input)); + $this->assertEquals($result, array('name' => 'YawikCompanyRegistration')); + } + + public function packageNameProvider() + { + return array( + array('yawik-company-registration'), + array('yawik_company_registration'), + array('YawikCompanyRegistration') + ); + } +} diff --git a/plugins/offline/sitesearch/vendor/composer/installers/tests/bootstrap.php b/plugins/offline/sitesearch/vendor/composer/installers/tests/bootstrap.php new file mode 100644 index 0000000..30c8fdc --- /dev/null +++ b/plugins/offline/sitesearch/vendor/composer/installers/tests/bootstrap.php @@ -0,0 +1,4 @@ +add('Composer\Installers\Test', __DIR__); diff --git a/plugins/watchlearn/movies/Plugin.php b/plugins/watchlearn/movies/Plugin.php index c7f3c63..697889c 100644 --- a/plugins/watchlearn/movies/Plugin.php +++ b/plugins/watchlearn/movies/Plugin.php @@ -26,4 +26,44 @@ public function registerFormWidgets() public function registerSettings() { } + + public function boot() + { + \Event::listen('offline.sitesearch.query', function ($query) { + + // Search your plugin's contents + $items = Models\Movie::where('name', 'like', "%${query}%") + ->orWhere('description', 'like', "%${query}%") + ->get(); + + // Now build a results array + $results = $items->map(function ($item) use ($query) { + + // If the query is found in the title, set a relevance of 2 + $relevance = mb_stripos($item->title, $query) !== false ? 2 : 1; + + if($item->poster){ + return [ + 'title' => $item->name, + 'text' => $item->description, + 'url' => '/movies/movie/' . $item->slug, + 'thumb' => $item->poster->first(), // Instance of System\Models\File + 'relevance' => $relevance + ]; + } else { + return [ + 'title' => $item->name, + 'text' => $item->description, + 'url' => '/movies/movie/' . $item->slug, + 'relevance' => $relevance + ]; + } + }); + + return [ + 'provider' => 'Movie', // The badge to display for this result + 'results' => $results, + ]; + }); + } } diff --git a/themes/olympos/pages/contact.htm b/themes/olympos/pages/contact.htm index ae63efe..cb3ebfd 100644 --- a/themes/olympos/pages/contact.htm +++ b/themes/olympos/pages/contact.htm @@ -4,8 +4,13 @@ is_hidden = 0 [contactform] + +[siteSearchInclude] ==

Contact Page

+This is our awesome contact page. + + {% component 'contactform' %} \ No newline at end of file diff --git a/themes/olympos/pages/homepage.htm b/themes/olympos/pages/homepage.htm index 9dabe78..5731590 100644 --- a/themes/olympos/pages/homepage.htm +++ b/themes/olympos/pages/homepage.htm @@ -6,7 +6,16 @@ [actors] results = 0 sortOrder = "name desc" + +[siteSearchInclude] == +
+ + +
+ + +

This is our homepage! Yay!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore reiciendis, porro perspiciatis officia maiores dignissimos. Veritatis ea nulla illo qui.

diff --git a/themes/olympos/pages/search.htm b/themes/olympos/pages/search.htm new file mode 100644 index 0000000..1932939 --- /dev/null +++ b/themes/olympos/pages/search.htm @@ -0,0 +1,12 @@ +title = "search" +url = "/search" +layout = "default" +is_hidden = 0 + +[searchResults] +resultsPerPage = 10 +showProviderBadge = 1 +noResultsMessage = "Your search returned no results." +visitPageMessage = "Visit page" +== +{% component 'searchResults' %} \ No newline at end of file