├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── cs.yml │ ├── unit-tests.yml │ └── zipitup.yml ├── README.md ├── better-search.php ├── changelog.txt ├── composer.json ├── freemius ├── LICENSE.txt ├── assets │ ├── css │ │ ├── admin │ │ │ ├── account.css │ │ │ ├── add-ons.css │ │ │ ├── affiliation.css │ │ │ ├── checkout.css │ │ │ ├── clone-resolution.css │ │ │ ├── common.css │ │ │ ├── connect.css │ │ │ ├── debug.css │ │ │ ├── dialog-boxes.css │ │ │ ├── gdpr-optin-notice.css │ │ │ ├── index.php │ │ │ ├── optout.css │ │ │ └── plugins.css │ │ ├── customizer.css │ │ └── index.php │ ├── img │ │ ├── index.php │ │ ├── plugin-icon.png │ │ └── theme-icon.png │ ├── index.php │ └── js │ │ ├── index.php │ │ ├── jquery.form.js │ │ ├── nojquery.ba-postmessage.js │ │ ├── postmessage.js │ │ └── pricing │ │ ├── 14fb1bd5b7c41648488b06147f50a0dc.svg │ │ ├── 178afa6030e76635dbe835e111d2c507.png │ │ ├── 27b5a722a5553d9de0170325267fccec.png │ │ ├── 4375c4a3ddc6f637c2ab9a2d7220f91e.png │ │ ├── 4529cac82a2d1f300d3c4702b7b5e8f3.svg │ │ ├── 5480ed23b199531a8cbc05924f26952b.png │ │ ├── b4f3b958f4a019862d81b15f3f8eee3a.svg │ │ ├── c03f665db27af43971565560adfba594.png │ │ ├── cb5fc4f6ec7ada72e986f6e7dde365bf.png │ │ ├── dd89563360f0272635c8f0ab7d7f1402.png │ │ ├── e366d70661d8ad2493bd6afbd779f125.png │ │ ├── f18006f6535a1a6e9c6bfbffafe6f18a.svg │ │ ├── f3aac72a8e63997d6bb888f816457e9b.png │ │ ├── f928f1be99776af83e8e6be4baf8ffe7.svg │ │ ├── fde48e4609a6ddc11d639fc2421f2afd.png │ │ ├── freemius-pricing.js │ │ └── freemius-pricing.js.LICENSE.txt ├── config.php ├── includes │ ├── class-freemius-abstract.php │ ├── class-freemius.php │ ├── class-fs-admin-notices.php │ ├── class-fs-api.php │ ├── class-fs-garbage-collector.php │ ├── class-fs-lock.php │ ├── class-fs-logger.php │ ├── class-fs-options.php │ ├── class-fs-plugin-updater.php │ ├── class-fs-security.php │ ├── class-fs-storage.php │ ├── class-fs-user-lock.php │ ├── customizer │ │ ├── class-fs-customizer-support-section.php │ │ ├── class-fs-customizer-upsell-control.php │ │ └── index.php │ ├── debug │ │ ├── class-fs-debug-bar-panel.php │ │ ├── debug-bar-start.php │ │ └── index.php │ ├── entities │ │ ├── class-fs-affiliate-terms.php │ │ ├── class-fs-affiliate.php │ │ ├── class-fs-billing.php │ │ ├── class-fs-entity.php │ │ ├── class-fs-payment.php │ │ ├── class-fs-plugin-info.php │ │ ├── class-fs-plugin-license.php │ │ ├── class-fs-plugin-plan.php │ │ ├── class-fs-plugin-tag.php │ │ ├── class-fs-plugin.php │ │ ├── class-fs-pricing.php │ │ ├── class-fs-scope-entity.php │ │ ├── class-fs-site.php │ │ ├── class-fs-subscription.php │ │ ├── class-fs-user.php │ │ └── index.php │ ├── fs-core-functions.php │ ├── fs-essential-functions.php │ ├── fs-html-escaping-functions.php │ ├── fs-plugin-info-dialog.php │ ├── index.php │ ├── l10n.php │ ├── managers │ │ ├── class-fs-admin-menu-manager.php │ │ ├── class-fs-admin-notice-manager.php │ │ ├── class-fs-cache-manager.php │ │ ├── class-fs-checkout-manager.php │ │ ├── class-fs-clone-manager.php │ │ ├── class-fs-contact-form-manager.php │ │ ├── class-fs-debug-manager.php │ │ ├── class-fs-gdpr-manager.php │ │ ├── class-fs-key-value-storage.php │ │ ├── class-fs-license-manager.php │ │ ├── class-fs-option-manager.php │ │ ├── class-fs-permission-manager.php │ │ ├── class-fs-plan-manager.php │ │ ├── class-fs-plugin-manager.php │ │ └── index.php │ ├── sdk │ │ ├── Exceptions │ │ │ ├── ArgumentNotExistException.php │ │ │ ├── EmptyArgumentException.php │ │ │ ├── Exception.php │ │ │ ├── InvalidArgumentException.php │ │ │ ├── OAuthException.php │ │ │ └── index.php │ │ ├── FreemiusBase.php │ │ ├── FreemiusWordPress.php │ │ ├── LICENSE.txt │ │ └── index.php │ └── supplements │ │ ├── fs-essential-functions-1.1.7.1.php │ │ ├── fs-essential-functions-2.2.1.php │ │ ├── fs-migration-2.5.1.php │ │ └── index.php ├── index.php ├── languages │ ├── freemius-cs_CZ.mo │ ├── freemius-da_DK.mo │ ├── freemius-de_DE.mo │ ├── freemius-es_ES.mo │ ├── freemius-fr_FR.mo │ ├── freemius-he_IL.mo │ ├── freemius-hu_HU.mo │ ├── freemius-it_IT.mo │ ├── freemius-ja.mo │ ├── freemius-nl_NL.mo │ ├── freemius-ru_RU.mo │ ├── freemius-ta.mo │ ├── freemius-zh_CN.mo │ ├── freemius.pot │ └── index.php ├── require.php ├── start.php └── templates │ ├── account.php │ ├── account │ ├── billing.php │ ├── index.php │ ├── partials │ │ ├── activate-license-button.php │ │ ├── addon.php │ │ ├── deactivate-license-button.php │ │ ├── disconnect-button.php │ │ ├── index.php │ │ └── site.php │ └── payments.php │ ├── add-ons.php │ ├── add-trial-to-pricing.php │ ├── admin-notice.php │ ├── ajax-loader.php │ ├── api-connectivity-message-js.php │ ├── auto-installation.php │ ├── checkout.php │ ├── checkout │ ├── frame.php │ ├── process-redirect.php │ └── redirect.php │ ├── clone-resolution-js.php │ ├── connect.php │ ├── connect │ ├── index.php │ ├── permission.php │ └── permissions-group.php │ ├── contact.php │ ├── debug.php │ ├── debug │ ├── api-calls.php │ ├── index.php │ ├── logger.php │ ├── plugins-themes-sync.php │ └── scheduled-crons.php │ ├── email.php │ ├── forms │ ├── affiliation.php │ ├── data-debug-mode.php │ ├── deactivation │ │ ├── contact.php │ │ ├── form.php │ │ ├── index.php │ │ └── retry-skip.php │ ├── email-address-update.php │ ├── index.php │ ├── license-activation.php │ ├── optout.php │ ├── premium-versions-upgrade-handler.php │ ├── premium-versions-upgrade-metadata.php │ ├── resend-key.php │ ├── subscription-cancellation.php │ ├── trial-start.php │ └── user-change.php │ ├── gdpr-optin-js.php │ ├── index.php │ ├── js │ ├── index.php │ ├── jquery.content-change.php │ ├── open-license-activation.php │ ├── permissions.php │ └── style-premium-theme.php │ ├── partials │ ├── index.php │ └── network-activation.php │ ├── plugin-icon.php │ ├── plugin-info │ ├── description.php │ ├── features.php │ ├── index.php │ └── screenshots.php │ ├── pricing.php │ ├── secure-https-header.php │ ├── sticky-admin-notice-js.php │ ├── tabs-capture-js.php │ └── tabs.php ├── includes ├── admin │ ├── class-activator.php │ ├── class-admin-notices.php │ ├── class-admin.php │ ├── class-dashboard-widgets.php │ ├── class-dashboard.php │ ├── class-statistics-table.php │ ├── class-statistics.php │ ├── class-tools-page.php │ ├── class-upgrader.php │ ├── css │ │ ├── better-search-admin.css │ │ ├── better-search-admin.min.css │ │ └── images │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ ├── ui-icons_454545_256x240.png │ │ │ ├── ui-icons_888888_256x240.png │ │ │ └── ui-icons_cd0a0a_256x240.png │ ├── images │ │ ├── better-search-pro-banner.png │ │ ├── bsearch-icon.png │ │ ├── fb.png │ │ ├── index.php │ │ ├── support.webp │ │ └── x.png │ ├── js │ │ ├── admin-scripts.js │ │ ├── admin-scripts.min.js │ │ ├── chart-data.js │ │ ├── chart-data.min.js │ │ ├── chart.min.js │ │ ├── chartjs-adapter-luxon.js │ │ ├── chartjs-adapter-luxon.min.js │ │ ├── chartjs-plugin-datalabels.min.js │ │ ├── index.php │ │ ├── luxon.js │ │ └── luxon.min.js │ ├── network │ │ └── class-admin.php │ └── settings │ │ ├── class-metabox-api.php │ │ ├── class-settings-api.php │ │ ├── class-settings-form.php │ │ ├── class-settings-sanitize.php │ │ ├── class-settings.php │ │ ├── js │ │ ├── apply-codemirror.js │ │ ├── apply-codemirror.min.js │ │ ├── index.php │ │ ├── media-selector.js │ │ ├── media-selector.min.js │ │ ├── settings-admin-scripts.js │ │ ├── settings-admin-scripts.min.js │ │ ├── taxonomy-suggest.js │ │ └── taxonomy-suggest.min.js │ │ └── sidebar.php ├── autoloader.php ├── class-better-search-core-query.php ├── class-better-search-query.php ├── class-main.php ├── class-tracker.php ├── css │ ├── bsearch-live-search.css │ ├── bsearch-live-search.min.css │ ├── bsearch-styles-min.css │ ├── bsearch-styles.css │ ├── bsearch-styles.min.css │ └── index.php ├── frontend │ ├── block-patterns │ │ ├── search-form.php │ │ ├── search-results.php │ │ └── template-query-loop-news-blog.php │ ├── class-display.php │ ├── class-language-handler.php │ ├── class-live-search.php │ ├── class-media-handler.php │ ├── class-shortcodes.php │ ├── class-styles-handler.php │ ├── class-template-handler.php │ └── widgets │ │ ├── class-search-box.php │ │ └── class-search-heatmap.php ├── functions.php ├── general-template.php ├── heatmap.php ├── js │ ├── better-search-live-search.js │ ├── better-search-live-search.min.js │ ├── better-search-tracker.js │ ├── better-search-tracker.min.js │ └── index.php ├── load-freemius.php ├── options-api.php └── util │ ├── class-cache.php │ └── class-helpers.php ├── index.php ├── languages ├── better-search-en_US.mo ├── better-search-en_US.po ├── better-search-en_US.pot └── index.php ├── package.json ├── phpcs.xml.dist ├── phpstan-baseline.neon ├── phpstan.neon.dist ├── phpunit.xml.dist ├── phpunit ├── bootstrap.php ├── install.sh └── tests │ └── test-sample.php ├── readme.txt ├── security.md ├── templates ├── better-search-template.html ├── better-search-template.php └── index.php ├── uninstaller.php ├── wpml-config.xml └── wporg-assets ├── banner-1544x500.png ├── banner-772x250.png ├── icon-128x128.png ├── icon-256x256.png ├── screenshot-1.png ├── screenshot-2.png └── screenshot-3.png /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/cs.yml: -------------------------------------------------------------------------------- 1 | name: Coding Standards 2 | 3 | on: 4 | # Run on all pushes and on all pull requests. 5 | # Prevent the build from running when there are only irrelevant changes. 6 | push: 7 | paths-ignore: 8 | - '**.md' 9 | - '**.txt' 10 | pull_request: 11 | paths-ignore: 12 | - '**.md' 13 | - '**.txt' 14 | # Allow manually triggering the workflow. 15 | workflow_dispatch: 16 | 17 | jobs: 18 | checkcs: 19 | name: 'PHPCS check' 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - name: Checkout code 24 | uses: actions/checkout@v4 25 | 26 | - name: Install PHP 27 | uses: shivammathur/setup-php@v2 28 | with: 29 | php-version: '7.4' 30 | tools: cs2pr 31 | coverage: none 32 | 33 | - name: 'Composer: set up PHPCS dependencies' 34 | run: | 35 | composer require --no-update squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer 36 | composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true 37 | 38 | # Install dependencies and handle caching in one go. 39 | # @link https://github.com/marketplace/actions/install-composer-dependencies 40 | - name: Install Composer dependencies 41 | uses: "ramsey/composer-install@v2" 42 | 43 | - name: 'Run Composer Update' 44 | run: | 45 | composer update 46 | 47 | # Check the code-style consistency of the PHP files. 48 | - name: Check PHP code style 49 | continue-on-error: true 50 | run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml 51 | 52 | - name: Show PHPCS results in PR 53 | run: cs2pr --graceful-warnings ./phpcs-report.xml 54 | -------------------------------------------------------------------------------- /.github/workflows/zipitup.yml: -------------------------------------------------------------------------------- 1 | # GitHub Action: whenever creating a new release of the source code, 2 | # also create a release of the installable plugin. 3 | # Steps to execute: 4 | # - Checkout the source code 5 | # - Run "composer install" to download all dependencies under vendor/ 6 | # - Create a .zip file, excluding: 7 | # - All hidden files (.git, .gitignore, etc) 8 | # - All development files, ending in .dist 9 | # - All composer files <= after installing dependencies, no need for them anymore 10 | # - Markdown files concerning development 11 | # - Folder build/ <= created only to store the .zip file 12 | # - Folder dev-helpers/ <= not needed for the plugin 13 | # - Upload the .zip file as an artifact to the action (this step is possibly optional) 14 | # - Upload the .zip file as a release, for download 15 | name: Generate Installable Plugin, and Upload as Release Asset 16 | on: 17 | release: 18 | types: [published] 19 | jobs: 20 | build: 21 | name: Upload Release Asset 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Checkout code 25 | uses: actions/checkout@v4 26 | - name: Build project 27 | run: | 28 | mkdir build 29 | - name: Create artifact 30 | uses: montudor/action-zip@v1 31 | with: 32 | args: zip -X -r build/${{ github.event.repository.name }}.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.yml *.neon composer.* package.json dev-helpers** build** wporg-assets** phpunit** 33 | - name: Upload artifact 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: ${{ github.event.repository.name }} 37 | path: build/${{ github.event.repository.name }}.zip 38 | - name: Upload to release 39 | uses: JasonEtco/upload-to-release@master 40 | with: 41 | args: build/${{ github.event.repository.name }}.zip application/zip 42 | env: 43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 44 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webberzone/better-search", 3 | "description": "Better Search replaces the default WordPress search with a better search engine that gives contextual results sorted by relevance", 4 | "type": "wordpress-plugin", 5 | "keywords": [ 6 | "search", 7 | "better search", 8 | "relevant search", 9 | "search results", 10 | "fulltext search" 11 | ], 12 | "license": "gpl-2.0-or-later", 13 | "authors": [ 14 | { 15 | "name": "WebberZone", 16 | "role": "Developer" 17 | } 18 | ], 19 | "require": { 20 | "php": ">=7.4" 21 | }, 22 | "require-dev": { 23 | "szepeviktor/phpstan-wordpress": "^1", 24 | "phpstan/extension-installer": "^1", 25 | "phpstan/phpstan": "^1", 26 | "php-stubs/wordpress-stubs": "^6", 27 | "wp-coding-standards/wpcs": "^3", 28 | "dealerdirect/phpcodesniffer-composer-installer": "^1", 29 | "phpcompatibility/phpcompatibility-wp": "^2", 30 | "yoast/phpunit-polyfills": "^3", 31 | "phpunit/phpunit": "^5.7.21 || ^6.5 || ^7.5 || ^8" 32 | }, 33 | "config": { 34 | "allow-plugins": { 35 | "phpstan/extension-installer": true, 36 | "dealerdirect/phpcodesniffer-composer-installer": true 37 | } 38 | }, 39 | "scripts": { 40 | "phpstan": "vendor/bin/phpstan analyse --memory-limit=2048M", 41 | "phpstan-baseline": "vendor/bin/phpstan analyse --memory-limit=2048M --generate-baseline", 42 | "phpcs": "vendor/bin/phpcs -p -v -s --standard=phpcs.xml.dist $(find . -name '*.php')", 43 | "phpcbf": "vendor/bin/phpcbf -p -v -s --standard=phpcs.xml.dist $(find . -name '*.php')" 44 | } 45 | } -------------------------------------------------------------------------------- /freemius/assets/css/admin/affiliation.css: -------------------------------------------------------------------------------- 1 | #fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;margin-left:0;padding:0}#fs_affiliation_content_wrapper ul li{box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:"✓";font-weight:700;margin-right:10px}#fs_affiliation_content_wrapper label,#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper p:not(.description){font-size:16px!important;line-height:26px!important}#fs_affiliation_content_wrapper .button{font-size:16px;height:40px;line-height:35px;margin-bottom:7px;margin-top:20px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{display:block;font-weight:700;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{display:inline-block;margin-top:3px;text-decoration:none}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0} -------------------------------------------------------------------------------- /freemius/assets/css/admin/checkout.css: -------------------------------------------------------------------------------- 1 | .fs-ajax-loader{height:20px;margin:auto;position:relative;width:170px}.fs-ajax-loader .fs-ajax-loader-bar{animation-direction:normal;animation-duration:1.5s;animation-iteration-count:infinite;animation-name:bounce_ajaxLoader;background-color:#fff;height:20px;position:absolute;top:0;transform:scale(.3);width:20px}.fs-ajax-loader .fs-ajax-loader-bar-1{animation-delay:.6s;left:0}.fs-ajax-loader .fs-ajax-loader-bar-2{animation-delay:.75s;left:19px}.fs-ajax-loader .fs-ajax-loader-bar-3{animation-delay:.9s;left:38px}.fs-ajax-loader .fs-ajax-loader-bar-4{animation-delay:1.05s;left:57px}.fs-ajax-loader .fs-ajax-loader-bar-5{animation-delay:1.2s;left:76px}.fs-ajax-loader .fs-ajax-loader-bar-6{animation-delay:1.35s;left:95px}.fs-ajax-loader .fs-ajax-loader-bar-7{animation-delay:1.5s;left:114px}.fs-ajax-loader .fs-ajax-loader-bar-8{animation-delay:1.65s;left:133px}@keyframes bounce_ajaxLoader{0%{background-color:#0074a3;transform:scale(1)}to{background-color:#fff;transform:scale(.3)}}@media screen and (max-width:782px){#wpbody-content{padding-bottom:0!important}}.fs-checkout-process-redirect{padding:40px;text-align:center} -------------------------------------------------------------------------------- /freemius/assets/css/admin/clone-resolution.css: -------------------------------------------------------------------------------- 1 | .fs-notice[data-id^=clone_resolution_options_notice]{color:inherit!important;padding:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-body{margin-bottom:0;padding:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-header{padding:5px 10px}.fs-notice[data-id^=clone_resolution_options_notice] ol{margin-bottom:0;margin-top:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{display:flex;flex-direction:row;padding:0 10px 10px}@media(max-width:750px){.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{flex-direction:column}}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option{border:1px solid #ccc;flex:auto;margin:5px;padding:10px 10px 15px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:first-child{margin-left:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:last-child{margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option strong{font-size:1.2em;line-height:1.5em;padding:2px}.fs-notice[data-id^=clone_resolution_options_notice] a{text-decoration:none}.fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:10px}.rtl .fs-notice[data-id^=clone_resolution_options_notice] .button{margin-left:10px;margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-documentation-container{padding:0 10px 15px}.fs-notice[data-id=temporary_duplicate_notice] #fs_clone_resolution_error_message{background:#fee;border:1px solid #d3135a;color:#d3135a;padding:10px}.fs-notice[data-id=temporary_duplicate_notice] ol{margin-top:0}.fs-notice[data-id=temporary_duplicate_notice] a{position:relative}.fs-notice[data-id=temporary_duplicate_notice] a:focus{box-shadow:none}.fs-notice[data-id=temporary_duplicate_notice] a.disabled{color:gray}.fs-notice[data-id=temporary_duplicate_notice] a .fs-ajax-spinner{bottom:0;left:8px;margin-left:100%;position:absolute;right:0;top:-1px} -------------------------------------------------------------------------------- /freemius/assets/css/admin/debug.css: -------------------------------------------------------------------------------- 1 | label.fs-tag,span.fs-tag{background:#ffba00;border-radius:3px;color:#fff;display:inline-block;font-size:11px;line-height:11px;padding:5px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}.fs-debug-table-toggle-button{background:transparent;border:none;cursor:pointer;font-size:1.2em}.fs-debug-table{overflow:hidden}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:700}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac!important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be} -------------------------------------------------------------------------------- /freemius/assets/css/admin/gdpr-optin-notice.css: -------------------------------------------------------------------------------- 1 | .fs-notice[data-id^=gdpr_optin_actions] .underlined{text-decoration:underline}.fs-notice[data-id^=gdpr_optin_actions] ul .action-description,.fs-notice[data-id^=gdpr_optin_actions] ul .button{vertical-align:middle}.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{display:inline-block;margin-left:3px} -------------------------------------------------------------------------------- /freemius/assets/css/admin/index.php: -------------------------------------------------------------------------------- 1 | i.dashicons{float:left;font-size:30px;height:30px;padding:5px;width:30px}.fs-permissions ul li .fs-switch{float:right}.fs-permissions ul li .fs-permission-description{margin-left:55px}.fs-permissions ul li .fs-permission-description span{color:#23282d;font-size:14px;font-weight:500}.fs-permissions ul li .fs-permission-description .fs-tooltip{font-size:13px;font-weight:700}.fs-permissions ul li .fs-permission-description .fs-tooltip-trigger .dashicons{margin:-1px 2px 0}.fs-permissions ul li .fs-permission-description p{margin:2px 0 0}.fs-permissions.fs-open{background:#fff}.fs-permissions.fs-open ul{height:auto;margin:20px 0 10px;overflow:initial}.fs-permissions .fs-switch-feedback .fs-ajax-spinner{margin-right:10px}.fs-permissions .fs-switch-feedback.success{color:#71ae00}.rtl .fs-permissions .fs-switch-feedback{left:15px;right:auto}.rtl .fs-permissions .fs-switch-feedback .fs-ajax-spinner{margin-left:10px;margin-right:0}.rtl .fs-permissions ul li .fs-permission-description{margin-left:0;margin-right:55px}.rtl .fs-permissions ul li .fs-switch{float:left}.rtl .fs-permissions ul li i.dashicons{float:right}.fs-modal-opt-out .fs-modal-footer .fs-opt-out-button{line-height:30px;margin-right:10px}.fs-modal-opt-out .fs-permissions{margin-top:0!important}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-group-opt-out-button{float:right;line-height:1.1em}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-switch-feedback{float:right;line-height:1.1em;margin-right:10px}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-switch-feedback .fs-ajax-spinner{margin:-2px 0 0}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header-title{display:block;font-size:1.1em;font-weight:600;line-height:1.1em;margin:.5em 0;text-transform:uppercase}.fs-modal-opt-out .fs-permissions .fs-permissions-section--desc{margin-top:0}.fs-modal-opt-out .fs-permissions hr{border:0;border-top:1px solid #eee;margin:25px 0 20px}.fs-modal-opt-out .fs-permissions ul{border:1px solid #c3c4c7;border-radius:3px;box-shadow:0 1px 1px rgba(0,0,0,.04);margin:10px 0 0}.fs-modal-opt-out .fs-permissions ul li{border-bottom:1px solid #d7dde1;border-left:4px solid #72aee6}.rtl .fs-modal-opt-out .fs-permissions ul li{border-left:none;border-right:4px solid #72aee6}.fs-modal-opt-out .fs-permissions ul li.fs-disabled{border-left-color:rgba(114,174,230,0)}.fs-modal-opt-out .fs-permissions ul li:last-child{border-bottom:none} -------------------------------------------------------------------------------- /freemius/assets/css/admin/plugins.css: -------------------------------------------------------------------------------- 1 | label.fs-tag,span.fs-tag{background:#ffba00;border-radius:3px;color:#fff;display:inline-block;font-size:11px;line-height:11px;padding:5px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.wp-list-table.plugins .plugin-title span.fs-tag{display:inline-block;line-height:10px;margin-left:5px} -------------------------------------------------------------------------------- /freemius/assets/css/customizer.css: -------------------------------------------------------------------------------- 1 | #fs_customizer_upsell .fs-customizer-plan{background:#fff;border-radius:3px;padding:10px 20px 20px}#fs_customizer_upsell .fs-customizer-plan h2{line-height:2em;margin:0;position:relative;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;margin-left:-7px;margin-right:10px;vertical-align:bottom}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{background:#000;border-radius:5px;bottom:100%;box-shadow:1px 1px 1px rgba(0,0,0,.2);color:#fff;font-family:arial,serif;font-size:12px;font-weight:700;left:0;line-height:1.3em;margin-bottom:5px;opacity:0;padding:10px;position:absolute;right:0;text-align:left;transition:opacity .3s ease-in-out;visibility:hidden;z-index:999999}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc:after{border-color:#000 transparent transparent;border-style:solid;border-width:5px 5px 0;content:" ";display:block;height:0;left:21px;position:absolute;top:100%;width:0}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc:after{left:auto;right:21px}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{opacity:1;visibility:visible}#fs_customizer_upsell .button-primary{display:block;margin-top:10px;text-align:center}#fs_customizer_support{display:block!important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{display:block;margin-top:10px;width:100%}#fs_customizer_support .button-group .button{float:none;text-align:center;width:50%}#customize-theme-controls #accordion-section-freemius_upsell{border-bottom:1px solid #0085ba!important;border-top:1px solid #0085ba!important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{background-color:#0085ba;border-bottom:none!important;border-left:4px solid #0085ba;color:#fff;outline:none;transition:background-color .15s ease-in-out,border-color .15s ease-in-out}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa} -------------------------------------------------------------------------------- /freemius/assets/css/index.php: -------------------------------------------------------------------------------- 1 | ").attr({method:t,action:r}).css({display:"none"}),a=function(r,e){if(n.isArray(e))for(var t=0;t").attr({type:"hidden",name:String(r),value:String(e)}))};for(var i in e)e.hasOwnProperty(i)&&a(i,e[i]);return o.appendTo("body")}})}(jQuery); -------------------------------------------------------------------------------- /freemius/assets/js/nojquery.ba-postmessage.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery postMessage - v0.5 - 9/11/2009 3 | * http://benalman.com/projects/jquery-postmessage-plugin/ 4 | * 5 | * Copyright (c) 2009 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | * 9 | * Non-jQuery fork by Jeff Lee 10 | * 11 | * This fork consists of the following changes: 12 | * 1. Basic code cleanup and restructuring, for legibility. 13 | * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily, 14 | * in terms of both function names and object scope. Scope is specified by 15 | * the the "this" context of NoJQueryPostMessageMixin(); 16 | * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were 17 | * at least three different GitHub users requesting the removal of this 18 | * "Opera sniff" on the original project's Issues page, so I figured this 19 | * would be a relatively safe change. 20 | * 4. `postMessage` no longer uses `$.param` to serialize messages that are not 21 | * strings. I actually prefer this structure anyway. `receiveMessage` does 22 | * not implement a corresponding deserialization step, and as such it seems 23 | * cleaner and more symmetric to leave both data serialization and 24 | * deserialization to the client. 25 | * 5. The use of `$.isFunction` is replaced by a functionally-identical check. 26 | * 6. The `$:nomunge` YUI option is no longer necessary. 27 | */ 28 | function NoJQueryPostMessageMixin(n,e){var t,i,o,s,a,r=1;return window.postMessage?(window.addEventListener?(t=function(n){window.addEventListener("message",n,!1)},i=function(n){window.removeEventListener("message",n,!1)}):(t=function(n){window.attachEvent("onmessage",n)},i=function(n){window.detachEvent("onmessage",n)}),this[n]=function(n,e,t){e&&t.postMessage(n,e.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))},this[e]=function(n,e,s){if(o&&(i(o),o=null),!n)return!1;o=t((function(t){switch(Object.prototype.toString.call(e)){case"[object String]":if(e!==t.origin)return!1;break;case"[object Function]":if(e(t.origin))return!1}n(t)}))}):(this[n]=function(n,e,t){e&&(t.location=e.replace(/#.*$/,"")+"#"+ +new Date+r+++"&"+n)},this[e]=function(n,e,t){s&&(clearInterval(s),s=null),n&&(t="number"==typeof e?e:"number"==typeof t?t:100,s=setInterval((function(){var e=document.location.hash,t=/^#?\d+&/;e!==a&&t.test(e)&&(a=e,n({data:e.replace(t,"")}))}),t))}),this} -------------------------------------------------------------------------------- /freemius/assets/js/postmessage.js: -------------------------------------------------------------------------------- 1 | !function(t,e){var s,n,o,i,r,a,c,p,u=this;u.FS=u.FS||{},u.FS.PostMessage=(n=new NoJQueryPostMessageMixin("postMessage","receiveMessage"),o={},i=decodeURIComponent(document.location.hash.replace(/^#/,"")),r=i.substring(0,i.indexOf("/","https://"===i.substring(0,8)?8:7)),a=""!==i,c=t(window),p=t("html"),{init:function(t,e){s=t,n.receiveMessage((function(t){var e=JSON.parse(t.data);if(o[e.type])for(var s=0;s0&&c.on("scroll",(function(){for(var t=0;t 11 | * @license MIT 12 | */ 13 | 14 | /*! 15 | * Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com 16 | * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) 17 | * Copyright 2022 Fonticons, Inc. 18 | */ 19 | 20 | /** @license React v0.20.2 21 | * scheduler.production.min.js 22 | * 23 | * Copyright (c) Facebook, Inc. and its affiliates. 24 | * 25 | * This source code is licensed under the MIT license found in the 26 | * LICENSE file in the root directory of this source tree. 27 | */ 28 | 29 | /** @license React v17.0.2 30 | * react-dom.production.min.js 31 | * 32 | * Copyright (c) Facebook, Inc. and its affiliates. 33 | * 34 | * This source code is licensed under the MIT license found in the 35 | * LICENSE file in the root directory of this source tree. 36 | */ 37 | 38 | /** @license React v17.0.2 39 | * react.production.min.js 40 | * 41 | * Copyright (c) Facebook, Inc. and its affiliates. 42 | * 43 | * This source code is licensed under the MIT license found in the 44 | * LICENSE file in the root directory of this source tree. 45 | */ 46 | -------------------------------------------------------------------------------- /freemius/includes/class-fs-lock.php: -------------------------------------------------------------------------------- 1 | _lock_id = $lock_id; 38 | 39 | if ( ! isset( self::$_thread_id ) ) { 40 | self::$_thread_id = mt_rand( 0, 32000 ); 41 | } 42 | } 43 | 44 | /** 45 | * Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything. 46 | * 47 | * @param int $expiration 48 | * 49 | * @return bool TRUE if successfully acquired lock. 50 | */ 51 | function try_lock( $expiration = 0 ) { 52 | if ( $this->is_locked() ) { 53 | // Already locked. 54 | return false; 55 | } 56 | 57 | set_site_transient( $this->_lock_id, self::$_thread_id, $expiration ); 58 | 59 | if ( $this->has_lock() ) { 60 | $this->lock($expiration); 61 | 62 | return true; 63 | } 64 | 65 | return false; 66 | } 67 | 68 | /** 69 | * Acquire lock regardless if it's already acquired by another locker or not. 70 | * 71 | * @author Vova Feldman (@svovaf) 72 | * @since 2.1.0 73 | * 74 | * @param int $expiration 75 | */ 76 | function lock( $expiration = 0 ) { 77 | set_site_transient( $this->_lock_id, true, $expiration ); 78 | } 79 | 80 | /** 81 | * Checks if lock is currently acquired. 82 | * 83 | * @author Vova Feldman (@svovaf) 84 | * @since 2.1.0 85 | * 86 | * @return bool 87 | */ 88 | function is_locked() { 89 | return ( false !== get_site_transient( $this->_lock_id ) ); 90 | } 91 | 92 | /** 93 | * Unlock the lock. 94 | * 95 | * @author Vova Feldman (@svovaf) 96 | * @since 2.1.0 97 | */ 98 | function unlock() { 99 | delete_site_transient( $this->_lock_id ); 100 | } 101 | 102 | /** 103 | * Checks if lock is currently acquired by the current locker. 104 | * 105 | * @return bool 106 | */ 107 | protected function has_lock() { 108 | return ( self::$_thread_id == get_site_transient( $this->_lock_id ) ); 109 | } 110 | } -------------------------------------------------------------------------------- /freemius/includes/class-fs-security.php: -------------------------------------------------------------------------------- 1 | id . 60 | $entity->secret_key . 61 | $entity->public_key . 62 | $action 63 | ); 64 | } 65 | 66 | /** 67 | * @param \FS_Scope_Entity $entity 68 | * @param int|bool $timestamp 69 | * @param string $action 70 | * 71 | * @return array 72 | */ 73 | function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) { 74 | if ( false === $timestamp ) { 75 | $timestamp = time(); 76 | } 77 | 78 | return array( 79 | 's_ctx_type' => $entity->get_type(), 80 | 's_ctx_id' => $entity->id, 81 | 's_ctx_ts' => $timestamp, 82 | 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ), 83 | ); 84 | } 85 | 86 | /** 87 | * Gets a sandbox trial token for a given plugin, plan, and trial timestamp. 88 | * 89 | * @param FS_Plugin $plugin 90 | * @param FS_Plugin_Plan $plan 91 | * @param int $trial_timestamp 92 | * 93 | * @return string 94 | */ 95 | function get_trial_token( FS_Plugin $plugin, FS_Plugin_Plan $plan, $trial_timestamp ) { 96 | return md5( 97 | $plugin->secret_key . $plugin->public_key . 98 | $plan->trial_period . 99 | $plan->id . 100 | $trial_timestamp 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /freemius/includes/class-fs-user-lock.php: -------------------------------------------------------------------------------- 1 | _lock = new FS_Lock( "locked_{$current_user_id}" ); 53 | } 54 | 55 | /** 56 | * Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything. 57 | * 58 | * @author Vova Feldman (@svovaf) 59 | * @since 2.1.0 60 | * 61 | * @param int $expiration 62 | * 63 | * @return bool TRUE if successfully acquired lock. 64 | */ 65 | function try_lock( $expiration = 0 ) { 66 | return $this->_lock->try_lock( $expiration ); 67 | } 68 | 69 | /** 70 | * Acquire lock regardless if it's already acquired by another locker or not. 71 | * 72 | * @author Vova Feldman (@svovaf) 73 | * @since 2.1.0 74 | * 75 | * @param int $expiration 76 | */ 77 | function lock( $expiration = 0 ) { 78 | $this->_lock->lock( $expiration ); 79 | } 80 | 81 | /** 82 | * Unlock the lock. 83 | * 84 | * @author Vova Feldman (@svovaf) 85 | * @since 2.1.0 86 | */ 87 | function unlock() { 88 | $this->_lock->unlock(); 89 | } 90 | } -------------------------------------------------------------------------------- /freemius/includes/customizer/class-fs-customizer-support-section.php: -------------------------------------------------------------------------------- 1 | register_section_type( 'FS_Customizer_Support_Section' ); 23 | 24 | parent::__construct( $manager, $id, $args ); 25 | } 26 | 27 | /** 28 | * The type of customize section being rendered. 29 | * 30 | * @since 1.0.0 31 | * @access public 32 | * @var string 33 | */ 34 | public $type = 'freemius-support-section'; 35 | 36 | /** 37 | * @var Freemius 38 | */ 39 | public $fs = null; 40 | 41 | /** 42 | * Add custom parameters to pass to the JS via JSON. 43 | * 44 | * @since 1.0.0 45 | */ 46 | public function json() { 47 | $json = parent::json(); 48 | 49 | $is_contact_visible = $this->fs->is_page_visible( 'contact' ); 50 | $is_support_visible = $this->fs->is_page_visible( 'support' ); 51 | 52 | $json['theme_title'] = $this->fs->get_plugin_name(); 53 | 54 | if ( $is_contact_visible && $is_support_visible ) { 55 | $json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' ); 56 | } 57 | 58 | if ( $is_contact_visible ) { 59 | $json['contact'] = array( 60 | 'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ), 61 | 'url' => $this->fs->contact_url(), 62 | ); 63 | } 64 | 65 | if ( $is_support_visible ) { 66 | $json['support'] = array( 67 | 'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ), 68 | 'url' => $this->fs->get_support_forum_url() 69 | ); 70 | } 71 | 72 | return $json; 73 | } 74 | 75 | /** 76 | * Outputs the Underscore.js template. 77 | * 78 | * @since 1.0.0 79 | */ 80 | protected function render_template() { 81 | ?> 82 |
  • 84 |

    85 | {{ data.theme_title }} 86 | <# if ( data.contact && data.support ) { #> 87 |
    88 | <# } #> 89 | <# if ( data.contact ) { #> 90 | {{ data.contact.label }} 91 | <# } #> 92 | <# if ( data.support ) { #> 93 | {{ data.support.label }} 94 | <# } #> 95 | <# if ( data.contact && data.support ) { #> 96 |
    97 | <# } #> 98 |

    99 |
  • 100 | title( 'Freemius' ); // @phpstan-ignore-line 27 | } 28 | 29 | public static function requests_count() { 30 | if ( class_exists( 'Freemius_Api_WordPress' ) ) { 31 | $logger = Freemius_Api_WordPress::GetLogger(); 32 | } else { 33 | $logger = array(); 34 | } 35 | 36 | return number_format( count( $logger ) ); 37 | } 38 | 39 | public static function total_time() { 40 | if ( class_exists( 'Freemius_Api_WordPress' ) ) { 41 | $logger = Freemius_Api_WordPress::GetLogger(); 42 | } else { 43 | $logger = array(); 44 | } 45 | 46 | $total_time = .0; 47 | foreach ( $logger as $l ) { 48 | $total_time += $l['total']; 49 | } 50 | 51 | return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' ); 52 | } 53 | 54 | public function render() { 55 | ?> 56 |
    57 | 58 |
    59 | 60 |
    61 | 62 |
    63 | 64 |
    65 | status ); 47 | } 48 | 49 | /** 50 | * @author Leo Fajardo 51 | * 52 | * @return bool 53 | */ 54 | function is_pending() { 55 | return ( 'pending' === $this->status ); 56 | } 57 | 58 | /** 59 | * @author Leo Fajardo 60 | * 61 | * @return bool 62 | */ 63 | function is_suspended() { 64 | return ( 'suspended' === $this->status ); 65 | } 66 | 67 | /** 68 | * @author Leo Fajardo 69 | * 70 | * @return bool 71 | */ 72 | function is_rejected() { 73 | return ( 'rejected' === $this->status ); 74 | } 75 | 76 | /** 77 | * @author Leo Fajardo 78 | * 79 | * @return bool 80 | */ 81 | function is_blocked() { 82 | return ( 'blocked' === $this->status ); 83 | } 84 | } -------------------------------------------------------------------------------- /freemius/includes/entities/class-fs-billing.php: -------------------------------------------------------------------------------- 1 | release_mode ); 63 | } 64 | } -------------------------------------------------------------------------------- /freemius/includes/entities/class-fs-scope-entity.php: -------------------------------------------------------------------------------- 1 | is_beta ); 61 | } 62 | } 63 | 64 | function get_name() { 65 | return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) ); 66 | } 67 | 68 | function is_verified() { 69 | return ( isset( $this->is_verified ) && true === $this->is_verified ); 70 | } 71 | 72 | /** 73 | * @author Leo Fajardo (@leorw) 74 | * @since 2.4.2 75 | * 76 | * @return bool 77 | */ 78 | function is_beta() { 79 | // Return `false` since this is just for backward compatibility. 80 | return false; 81 | } 82 | 83 | static function get_type() { 84 | return 'user'; 85 | } 86 | } -------------------------------------------------------------------------------- /freemius/includes/entities/index.php: -------------------------------------------------------------------------------- 1 | 44 | */ 45 | public function get_query_params( Freemius $fs ) { 46 | $context_params = array( 47 | 'plugin_id' => $fs->get_id(), 48 | 'plugin_public_key' => $fs->get_public_key(), 49 | 'plugin_version' => $fs->get_plugin_version(), 50 | ); 51 | 52 | // Get site context secure params. 53 | if ( $fs->is_registered() ) { 54 | $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params( 55 | $fs->get_site(), 56 | time(), 57 | 'contact' 58 | ) ); 59 | } 60 | 61 | return array_merge( $_GET, array_merge( $context_params, array( 62 | 'plugin_version' => $fs->get_plugin_version(), 63 | 'wp_login_url' => wp_login_url(), 64 | 'site_url' => Freemius::get_unfiltered_site_url(), 65 | // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons", 66 | ) ) ); 67 | } 68 | 69 | /** 70 | * Retrieves the standalone link to the Freemius Contact Form. 71 | * 72 | * @param Freemius $fs 73 | * 74 | * @return string 75 | */ 76 | public function get_standalone_link( Freemius $fs ) { 77 | $query_params = $this->get_query_params( $fs ); 78 | 79 | $query_params['is_standalone'] = 'true'; 80 | $query_params['parent_url'] = admin_url( add_query_arg( null, null ) ); 81 | 82 | return WP_FS__ADDRESS . '/contact/?' . http_build_query( $query_params ); 83 | } 84 | } -------------------------------------------------------------------------------- /freemius/includes/managers/class-fs-license-manager.php: -------------------------------------------------------------------------------- 1 | get_slug() ); 24 | // 25 | // if ( ! isset( self::$_instances[ $slug ] ) ) { 26 | // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs ); 27 | // } 28 | // 29 | // return self::$_instances[ $slug ]; 30 | // } 31 | // 32 | //// private function __construct($slug) { 33 | //// parent::__construct($slug); 34 | //// } 35 | // 36 | // function entry_id() { 37 | // return 'licenses'; 38 | // } 39 | // 40 | // function sync( $id ) { 41 | // 42 | // } 43 | // 44 | // /** 45 | // * @author Vova Feldman (@svovaf) 46 | // * @since 1.0.5 47 | // * @uses FS_Api 48 | // * 49 | // * @param number|bool $plugin_id 50 | // * 51 | // * @return FS_Plugin_License[]|stdClass Licenses or API error. 52 | // */ 53 | // function api_get_user_plugin_licenses( $plugin_id = false ) { 54 | // $api = $this->_fs->get_api_user_scope(); 55 | // 56 | // if ( ! is_numeric( $plugin_id ) ) { 57 | // $plugin_id = $this->_fs->get_id(); 58 | // } 59 | // 60 | // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" ); 61 | // 62 | // if ( ! isset( $result->error ) ) { 63 | // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) { 64 | // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] ); 65 | // } 66 | // 67 | // $result = $result->licenses; 68 | // } 69 | // 70 | // return $result; 71 | // } 72 | // 73 | // function api_get_many() { 74 | // 75 | // } 76 | // 77 | // function api_activate( $id ) { 78 | // 79 | // } 80 | // 81 | // function api_deactivate( $id ) { 82 | // 83 | // } 84 | 85 | /** 86 | * @param FS_Plugin_License[] $licenses 87 | * 88 | * @return bool 89 | */ 90 | static function has_premium_license( $licenses ) { 91 | if ( is_array( $licenses ) ) { 92 | foreach ( $licenses as $license ) { 93 | /** 94 | * @var FS_Plugin_License $license 95 | */ 96 | if ( ! $license->is_utilized() && $license->is_features_enabled() ) { 97 | return true; 98 | } 99 | } 100 | } 101 | 102 | return false; 103 | } 104 | } -------------------------------------------------------------------------------- /freemius/includes/managers/index.php: -------------------------------------------------------------------------------- 1 | _result = $result; 23 | 24 | $code = 0; 25 | $message = 'Unknown error, please check GetResult().'; 26 | $type = ''; 27 | 28 | if ( isset( $result['error'] ) && is_array( $result['error'] ) ) { 29 | if ( isset( $result['error']['code'] ) ) { 30 | $code = $result['error']['code']; 31 | } 32 | if ( isset( $result['error']['message'] ) ) { 33 | $message = $result['error']['message']; 34 | } 35 | if ( isset( $result['error']['type'] ) ) { 36 | $type = $result['error']['type']; 37 | } 38 | } 39 | 40 | $this->_type = $type; 41 | $this->_code = $code; 42 | 43 | parent::__construct( $message, is_numeric( $code ) ? $code : 0 ); 44 | } 45 | 46 | /** 47 | * Return the associated result object returned by the API server. 48 | * 49 | * @return array The result from the API server 50 | */ 51 | public function getResult() { 52 | return $this->_result; 53 | } 54 | 55 | public function getStringCode() { 56 | return $this->_code; 57 | } 58 | 59 | public function getType() { 60 | return $this->_type; 61 | } 62 | 63 | /** 64 | * To make debugging easier. 65 | * 66 | * @return string The string representation of the error 67 | */ 68 | public function __toString() { 69 | $str = $this->getType() . ': '; 70 | 71 | if ( $this->code != 0 ) { 72 | $str .= $this->getStringCode() . ': '; 73 | } 74 | 75 | return $str . $this->getMessage(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /freemius/includes/sdk/Exceptions/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | $data ) { 35 | if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) . '/' ) ) ) { 36 | if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) { 37 | return $relative_path; 38 | } 39 | } 40 | } 41 | 42 | return null; 43 | } 44 | -------------------------------------------------------------------------------- /freemius/includes/supplements/fs-essential-functions-2.2.1.php: -------------------------------------------------------------------------------- 1 | $install ) { 21 | if ( true === $install->is_disconnected ) { 22 | $permission_manager->update_site_tracking( 23 | false, 24 | ( 0 == $blog_id ) ? null : $blog_id, 25 | // Update only if permissions are not yet set. 26 | true 27 | ); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /freemius/includes/supplements/index.php: -------------------------------------------------------------------------------- 1 | 35 |
    36 | 37 | 38 | 39 | 40 | 41 | 54 |
    -------------------------------------------------------------------------------- /freemius/templates/account/partials/deactivate-license-button.php: -------------------------------------------------------------------------------- 1 | 30 |
    31 | 32 | 33 | 34 | 35 | 36 |
    -------------------------------------------------------------------------------- /freemius/templates/account/partials/index.php: -------------------------------------------------------------------------------- 1 | get_slug(); 25 | 26 | ?> 27 |
    28 |
    29 |

    30 | 31 |
    32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | > 45 | 46 | 47 | 48 | 51 | 52 | 53 | 54 |
    id ?>created ) ) ?>formatted_gross() ?>is_migrated() ) : ?>
    55 |
    56 |
    57 |
    58 | 21 | -------------------------------------------------------------------------------- /freemius/templates/admin-notice.php: -------------------------------------------------------------------------------- 1 | 91 |
    > 92 | 93 | 96 | 97 | 98 | 99 |
    100 | 101 | 102 |
    103 | 104 | 105 |
    106 | 107 | 108 | 109 | 110 | 111 |
    112 |
    113 | -------------------------------------------------------------------------------- /freemius/templates/ajax-loader.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /freemius/templates/api-connectivity-message-js.php: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /freemius/templates/checkout.php: -------------------------------------------------------------------------------- 1 | is_premium() ) { 23 | fs_require_template( 'checkout/frame.php', $VARS ); 24 | } else { 25 | fs_require_template( 'checkout/redirect.php', $VARS ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /freemius/templates/checkout/redirect.php: -------------------------------------------------------------------------------- 1 | get_id(); 23 | } 24 | 25 | $plan_id = fs_request_get( 'plan_id' ); 26 | $licenses = fs_request_get( 'licenses' ); 27 | 28 | $query_params = $fs_checkout->get_query_params( 29 | $fs, 30 | $plugin_id, 31 | $plan_id, 32 | $licenses 33 | ); 34 | 35 | // The return URL is a special page which will process the result. 36 | $return_url = $fs_checkout->get_checkout_redirect_return_url( $fs ); 37 | $query_params['return_url'] = $return_url; 38 | 39 | // Add the cancel URL to the same pricing page the request originated from. 40 | $query_params['cancel_url'] = $fs->pricing_url( 41 | fs_request_get( 'billing_cycle', 'annual' ), 42 | fs_request_get_bool( 'trial' ) 43 | ); 44 | 45 | if ( has_site_icon() ) { 46 | $query_params['cancel_icon'] = get_site_icon_url(); 47 | } 48 | 49 | // If the user didn't connect his account with Freemius, 50 | // once he accepts the Terms of Service and Privacy Policy, 51 | // and then click the purchase button, the context information 52 | // of the user will be shared with Freemius in order to complete the 53 | // purchase workflow and activate the license for the right user. 54 | $install_data = array_merge( 55 | $fs->get_opt_in_params(), 56 | array( 57 | 'activation_url' => fs_nonce_url( 58 | $fs->_get_admin_page_url( 59 | '', 60 | array( 61 | 'fs_action' => $fs->get_unique_affix() . '_activate_new', 62 | 'plugin_id' => $plugin_id, 63 | ) 64 | ), 65 | $fs->get_unique_affix() . '_activate_new' 66 | ), 67 | ) 68 | ); 69 | $query_params['install_data'] = json_encode( $install_data ); 70 | 71 | $query_params['_fs_dashboard_independent'] = true; 72 | 73 | $redirect_url = $fs_checkout->get_full_checkout_url( $query_params ); 74 | 75 | if ( ! fs_redirect( $redirect_url ) ) { 76 | // The Header was sent, so the server redirect failed. Rely on JS instead. 77 | ?> 78 |
    79 |
    80 | 81 |
    82 | 83 |
    84 |

    85 | click here if you\'re stuck...' ), 88 | esc_url( $redirect_url ) 89 | ), 90 | array( 'a' => array( 'href' => true ) ) 91 | ); ?> 92 |

    93 |
    94 |
    95 | 101 | 29 |
  • 31 | 32 | 33 |
    34 |
    35 |
    36 | 37 | 38 |
    39 | class="fs-tooltip-trigger"> 40 | 41 |

    42 |
    43 |
  • -------------------------------------------------------------------------------- /freemius/templates/connect/permissions-group.php: -------------------------------------------------------------------------------- 1 | get_text_x_inline( 'Opt Out', 'verb', 'opt-out' ); 32 | $opt_in_text = $fs->get_text_x_inline( 'Opt In', 'verb', 'opt-in' ); 33 | 34 | if ( empty( $permission_group[ 'prompt' ] ) ) { 35 | $is_enabled = false; 36 | 37 | foreach ( $permission_group[ 'permissions' ] as $permission ) { 38 | if ( true === $permission[ 'default' ] ) { 39 | // Even if one of the permissions is on, treat as if the entire group is on. 40 | $is_enabled = true; 41 | break; 42 | } 43 | } 44 | } else { 45 | $is_enabled = ( isset( $permission_group['is_enabled'] ) && true === $permission_group['is_enabled'] ); 46 | } 47 | ?> 48 |
    49 |
    50 |
    51 | 56 | 60 |
    61 |

    65 |
      66 | render_permission( $permission ); 69 | } 70 | ?> 71 |
    72 |
    -------------------------------------------------------------------------------- /freemius/templates/debug/index.php: -------------------------------------------------------------------------------- 1 | 15 |

    16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 39 | > 42 | 43 | 44 | 45 | 46 | 57 | 62 | 63 | 64 | 65 | 66 |
    #
    .get_id() ?> 47 | %s', 50 | esc_html( substr( $log['msg'], 0, 32 ) ) . ( 32 < strlen( $log['msg'] ) ? '...' : '' ) 51 | ); 52 | ?> 53 |
    54 | 55 |
    56 |
    get_file() ) . ':' . $log['line']; 60 | } 61 | ?>
    -------------------------------------------------------------------------------- /freemius/templates/debug/plugins-themes-sync.php: -------------------------------------------------------------------------------- 1 | get_option( 'all_plugins' ); 15 | $all_themes = $fs_options->get_option( 'all_themes' ); 16 | 17 | /* translators: %s: time period (e.g. In "2 hours") */ 18 | $in_x_text = fs_text_inline( 'In %s', 'in-x' ); 19 | /* translators: %s: time period (e.g. "2 hours" ago) */ 20 | $x_ago_text = fs_text_inline( '%s ago', 'x-ago' ); 21 | $sec_text = fs_text_x_inline( 'sec', 'seconds' ); 22 | ?> 23 |

    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 73 | 74 | 75 | 76 |
    plugins ) ?>timestamp ) && is_numeric( $all_plugins->timestamp ) ) { 39 | $diff = abs( WP_FS__SCRIPT_START_TIME - $all_plugins->timestamp ); 40 | $human_diff = ( $diff < MINUTE_IN_SECONDS ) ? 41 | $diff . ' ' . $sec_text : 42 | human_time_diff( WP_FS__SCRIPT_START_TIME, $all_plugins->timestamp ); 43 | 44 | echo esc_html( sprintf( 45 | ( ( WP_FS__SCRIPT_START_TIME < $all_plugins->timestamp ) ? 46 | $in_x_text : 47 | $x_ago_text ), 48 | $human_diff 49 | ) ); 50 | } 51 | ?>
    themes ) ?>timestamp ) && is_numeric( $all_themes->timestamp ) ) { 60 | $diff = abs( WP_FS__SCRIPT_START_TIME - $all_themes->timestamp ); 61 | $human_diff = ( $diff < MINUTE_IN_SECONDS ) ? 62 | $diff . ' ' . $sec_text : 63 | human_time_diff( WP_FS__SCRIPT_START_TIME, $all_themes->timestamp ); 64 | 65 | echo esc_html( sprintf( 66 | ( ( WP_FS__SCRIPT_START_TIME < $all_themes->timestamp ) ? 67 | $in_x_text : 68 | $x_ago_text ), 69 | $human_diff 70 | ) ); 71 | } 72 | ?>
    77 | -------------------------------------------------------------------------------- /freemius/templates/email.php: -------------------------------------------------------------------------------- 1 | 18 | 19 | $section ) { 21 | ?> 22 | 23 | 24 | 25 | 26 | $row ) { 28 | $col_count = count( $row ); 29 | ?> 30 | 31 | 33 | 34 | 36 | 37 | 38 | 41 | 42 | 45 | 46 | 49 |
    :
    -------------------------------------------------------------------------------- /freemius/templates/forms/deactivation/contact.php: -------------------------------------------------------------------------------- 1 | get_slug(); 18 | 19 | echo fs_text_inline( 'Sorry for the inconvenience and we are here to help if you give us a chance.', 'contact-support-before-deactivation', $slug ) 20 | . sprintf(" %s", 21 | $fs->contact_url( 'technical_support' ), 22 | fs_text_inline( 'Contact Support', 'contact-support', $slug ) 23 | ); 24 | -------------------------------------------------------------------------------- /freemius/templates/forms/deactivation/index.php: -------------------------------------------------------------------------------- 1 | get_slug(); 18 | 19 | $skip_url = fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ) ), $fs->get_unique_affix() . '_skip_activation' ); 20 | $skip_text = strtolower( fs_text_x_inline( 'Skip', 'verb', 'skip', $slug ) ); 21 | $use_plugin_anonymously_text = fs_text_inline( 'Click here to use the plugin anonymously', 'click-here-to-use-plugin-anonymously', $slug ); 22 | 23 | echo sprintf( fs_text_inline( "You might have missed it, but you don't have to share any data and can just %s the opt-in.", 'dont-have-to-share-any-data', $slug ), "{$skip_text}" ) 24 | . " {$use_plugin_anonymously_text}"; -------------------------------------------------------------------------------- /freemius/templates/forms/index.php: -------------------------------------------------------------------------------- 1 | _get_license(); 19 | 20 | if ( ! is_object( $license ) ) { 21 | $purchase_url = $fs->pricing_url(); 22 | } else { 23 | $subscription = $fs->_get_subscription( $license->id ); 24 | 25 | $purchase_url = $fs->checkout_url( 26 | is_object( $subscription ) ? 27 | ( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) : 28 | WP_FS__PERIOD_LIFETIME, 29 | false, 30 | array( 'licenses' => $license->quota ) 31 | ); 32 | } 33 | 34 | $plugin_data = $fs->get_plugin_data(); 35 | ?> 36 | -------------------------------------------------------------------------------- /freemius/templates/gdpr-optin-js.php: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /freemius/templates/index.php: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /freemius/templates/js/open-license-activation.php: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /freemius/templates/js/style-premium-theme.php: -------------------------------------------------------------------------------- 1 | get_slug(); 21 | 22 | ?> 23 | -------------------------------------------------------------------------------- /freemius/templates/partials/index.php: -------------------------------------------------------------------------------- 1 | 20 |
    21 | 22 |
    -------------------------------------------------------------------------------- /freemius/templates/plugin-info/description.php: -------------------------------------------------------------------------------- 1 | info->selling_point_0 ) || 21 | ! empty( $plugin->info->selling_point_1 ) || 22 | ! empty( $plugin->info->selling_point_2 ) 23 | ) : ?> 24 |
    25 |
      26 | 27 | info->{'selling_point_' . $i} ) ) : ?> 28 |
    • 29 | 30 |

      info->{'selling_point_' . $i} ) ?>

    • 31 | 32 | 33 |
    34 |
    35 | 36 |
    37 | info->description, array( 39 | 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ), 40 | 'b' => array(), 41 | 'i' => array(), 42 | 'p' => array(), 43 | 'blockquote' => array(), 44 | 'h2' => array(), 45 | 'h3' => array(), 46 | 'ul' => array(), 47 | 'ol' => array(), 48 | 'li' => array() 49 | ) ); 50 | ?> 51 |
    52 | info->screenshots ) ) : ?> 53 | info->screenshots ?> 54 |
    55 |

    slug ) ?>

    56 |
      57 | $url ) : ?> 59 |
    • 60 | 66 | 69 |
    • 70 | 71 |
    72 |
    73 | -------------------------------------------------------------------------------- /freemius/templates/plugin-info/index.php: -------------------------------------------------------------------------------- 1 | 22 |
      23 | $url ) : ?> 25 |
    1. 26 | 27 |
    2. 28 | 29 |
    30 | -------------------------------------------------------------------------------- /freemius/templates/secure-https-header.php: -------------------------------------------------------------------------------- 1 | 15 |
    16 | 17 | get_text_inline( 'Secure HTTPS %s page, running from an external domain', 'secure-x-page-header' ), 29 | $VARS['page'] 30 | ) ) . 31 | ' - ' . 32 | sprintf( 33 | '%s', 34 | 'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION, 35 | 'Freemius Inc. [US]' 36 | ); 37 | } 38 | ?> 39 |
    -------------------------------------------------------------------------------- /freemius/templates/sticky-admin-notice-js.php: -------------------------------------------------------------------------------- 1 | 16 | 41 | -------------------------------------------------------------------------------- /freemius/templates/tabs-capture-js.php: -------------------------------------------------------------------------------- 1 | get_slug(); 19 | ?> 20 | -------------------------------------------------------------------------------- /includes/admin/class-dashboard-widgets.php: -------------------------------------------------------------------------------- 1 | $daily, 66 | ) 67 | ); 68 | 69 | $output .= '
    '; 70 | 71 | if ( $daily ) { 72 | $output .= sprintf( 73 | '%s', 74 | admin_url( 'admin.php?page=bsearch_popular_searches&orderby=daily_count&order=desc' ), 75 | __( 'View all daily popular searches', 'better-search' ) 76 | ); 77 | } else { 78 | $output .= sprintf( 79 | '%s', 80 | admin_url( 'admin.php?page=bsearch_popular_searches' ), 81 | __( 'View all popular searches', 'better-search' ) 82 | ); 83 | } 84 | $output .= '
    '; 85 | $output .= Helpers::get_credit_link(); 86 | 87 | return $output; 88 | } 89 | 90 | 91 | /** 92 | * Widget for Popular Searches. 93 | * 94 | * @since 3.3.0 95 | */ 96 | public static function widget() { 97 | echo self::display( false ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 98 | } 99 | 100 | 101 | /** 102 | * Widget for Daily Popular Searches. 103 | * 104 | * @since 3.3.0 105 | */ 106 | public static function widget_daily() { 107 | echo self::display( true ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /includes/admin/css/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/css/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /includes/admin/images/better-search-pro-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/images/better-search-pro-banner.png -------------------------------------------------------------------------------- /includes/admin/images/bsearch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/images/bsearch-icon.png -------------------------------------------------------------------------------- /includes/admin/images/fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/includes/admin/images/fb.png -------------------------------------------------------------------------------- /includes/admin/images/index.php: -------------------------------------------------------------------------------- 1 | '); 7 | clearCache($button); 8 | } 9 | }); 10 | 11 | // Function to clear the cache. 12 | function clearCache($button) { 13 | $.post(bsearch_admin_data.ajax_url, { 14 | action: 'bsearch_clear_cache', 15 | security: bsearch_admin_data.security 16 | }, function (response) { 17 | if (response.success) { 18 | alert(response.data.message); 19 | } else { 20 | alert(bsearch_admin_data.fail_message); 21 | } 22 | }).fail(function (jqXHR, textStatus) { 23 | alert(bsearch_admin_data.request_fail_message + textStatus); 24 | }).always(function () { 25 | $button.prop('disabled', false).find('.spinner').remove(); 26 | }); 27 | } 28 | 29 | // Prompt the user when they leave the page without saving the form. 30 | var formmodified = 0; 31 | 32 | function confirmFormChange() { 33 | formmodified = 1; 34 | } 35 | 36 | function confirmExit() { 37 | if (formmodified == 1) { 38 | return true; 39 | } 40 | } 41 | 42 | function formNotModified() { 43 | formmodified = 0; 44 | } 45 | 46 | $('form *').change(confirmFormChange); 47 | 48 | window.onbeforeunload = confirmExit; 49 | 50 | $("input[name='submit']").click(formNotModified); 51 | $("input[id='search-submit']").click(formNotModified); 52 | $("input[id='doaction']").click(formNotModified); 53 | $("input[id='doaction2']").click(formNotModified); 54 | $("input[name='filter_action']").click(formNotModified); 55 | 56 | $( 57 | function () { 58 | $("#post-body-content").tabs( 59 | { 60 | create: function (event, ui) { 61 | $(ui.tab.find("a")).addClass("nav-tab-active"); 62 | }, 63 | activate: function (event, ui) { 64 | $(ui.oldTab.find("a")).removeClass("nav-tab-active"); 65 | $(ui.newTab.find("a")).addClass("nav-tab-active"); 66 | } 67 | } 68 | ); 69 | } 70 | ); 71 | 72 | // Datepicker. 73 | $( 74 | function () { 75 | var dateFormat = 'dd M yy', 76 | from = $("#datepicker-from") 77 | .datepicker( 78 | { 79 | changeMonth: true, 80 | changeYear: true, 81 | maxDate: 0, 82 | dateFormat: dateFormat 83 | } 84 | ) 85 | .on( 86 | "change", 87 | function () { 88 | to.datepicker("option", "minDate", getDate(this)); 89 | } 90 | ), 91 | to = $("#datepicker-to") 92 | .datepicker( 93 | { 94 | changeMonth: true, 95 | changeYear: true, 96 | maxDate: 0, 97 | dateFormat: dateFormat 98 | } 99 | ) 100 | .on( 101 | "change", 102 | function () { 103 | from.datepicker("option", "maxDate", getDate(this)); 104 | } 105 | ); 106 | 107 | function getDate(element) { 108 | var date; 109 | try { 110 | date = $.datepicker.parseDate(dateFormat, element.value); 111 | } catch (error) { 112 | date = null; 113 | } 114 | 115 | return date; 116 | } 117 | } 118 | ); 119 | } 120 | ); 121 | -------------------------------------------------------------------------------- /includes/admin/js/admin-scripts.min.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready((function(a){a('button[name="bsearch_cache_clear"]').on("click",(function(){if(confirm(bsearch_admin_data.confirm_message)){var n=a(this);n.prop("disabled",!0).append(' '),function(n){a.post(bsearch_admin_data.ajax_url,{action:"bsearch_clear_cache",security:bsearch_admin_data.security},(function(a){a.success?alert(a.data.message):alert(bsearch_admin_data.fail_message)})).fail((function(a,n){alert(bsearch_admin_data.request_fail_message+n)})).always((function(){n.prop("disabled",!1).find(".spinner").remove()}))}(n)}}));var n=0;function e(){n=0}a("form *").change((function(){n=1})),window.onbeforeunload=function(){if(1==n)return!0},a("input[name='submit']").click(e),a("input[id='search-submit']").click(e),a("input[id='doaction']").click(e),a("input[id='doaction2']").click(e),a("input[name='filter_action']").click(e),a((function(){a("#post-body-content").tabs({create:function(n,e){a(e.tab.find("a")).addClass("nav-tab-active")},activate:function(n,e){a(e.oldTab.find("a")).removeClass("nav-tab-active"),a(e.newTab.find("a")).addClass("nav-tab-active")}})})),a((function(){var n="dd M yy",e=a("#datepicker-from").datepicker({changeMonth:!0,changeYear:!0,maxDate:0,dateFormat:n}).on("change",(function(){t.datepicker("option","minDate",i(this))})),t=a("#datepicker-to").datepicker({changeMonth:!0,changeYear:!0,maxDate:0,dateFormat:n}).on("change",(function(){e.datepicker("option","maxDate",i(this))}));function i(e){var t;try{t=a.datepicker.parseDate(n,e.value)}catch(a){t=null}return t}}))})); -------------------------------------------------------------------------------- /includes/admin/js/chart-data.js: -------------------------------------------------------------------------------- 1 | // Function to update the chart. 2 | function updateChart() { 3 | jQuery.post( 4 | ajaxurl, 5 | { 6 | action: "bsearch_chart_data", 7 | security: bsearch_chart_data.security, 8 | from_date: jQuery("#datepicker-from").val(), 9 | to_date: jQuery("#datepicker-to").val(), 10 | }, 11 | function (data) { 12 | var date = []; 13 | var searches = []; 14 | 15 | for (var i in data) { 16 | date.push(data[i].date); 17 | searches.push(data[i].searches); 18 | } 19 | window.bsearchChart.data.labels = date; 20 | window.bsearchChart.data.datasets.forEach((dataset) => { 21 | dataset.data = searches; 22 | }); 23 | window.bsearchChart.update(); 24 | }, 25 | "json" 26 | ); 27 | } 28 | 29 | jQuery(document).ready(function ($) { 30 | $.ajax({ 31 | type: "POST", 32 | dataType: "json", 33 | url: ajaxurl, 34 | data: { 35 | action: "bsearch_chart_data", 36 | security: bsearch_chart_data.security, 37 | from_date: $("#datepicker-from").val(), 38 | to_date: $("#datepicker-to").val(), 39 | }, 40 | success: function (data) { 41 | var date = []; 42 | var searches = []; 43 | 44 | for (var i in data) { 45 | date.push(data[i].date); 46 | searches.push(data[i].searches); 47 | } 48 | 49 | var ctx = $("#searches"); 50 | var config = { 51 | type: "bar", 52 | data: { 53 | labels: date, 54 | datasets: [ 55 | { 56 | label: bsearch_chart_data.datasetlabel, 57 | backgroundColor: "#70c4e1", 58 | borderColor: "#70c4e1", 59 | hoverBackgroundColor: "#ffbf00", 60 | hoverBorderColor: "#ffbf00", 61 | data: searches, 62 | }, 63 | ], 64 | }, 65 | plugins: [ChartDataLabels], 66 | options: { 67 | plugins: { 68 | title: { 69 | text: bsearch_chart_data.charttitle, 70 | display: true, 71 | }, 72 | legend: { 73 | display: false, 74 | position: "bottom", 75 | }, 76 | datalabels: { 77 | color: "#000000", 78 | anchor: "end", 79 | align: "top", 80 | }, 81 | }, 82 | scales: { 83 | x: { 84 | type: "time", 85 | time: { 86 | tooltipFormat: "DD", 87 | unit: "day", 88 | displayFormats: { 89 | day: "DD", 90 | }, 91 | }, 92 | title: { 93 | display: false, 94 | labelString: "Date", 95 | }, 96 | }, 97 | y: { 98 | grace: "5%", 99 | suggestedMin: 0, 100 | display: true, 101 | title: { 102 | display: false, 103 | text: bsearch_chart_data.datasetlabel, 104 | color: "#000", 105 | padding: { top: 30, left: 0, right: 0, bottom: 0 }, 106 | }, 107 | }, 108 | }, 109 | }, 110 | }; 111 | 112 | window.bsearchChart = new Chart(ctx, config); 113 | }, 114 | error: function (data) { 115 | console.log(data); 116 | }, 117 | }); 118 | }); 119 | -------------------------------------------------------------------------------- /includes/admin/js/chart-data.min.js: -------------------------------------------------------------------------------- 1 | function updateChart(){jQuery.post(ajaxurl,{action:"bsearch_chart_data",security:bsearch_chart_data.security,from_date:jQuery("#datepicker-from").val(),to_date:jQuery("#datepicker-to").val()},(function(a){var t=[],e=[];for(var r in a)t.push(a[r].date),e.push(a[r].searches);window.bsearchChart.data.labels=t,window.bsearchChart.data.datasets.forEach((a=>{a.data=e})),window.bsearchChart.update()}),"json")}jQuery(document).ready((function(a){a.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"bsearch_chart_data",security:bsearch_chart_data.security,from_date:a("#datepicker-from").val(),to_date:a("#datepicker-to").val()},success:function(t){var e=[],r=[];for(var o in t)e.push(t[o].date),r.push(t[o].searches);var s=a("#searches"),d={type:"bar",data:{labels:e,datasets:[{label:bsearch_chart_data.datasetlabel,backgroundColor:"#70c4e1",borderColor:"#70c4e1",hoverBackgroundColor:"#ffbf00",hoverBorderColor:"#ffbf00",data:r}]},plugins:[ChartDataLabels],options:{plugins:{title:{text:bsearch_chart_data.charttitle,display:!0},legend:{display:!1,position:"bottom"},datalabels:{color:"#000000",anchor:"end",align:"top"}},scales:{x:{type:"time",time:{tooltipFormat:"DD",unit:"day",displayFormats:{day:"DD"}},title:{display:!1,labelString:"Date"}},y:{grace:"5%",suggestedMin:0,display:!0,title:{display:!1,text:bsearch_chart_data.datasetlabel,color:"#000",padding:{top:30,left:0,right:0,bottom:0}}}}}};window.bsearchChart=new Chart(s,d)},error:function(a){}})})); -------------------------------------------------------------------------------- /includes/admin/js/chartjs-adapter-luxon.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * chartjs-adapter-luxon v1.3.1 3 | * https://www.chartjs.org 4 | * (c) 2023 chartjs-adapter-luxon Contributors 5 | * Released under the MIT license 6 | */ 7 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chart.js"),require("luxon")):"function"==typeof define&&define.amd?define(["chart.js","luxon"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Chart,e.luxon)}(this,(function(e,t){"use strict";const n={datetime:t.DateTime.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:t.DateTime.TIME_WITH_SECONDS,minute:t.DateTime.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};e._adapters._date.override({_id:"luxon",_create:function(e){return t.DateTime.fromMillis(e,this.options)},init(e){this.options.locale||(this.options.locale=e.locale)},formats:function(){return n},parse:function(e,n){const i=this.options,r=typeof e;return null===e||"undefined"===r?null:("number"===r?e=this._create(e):"string"===r?e="string"==typeof n?t.DateTime.fromFormat(e,n,i):t.DateTime.fromISO(e,i):e instanceof Date?e=t.DateTime.fromJSDate(e,i):"object"!==r||e instanceof t.DateTime||(e=t.DateTime.fromObject(e,i)),e.isValid?e.valueOf():null)},format:function(e,t){const n=this._create(e);return"string"==typeof t?n.toFormat(t):n.toLocaleString(t)},add:function(e,t,n){const i={};return i[n]=t,this._create(e).plus(i).valueOf()},diff:function(e,t,n){return this._create(e).diff(this._create(t)).as(n).valueOf()},startOf:function(e,t,n){if("isoWeek"===t){n=Math.trunc(Math.min(Math.max(0,n),6));const t=this._create(e);return t.minus({days:(t.weekday-n+7)%7}).startOf("day").valueOf()}return t?this._create(e).startOf(t).valueOf():e},endOf:function(e,t){return this._create(e).endOf(t).valueOf()}})})); 8 | -------------------------------------------------------------------------------- /includes/admin/js/chartjs-adapter-luxon.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * chartjs-adapter-luxon v1.3.1 3 | * https://www.chartjs.org 4 | * (c) 2023 chartjs-adapter-luxon Contributors 5 | * Released under the MIT license 6 | */ 7 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chart.js"),require("luxon")):"function"==typeof define&&define.amd?define(["chart.js","luxon"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Chart,e.luxon)}(this,(function(e,t){"use strict";const n={datetime:t.DateTime.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:t.DateTime.TIME_WITH_SECONDS,minute:t.DateTime.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};e._adapters._date.override({_id:"luxon",_create:function(e){return t.DateTime.fromMillis(e,this.options)},init(e){this.options.locale||(this.options.locale=e.locale)},formats:function(){return n},parse:function(e,n){const i=this.options,r=typeof e;return null===e||"undefined"===r?null:("number"===r?e=this._create(e):"string"===r?e="string"==typeof n?t.DateTime.fromFormat(e,n,i):t.DateTime.fromISO(e,i):e instanceof Date?e=t.DateTime.fromJSDate(e,i):"object"!==r||e instanceof t.DateTime||(e=t.DateTime.fromObject(e,i)),e.isValid?e.valueOf():null)},format:function(e,t){const n=this._create(e);return"string"==typeof t?n.toFormat(t):n.toLocaleString(t)},add:function(e,t,n){const i={};return i[n]=t,this._create(e).plus(i).valueOf()},diff:function(e,t,n){return this._create(e).diff(this._create(t)).as(n).valueOf()},startOf:function(e,t,n){if("isoWeek"===t){n=Math.trunc(Math.min(Math.max(0,n),6));const t=this._create(e);return t.minus({days:(t.weekday-n+7)%7}).startOf("day").valueOf()}return t?this._create(e).startOf(t).valueOf():e},endOf:function(e,t){return this._create(e).endOf(t).valueOf()}})})); -------------------------------------------------------------------------------- /includes/admin/js/index.php: -------------------------------------------------------------------------------- 1 | hooks(); 40 | } 41 | 42 | /** 43 | * Run the hooks. 44 | * 45 | * @since 4.0.0 46 | */ 47 | public function hooks() { 48 | add_action( 'network_admin_menu', array( $this, 'network_admin_menu' ) ); 49 | } 50 | 51 | /** 52 | * Add the network admin menu. 53 | * 54 | * @since 4.0.0 55 | */ 56 | public function network_admin_menu() { 57 | $this->parent_id = add_menu_page( 58 | esc_html__( 'Better Search Multisite Dashboard', 'better-search' ), 59 | esc_html__( 'Better Search', 'better-search' ), 60 | 'manage_network_options', 61 | 'bsearch_dashboard', 62 | array( $this, 'render_page' ), 63 | 'dashicons-search' 64 | ); 65 | 66 | add_submenu_page( 67 | 'bsearch_dashboard', 68 | esc_html__( 'Better Search Multisite Settings', 'better-search' ), 69 | esc_html__( 'Settings', 'better-search' ), 70 | 'manage_network_options', 71 | 'bsearch_dashboard', 72 | array( $this, 'render_page' ) 73 | ); 74 | } 75 | 76 | /** 77 | * Render the page. 78 | * 79 | * @since 4.0.0 80 | */ 81 | public function render_page() { 82 | ?> 83 |
    84 |

    85 |

    86 | 87 | 88 | 89 | 90 |
    91 | 0) { 7 | editor.replaceSelection(str); 8 | } else { 9 | 10 | var doc = editor.getDoc(); 11 | var cursor = doc.getCursor(); 12 | 13 | var pos = { 14 | line: cursor.line, 15 | ch: cursor.ch 16 | } 17 | 18 | doc.replaceRange(str, pos); 19 | 20 | } 21 | 22 | } 23 | 24 | // Media selector. 25 | $('.insert-codemirror-media').on('click', function (event) { 26 | event.preventDefault(); 27 | 28 | var self = $(this); 29 | var editor = $('#wp-content-editor-container .CodeMirror')[0].CodeMirror; 30 | 31 | function attachmentHtml(props, attachment) { 32 | var caption = attachment.caption, 33 | options, html; 34 | 35 | // If captions are disabled, clear the caption. 36 | if (!wp.media.view.settings.captions) { 37 | delete attachment.caption; 38 | } 39 | 40 | props = wp.media.string.props(props, attachment); 41 | 42 | options = { 43 | id: attachment.id, 44 | post_content: attachment.description, 45 | post_excerpt: caption 46 | }; 47 | 48 | if (props.linkUrl) { 49 | options.url = props.linkUrl; 50 | } 51 | 52 | if ('image' === attachment.type) { 53 | html = wp.media.string.image(props); 54 | 55 | _.each({ 56 | align: 'align', 57 | size: 'image-size', 58 | alt: 'image_alt' 59 | }, function (option, prop) { 60 | if (props[prop]) { 61 | options[option] = props[prop]; 62 | } 63 | }); 64 | } else if ('video' === attachment.type) { 65 | html = wp.media.string.video(props, attachment); 66 | } else if ('audio' === attachment.type) { 67 | html = wp.media.string.audio(props, attachment); 68 | } else { 69 | html = wp.media.string.link(props); 70 | options.post_title = props.title; 71 | } 72 | 73 | return $.ajax({ 74 | type: 'POST', 75 | dataType: 'json', 76 | url: ajaxurl, 77 | data: { 78 | action: 'send-attachment-to-editor', 79 | nonce: wp.media.view.settings.nonce.sendToEditor, 80 | attachment: options, 81 | html: html, 82 | post_id: wp.media.view.settings.post.id 83 | }, 84 | success: function (response) { 85 | //mediaHtml = response.data; 86 | } 87 | }); 88 | } 89 | 90 | // Create the media frame. 91 | var file_frame = wp.media.frames.file_frame = wp.media({ 92 | frame: 'post', 93 | state: 'insert', 94 | multiple: true 95 | }); 96 | 97 | file_frame.on('insert', function () { 98 | var selection = file_frame.state().get('selection'); 99 | 100 | selection.map(function (attachment) { 101 | 102 | var props = file_frame.state().display(attachment).toJSON(); 103 | 104 | $.when(attachmentHtml(props, attachment.toJSON())).done(function (response) { 105 | mediaHtml = response.data; 106 | insertString(editor, mediaHtml); 107 | }); 108 | }); 109 | 110 | }); 111 | 112 | // Finally, open the modal 113 | file_frame.open(); 114 | }); 115 | }); 116 | -------------------------------------------------------------------------------- /includes/admin/settings/js/media-selector.min.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready((function(e){e(".insert-codemirror-media").on("click",(function(t){t.preventDefault();e(this);var i=e("#wp-content-editor-container .CodeMirror")[0].CodeMirror;var n=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",multiple:!0});n.on("insert",(function(){n.state().get("selection").map((function(t){var a=n.state().display(t).toJSON();e.when(function(t,i){var n,a,o=i.caption;return wp.media.view.settings.captions||delete i.caption,t=wp.media.string.props(t,i),n={id:i.id,post_content:i.description,post_excerpt:o},t.linkUrl&&(n.url=t.linkUrl),"image"===i.type?(a=wp.media.string.image(t),_.each({align:"align",size:"image-size",alt:"image_alt"},(function(e,i){t[i]&&(n[e]=t[i])}))):"video"===i.type?a=wp.media.string.video(t,i):"audio"===i.type?a=wp.media.string.audio(t,i):(a=wp.media.string.link(t),n.post_title=t.title),e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"send-attachment-to-editor",nonce:wp.media.view.settings.nonce.sendToEditor,attachment:n,html:a,post_id:wp.media.view.settings.post.id},success:function(e){}})}(a,t.toJSON())).done((function(e){mediaHtml=e.data,function(e,t){if(e.getSelection().length>0)e.replaceSelection(t);else{var i=e.getDoc(),n=i.getCursor(),a={line:n.line,ch:n.ch};i.replaceRange(t,a)}}(i,mediaHtml)}))}))})),n.open()}))})); -------------------------------------------------------------------------------- /includes/admin/settings/js/settings-admin-scripts.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function ($) { 2 | // File browser. 3 | $('.file-browser').on('click', function (event) { 4 | event.preventDefault(); 5 | 6 | var self = $(this); 7 | 8 | // Create the media frame. 9 | var file_frame = wp.media.frames.file_frame = wp.media({ 10 | title: self.data('uploader_title'), 11 | button: { 12 | text: self.data('uploader_button_text'), 13 | }, 14 | multiple: false 15 | }); 16 | 17 | file_frame.on('select', function () { 18 | attachment = file_frame.state().get('selection').first().toJSON(); 19 | self.prev('.file-url').val(attachment.url).change(); 20 | }); 21 | 22 | // Finally, open the modal 23 | file_frame.open(); 24 | }); 25 | 26 | // Prompt the user when they leave the page without saving the form. 27 | var formmodified = 0; 28 | 29 | function confirmFormChange() { 30 | formmodified = 1; 31 | } 32 | 33 | function confirmExit() { 34 | if (formmodified == 1) { 35 | return true; 36 | } 37 | } 38 | 39 | function formNotModified() { 40 | formmodified = 0; 41 | } 42 | 43 | $('form').on('change', 'input, textarea, select', confirmFormChange); 44 | 45 | window.onbeforeunload = confirmExit; 46 | 47 | $('input[name="submit"], input#search-submit, input#doaction, input#doaction2, input[name="filter_action"]').on('click', formNotModified); 48 | 49 | $(function () { 50 | $("#post-body-content").tabs({ 51 | create: function (event, ui) { 52 | $(ui.tab.find("a")).addClass("nav-tab-active"); 53 | }, 54 | activate: function (event, ui) { 55 | $(ui.oldTab.find("a")).removeClass("nav-tab-active"); 56 | $(ui.newTab.find("a")).addClass("nav-tab-active"); 57 | } 58 | }); 59 | }); 60 | 61 | // Initialise ColorPicker. 62 | $('.color-field').each(function (i, element) { 63 | $(element).wpColorPicker(); 64 | }); 65 | 66 | $('.reset-default-thumb').on('click', function () { 67 | $('#bsearch_settings\\[thumb_default\\]').val(bsearch_admin.thumb_default); 68 | }); 69 | 70 | }); 71 | -------------------------------------------------------------------------------- /includes/admin/settings/js/settings-admin-scripts.min.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function(t){function n(){i=1}function e(){if(1==i)return!0}function a(){i=0}t(".file-browser").on("click",function(n){n.preventDefault();var e=t(this),a=wp.media.frames.file_frame=wp.media({title:e.data("uploader_title"),button:{text:e.data("uploader_button_text")},multiple:!1});a.on("select",function(){attachment=a.state().get("selection").first().toJSON(),e.prev(".file-url").val(attachment.url).change()}),a.open()});var i=0;t("form").on("change","input, textarea, select",n),window.onbeforeunload=e,t('input[name="submit"], input#search-submit, input#doaction, input#doaction2, input[name="filter_action"]').on("click",a),t(function(){t("#post-body-content").tabs({create:function(n,e){t(e.tab.find("a")).addClass("nav-tab-active")},activate:function(n,e){t(e.oldTab.find("a")).removeClass("nav-tab-active"),t(e.newTab.find("a")).addClass("nav-tab-active")}})}),t(".color-field").each(function(n,e){t(e).wpColorPicker()}),t(".reset-default-thumb").on("click",function(){t("#bsearch_settings\\[thumb_default\\]").val(bsearch_admin.thumb_default)})}); -------------------------------------------------------------------------------- /includes/admin/settings/js/taxonomy-suggest.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function($) { 2 | // Function to add auto suggest. 3 | $.fn.WZTagsSuggest = function( options ) { 4 | var cache; 5 | var last; 6 | var $element = $( this ); 7 | 8 | options = options || {}; 9 | 10 | var taxonomy = options.taxonomy || $element.attr( 'data-wp-taxonomy' ) || 'category'; 11 | var tag_search = options.tag_search || $element.attr( 'data-wp-action' ) || 'wz_tags_search'; 12 | delete( options.taxonomy ); 13 | delete( options.tag_search ); 14 | 15 | function split( val ) { 16 | return val.split( /,(?=(?:(?:[^"]*"){2})*[^"]*$)/ ); // Split typical CSV format, with commas and double quotes. 17 | } 18 | 19 | function extractLast( term ) { 20 | return split( term ).pop(); 21 | } 22 | 23 | options = $.extend({ 24 | minLength: 2, 25 | position: { 26 | my: 'left top+2', 27 | at: 'left bottom', 28 | collision: 'none' 29 | }, 30 | source: function( request, response ) { 31 | var term; 32 | 33 | if ( last === request.term ) { 34 | response( cache ); 35 | return; 36 | } 37 | 38 | term = extractLast( request.term ); 39 | 40 | if ( last === request.term ) { 41 | response( cache ); 42 | return; 43 | } 44 | 45 | $.ajax({ 46 | type: 'POST', 47 | dataType: 'json', 48 | url: ajaxurl, 49 | data: { 50 | action: tag_search, 51 | tax: taxonomy, 52 | q: term 53 | }, 54 | }).done( function( data ) { 55 | cache = data; 56 | response( data ); 57 | }); 58 | 59 | last = request.term; 60 | 61 | }, 62 | search: function() { 63 | // Custom minLength. 64 | var term = extractLast( this.value ); 65 | 66 | if ( term.length < 2 ) { 67 | return false; 68 | } 69 | }, 70 | focus: function( event, ui ) { 71 | // Prevent value inserted on focus. 72 | event.preventDefault(); 73 | }, 74 | select: function( event, ui ) { 75 | var terms = split( this.value ); 76 | var val = ui.item.value; 77 | 78 | if ( val.indexOf(',') !== -1 ) { 79 | val = '"' + val + '"' 80 | } 81 | 82 | // Remove the last user input. 83 | terms.pop(); 84 | 85 | // Add the selected item. 86 | terms.push( val ); 87 | 88 | // Add placeholder to get the comma-and-space at the end. 89 | terms.push( "" ); 90 | this.value = terms.join( ", " ); 91 | return false; 92 | } 93 | }, options ); 94 | 95 | $element.on( "keydown", function( event ) { 96 | // Don't navigate away from the field on tab when selecting an item. 97 | if ( event.keyCode === $.ui.keyCode.TAB && 98 | $( this ).autocomplete( 'instance' ).menu.active ) { 99 | event.preventDefault(); 100 | } 101 | }) 102 | .autocomplete( options ); 103 | }; 104 | 105 | $( '.category_autocomplete' ).each( function ( i, element ) { 106 | $( element ).WZTagsSuggest(); 107 | }); 108 | 109 | $('.widget-liquid-right, #customize-controls').on( 'click', '.category_autocomplete', function() { 110 | $( '.category_autocomplete' ).WZTagsSuggest(); 111 | }); 112 | }); 113 | -------------------------------------------------------------------------------- /includes/admin/settings/js/taxonomy-suggest.min.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready((function(t){t.fn.WZTagsSuggest=function(e){var o,n,a=t(this),u=(e=e||{}).taxonomy||a.attr("data-wp-taxonomy")||"category",c=e.tag_search||a.attr("data-wp-action")||"ata_tag_search";function i(t){return t.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/)}function r(t){return i(t).pop()}delete e.taxonomy,delete e.tag_search,e=t.extend({minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},source:function(e,a){var i;n!==e.term?(i=r(e.term),n!==e.term?(t.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:c,tax:u,q:i}}).done((function(t){o=t,a(t)})),n=e.term):a(o)):a(o)},search:function(){if(r(this.value).length<2)return!1},focus:function(t,e){t.preventDefault()},select:function(t,e){var o=i(this.value),n=e.item.value;return-1!==n.indexOf(",")&&(n='"'+n+'"'),o.pop(),o.push(n),o.push(""),this.value=o.join(", "),!1}},e),a.on("keydown",(function(e){e.keyCode===t.ui.keyCode.TAB&&t(this).autocomplete("instance").menu.active&&e.preventDefault()})).autocomplete(e)},t(".category_autocomplete").each((function(e,o){t(o).WZTagsSuggest()})),t(".widget-liquid-right, #customize-controls").on("click",".category_autocomplete",(function(){t(".category_autocomplete").WZTagsSuggest()}))})); -------------------------------------------------------------------------------- /includes/autoloader.php: -------------------------------------------------------------------------------- 1 | true ) ); 32 | $core_query = new Better_Search_Core_Query( $args ); 33 | 34 | add_filter( 'pre_get_posts', array( $core_query, 'pre_get_posts' ), 10 ); 35 | add_filter( 'posts_fields', array( $core_query, 'posts_fields' ), 10, 2 ); 36 | add_filter( 'posts_join', array( $core_query, 'posts_join' ), 10, 2 ); 37 | add_filter( 'posts_search', array( $core_query, 'posts_search' ), 10, 2 ); 38 | add_filter( 'posts_where', array( $core_query, 'posts_where' ), 10, 2 ); 39 | add_filter( 'posts_distinct', array( $core_query, 'posts_distinct' ), 10, 2 ); 40 | add_filter( 'posts_orderby', array( $core_query, 'posts_orderby' ), 10, 2 ); 41 | add_filter( 'posts_groupby', array( $core_query, 'posts_groupby' ), 10, 2 ); 42 | add_filter( 'posts_clauses', array( $core_query, 'posts_clauses' ), 10, 2 ); 43 | add_filter( 'posts_request', array( $core_query, 'posts_request' ), 10, 2 ); 44 | add_filter( 'better_search_query_posts_request', array( $core_query, 'set_topscore' ), PHP_INT_MAX, 2 ); 45 | add_filter( 'posts_pre_query', array( $core_query, 'posts_pre_query' ), 10, 2 ); 46 | add_filter( 'the_posts', array( $core_query, 'the_posts' ), 10, 2 ); 47 | 48 | parent::__construct( $core_query->query_args ); 49 | 50 | // Remove filters after use. 51 | remove_filter( 'pre_get_posts', array( $core_query, 'pre_get_posts' ) ); 52 | remove_filter( 'posts_fields', array( $core_query, 'posts_fields' ) ); 53 | remove_filter( 'posts_join', array( $core_query, 'posts_join' ) ); 54 | remove_filter( 'posts_search', array( $core_query, 'posts_search' ) ); 55 | remove_filter( 'posts_where', array( $core_query, 'posts_where' ) ); 56 | remove_filter( 'posts_distinct', array( $core_query, 'posts_distinct' ) ); 57 | remove_filter( 'posts_orderby', array( $core_query, 'posts_orderby' ) ); 58 | remove_filter( 'posts_groupby', array( $core_query, 'posts_groupby' ) ); 59 | remove_filter( 'posts_clauses', array( $core_query, 'posts_clauses' ) ); 60 | remove_filter( 'posts_request', array( $core_query, 'posts_request' ) ); 61 | remove_filter( 'better_search_query_posts_request', array( $core_query, 'set_topscore' ), PHP_INT_MAX ); 62 | remove_filter( 'posts_pre_query', array( $core_query, 'posts_pre_query' ) ); 63 | remove_filter( 'the_posts', array( $core_query, 'the_posts' ) ); 64 | } 65 | } 66 | endif; 67 | -------------------------------------------------------------------------------- /includes/css/bsearch-live-search.min.css: -------------------------------------------------------------------------------- 1 | .search-form,form[role="search"]{position:relative;width:100%;}.bsearch-visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;}.bsearch-autocomplete-results{display:none;position:absolute;z-index:1000;background:#fefefe;border:1px solid #ccc;border-radius:4px;box-shadow:0 4px 6px rgba(0,0,0,.1);max-height:200px;overflow-y:auto;width:100%;top:100%;left:0;margin-top:4px;}.bsearch-autocomplete-results ul{list-style-type:none;padding:0;margin:0;display:flex;flex-direction:column;}.bsearch-autocomplete-results li{display:flex;margin:0!important;align-items:center;padding:0;border-bottom:1px solid #eee;cursor:pointer;}.bsearch-autocomplete-results li:last-child{border-bottom:none;}.bsearch-autocomplete-results li.selected,.bsearch-autocomplete-results li:hover,.bsearch-autocomplete-results li.bsearch-selected{background-color:#f0f0f0;}.bsearch-autocomplete-results li:focus-within,.bsearch-autocomplete-results li.bsearch-selected{outline:2px solid #2271b1;outline-offset:-2px;}.bsearch-autocomplete-results a{display:block;width:100%;padding:12px 16px;text-align:left;text-decoration:none;color:#333;line-height:1.4;transition:all .2s ease;}.search-form input[type="search"]:focus,form[role="search"] input[type="search"]:focus{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #2271b1;border-color:#2271b1;}.search-form input[type="submit"]:focus,.search-form button[type="submit"]:focus,form[role="search"] input[type="submit"]:focus,form[role="search"] button[type="submit"]:focus{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #2271b1;border-color:#2271b1;}.bsearch-autocomplete-results a:focus{outline:none;background-color:#e8f0fe;box-shadow:inset 0 0 0 2px #2271b1;color:#000;text-decoration:underline;}.bsearch-autocomplete-results li.selected a:focus{background-color:#e8f0fe;box-shadow:inset 0 0 0 2px #2271b1;}@media (forced-colors:active){.bsearch-autocomplete-results li.selected,.bsearch-autocomplete-results a:focus{outline:2px solid CanvasText;outline-offset:-2px}}.bsearch-autocomplete-results{scrollbar-width:thin;scrollbar-color:#2271b1 #f0f0f0;}.bsearch-autocomplete-results::-webkit-scrollbar{width:8px;}.bsearch-autocomplete-results::-webkit-scrollbar-track{background:#f0f0f0;border-radius:4px;}.bsearch-autocomplete-results::-webkit-scrollbar-thumb{background-color:#2271b1;border-radius:4px;border:2px solid #f0f0f0;}@media (max-width:600px){.bsearch-autocomplete-results{width:100%;max-height:150px;margin-top:2px}.bsearch-autocomplete-results a{padding:10px 12px}} -------------------------------------------------------------------------------- /includes/css/bsearch-styles-min.css: -------------------------------------------------------------------------------- 1 | .bsearch_results_page{max-width:90%;margin:20px;padding:20px;}.bsearch_thumb_wrapper img{max-width:100%;}.bsearch-form-container{text-align:center;margin:10px auto;}.bsearchform{display:flex;flex-wrap:wrap;flex-direction:row;flex-flow:row wrap;justify-content:space-between;gap:10px;}.bsearchform .bsearch-form-search-field{flex:auto;}.bsearchform select,.bsearchform input[type="search"]{background-color:#fff;border:thin solid #999;display:inline-block;font:inherit;line-height:1.5em;padding:.5em 3.5em .5em 1em;width:100%;height:100%;}.bsearchform select{background-image:linear-gradient(45deg,transparent 50%,gray 50%),linear-gradient(135deg,gray 50%,transparent 50%),linear-gradient(to right,#ccc,#ccc);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;margin:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;}.bsearch_footer{text-align:center;}.bsearch_highlight{background:#ffc;color:#000;}.bsearch-post{margin:30px auto;}ul.bsearch_post_meta{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;}ul.bsearch_post_meta li{flex:auto;list-style-type:none;padding:2px;margin:0;text-align:left;}.bsearch-entry-title{text-align:left;}@media all and (max-width:600px){ul.bsearch_post_meta,.bsearchform{flex-direction:column}} -------------------------------------------------------------------------------- /includes/css/bsearch-styles.css: -------------------------------------------------------------------------------- 1 | .bsearch_results_page { 2 | max-width: 90%; 3 | margin: 20px; 4 | padding: 20px; 5 | } 6 | 7 | .bsearch_thumb_wrapper img { 8 | max-width: 100%; 9 | } 10 | 11 | .bsearch-form-container { 12 | text-align: center; 13 | margin: 10px auto; 14 | } 15 | 16 | .bsearchform { 17 | display: flex; 18 | flex-wrap: wrap; 19 | flex-direction: row; 20 | flex-flow: row wrap; 21 | justify-content: space-between; 22 | gap: 10px; 23 | } 24 | 25 | .bsearchform .bsearch-form-search-field { 26 | flex: auto; 27 | } 28 | 29 | .bsearchform select, .bsearchform input[type="search"] { 30 | background-color: #fff; 31 | border: thin solid #999; 32 | display: inline-block; 33 | font: inherit; 34 | line-height: 1.5em; 35 | padding: 0.5em 3.5em 0.5em 1em; 36 | width: 100%; 37 | height: 100%; 38 | } 39 | 40 | .bsearchform select { 41 | background-image: linear-gradient(45deg, transparent 50%, gray 50%), linear-gradient(135deg, gray 50%, transparent 50%), linear-gradient(to right, #ccc, #ccc); 42 | background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px), calc(100% - 2.5em) 0.5em; 43 | background-size: 5px 5px, 5px 5px, 1px 1.5em; 44 | background-repeat: no-repeat; 45 | /* reset */ 46 | margin: 0; 47 | -webkit-box-sizing: border-box; 48 | -moz-box-sizing: border-box; 49 | box-sizing: border-box; 50 | appearance: none; 51 | -webkit-appearance: none; 52 | -moz-appearance: none; 53 | } 54 | 55 | .bsearch_footer { 56 | text-align: center; 57 | } 58 | 59 | .bsearch_highlight { 60 | background: #ffc; 61 | color: #000; 62 | } 63 | 64 | .bsearch-post { 65 | margin: 30px auto; 66 | } 67 | 68 | ul.bsearch_post_meta { 69 | list-style: none; 70 | margin: 0; 71 | padding: 0; 72 | display: flex; 73 | flex-wrap: wrap; 74 | } 75 | 76 | ul.bsearch_post_meta li { 77 | flex: auto; 78 | list-style-type: none; 79 | padding: 2px; 80 | margin: 0; 81 | text-align: left; 82 | } 83 | 84 | .bsearch-entry-title { 85 | text-align: left; 86 | } 87 | 88 | @media all and (max-width: 600px) { 89 | ul.bsearch_post_meta, .bsearchform { 90 | flex-direction: column; 91 | } 92 | } -------------------------------------------------------------------------------- /includes/css/bsearch-styles.min.css: -------------------------------------------------------------------------------- 1 | .bsearch_results_page{max-width:90%;margin:20px;padding:20px;}.bsearch_thumb_wrapper img{max-width:100%;}.bsearch-form-container{text-align:center;margin:10px auto;}.bsearchform{display:flex;flex-wrap:wrap;flex-direction:row;flex-flow:row wrap;justify-content:space-between;gap:10px;}.bsearchform .bsearch-form-search-field{flex:auto;}.bsearchform select,.bsearchform input[type="search"]{background-color:#fff;border:thin solid #999;display:inline-block;font:inherit;line-height:1.5em;padding:.5em 3.5em .5em 1em;width:100%;height:100%;}.bsearchform select{background-image:linear-gradient(45deg,transparent 50%,gray 50%),linear-gradient(135deg,gray 50%,transparent 50%),linear-gradient(to right,#ccc,#ccc);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;margin:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;}.bsearch_footer{text-align:center;}.bsearch_highlight{background:#ffc;}.bsearch-post{margin:30px auto;}ul.bsearch_post_meta{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;}ul.bsearch_post_meta li{flex:auto;list-style-type:none;padding:2px;margin:0;text-align:left;}.bsearch-entry-title{text-align:left;}@media all and (max-width:600px){ul.bsearch_post_meta,.bsearchform{flex-direction:column}} -------------------------------------------------------------------------------- /includes/css/index.php: -------------------------------------------------------------------------------- 1 | _x( 'Better Search Form', 'Block pattern title', 'better-search' ), 10 | 'description' => __( 'Display the search results in a three column grid with meta data, title and excerpt, and post thumbnail.', 'better-search' ), 11 | 'categories' => array( 'better-search', 'query', 'posts' ), 12 | 'content' => ' 13 | 19 | ', 20 | ); 21 | -------------------------------------------------------------------------------- /includes/frontend/block-patterns/search-results.php: -------------------------------------------------------------------------------- 1 | _x( 'Better Search Results', 'Block pattern title', 'better-search' ), 10 | 'description' => __( 'Block pattern to display the search results in a three column grid with meta data, title and excerpt, and post thumbnail.', 'better-search' ), 11 | 'categories' => array( 'better-search', 'query', 'posts' ), 12 | 'templateTypes' => array( 'search' ), 13 | 'content' => ' 14 | 15 | 16 | 17 |
    18 | 19 |
    20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
    29 | 30 | 31 |
    32 | 33 |
    34 | 35 |
    36 | 37 | 38 | 39 | ', 40 | ); 41 | -------------------------------------------------------------------------------- /includes/frontend/class-display.php: -------------------------------------------------------------------------------- 1 | 0 ) { 85 | return $content; 86 | } 87 | ++self::$title_count; 88 | } 89 | } 90 | 91 | if ( ! empty( $search_query ) ) { 92 | $search_query = str_replace( array( "'", '"', '"', '\+', '\-' ), '', $search_query ); 93 | $keys = preg_split( '/[\s,\+\.]+/', $search_query ); 94 | $content = Helpers::highlight( $content, $keys ); 95 | } 96 | 97 | return $content; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /includes/frontend/class-shortcodes.php: -------------------------------------------------------------------------------- 1 | false, 41 | 'daily_range' => absint( bsearch_get_option( 'daily_range' ) ), 42 | 'smallest' => absint( bsearch_get_option( 'heatmap_smallest' ) ), 43 | 'largest' => absint( bsearch_get_option( 'heatmap_largest' ) ), 44 | 'unit' => bsearch_get_option( 'heatmap_unit', 'pt' ), 45 | 'hot' => bsearch_get_option( 'heatmap_hot' ), 46 | 'cold' => bsearch_get_option( 'heatmap_cold' ), 47 | 'number' => absint( bsearch_get_option( 'heatmap_limit' ) ), 48 | 'before_term' => bsearch_get_option( 'heatmap_before' ), 49 | 'after_term' => bsearch_get_option( 'heatmap_after' ), 50 | 'link_nofollow' => bsearch_get_option( 'link_nofollow' ), 51 | 'link_new_window' => bsearch_get_option( 'link_new_window' ), 52 | 'format' => 'flat', 53 | 'separator' => "\n", 54 | 'orderby' => 'count', 55 | 'order' => 'RAND', 56 | 'topic_count_text' => null, 57 | 'show_count' => 0, 58 | 'no_results_text' => __( 'No searches made yet', 'better-search' ), 59 | ), 60 | $atts, 61 | 'bsearch_heatmap' 62 | ); 63 | 64 | return get_bsearch_heatmap( $atts ); 65 | } 66 | 67 | /** 68 | * Creates a shortcode [bsearch_form daily="0"]. 69 | * 70 | * @param array $atts Shortcode attributes. 71 | * @return string The Better Search form. 72 | */ 73 | public static function bsearch_form( $atts ) { 74 | $atts = shortcode_atts( 75 | array( 76 | 'before' => '', 77 | 'after' => '', 78 | 'aria_label' => '', 79 | 'post_types' => bsearch_get_option( 'post_types' ), 80 | 'selected_post_types' => '', 81 | 'show_post_types' => false, 82 | ), 83 | $atts, 84 | 'bsearch_form' 85 | ); 86 | 87 | return get_bsearch_form( '', $atts ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /includes/frontend/class-styles-handler.php: -------------------------------------------------------------------------------- 1 | bsearch_get_option( 'use_fulltext' ), 60 | ); 61 | $args = wp_parse_args( $args, $defaults ); 62 | 63 | if ( empty( $search_query ) ) { 64 | $search_query = get_bsearch_query(); 65 | } 66 | $search_words = array(); 67 | 68 | // Extract the search terms. We respect quotes. 69 | $search_query = stripslashes( $search_query ); // Added slashes screw with quote grouping when done early, so done later. 70 | if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $search_query, $matches ) ) { 71 | $search_words = $matches[0]; 72 | } 73 | $use_fulltext = $args['use_fulltext']; 74 | 75 | // if search terms are less than 3 then turn fulltext off. 76 | if ( $use_fulltext ) { 77 | $use_fulltext_proxy = false; 78 | foreach ( $search_words as $search_word ) { 79 | if ( strlen( $search_word ) > 3 ) { 80 | $use_fulltext_proxy = true; 81 | } 82 | } 83 | $use_fulltext = $use_fulltext_proxy; 84 | } 85 | 86 | $s_array[0] = $search_query; // Save original query at [0]. 87 | $s_array[1] = $search_words; // Save array of terms at [1]. 88 | $s_array[2] = $use_fulltext; // Save fulltext status at [2]. 89 | 90 | /** 91 | * Filter array holding the search query and terms 92 | * 93 | * @since 1.2 94 | * 95 | * @param array $s_array Search query is at [0], array of terms at [1], fulltext status at [2] 96 | */ 97 | return apply_filters( 'get_bsearch_terms', $s_array ); 98 | } 99 | -------------------------------------------------------------------------------- /includes/js/better-search-tracker.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | fetch(ajax_bsearch_tracker.ajax_url, { 3 | method: 'POST', 4 | headers: { 5 | 'Content-Type': 'application/x-www-form-urlencoded', 6 | 'Cache-Control': 'no-cache' 7 | }, 8 | body: new URLSearchParams({ 9 | action: 'bsearch_tracker', 10 | bsearch_search_query: ajax_bsearch_tracker.bsearch_search_query 11 | }).toString() 12 | }) 13 | .then(function(response) { 14 | return response.json(); 15 | }) 16 | .then(function(data) { 17 | // handle the response data 18 | }) 19 | .catch(function(error) { 20 | console.error('Error:', error); 21 | }); 22 | }); -------------------------------------------------------------------------------- /includes/js/better-search-tracker.min.js: -------------------------------------------------------------------------------- 1 | document.addEventListener("DOMContentLoaded",(function(){fetch(ajax_bsearch_tracker.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams({action:"bsearch_tracker",bsearch_search_query:ajax_bsearch_tracker.bsearch_search_query}).toString()}).then((function(e){return e.json()})).then((function(e){})).catch((function(e){}))})); -------------------------------------------------------------------------------- /includes/js/index.php: -------------------------------------------------------------------------------- 1 | '17020', 27 | 'slug' => 'better-search', 28 | 'premium_slug' => 'better-search-pro', 29 | 'type' => 'plugin', 30 | 'public_key' => 'pk_40525301bca835d9836ec4d946693', 31 | 'is_premium' => true, 32 | 'premium_suffix' => 'Pro', 33 | 'has_addons' => false, 34 | 'has_paid_plans' => true, 35 | 'menu' => array( 36 | 'slug' => 'bsearch_dashboard', 37 | 'contact' => false, 38 | 'support' => false, 39 | 'network' => true, 40 | ), 41 | 'is_live' => true, 42 | ) 43 | ); 44 | } 45 | $bsearch_freemius->add_filter( 'plugin_icon', __NAMESPACE__ . '\\bsearch_freemius_get_plugin_icon' ); 46 | $bsearch_freemius->add_filter( 'after_uninstall', __NAMESPACE__ . '\\bsearch_freemius_uninstall' ); 47 | return $bsearch_freemius; 48 | } 49 | 50 | /** 51 | * Get the plugin icon. 52 | * 53 | * @return string 54 | */ 55 | function bsearch_freemius_get_plugin_icon() { 56 | return __DIR__ . '/admin/images/bsearch-icon.png'; 57 | } 58 | 59 | /** 60 | * Uninstall the plugin. 61 | */ 62 | function bsearch_freemius_uninstall() { 63 | require_once dirname( __DIR__ ) . '/uninstaller.php'; 64 | if ( bsearch_freemius()->can_use_premium_code__premium_only() ) { 65 | \WebberZone\Better_Search\Pro\Pro::uninstall_pro(); 66 | } 67 | } 68 | 69 | // Init Freemius. 70 | bsearch_freemius(); 71 | // Signal that SDK was initiated. 72 | do_action( 'bsearch_freemius_loaded' ); 73 | -------------------------------------------------------------------------------- /includes/util/class-cache.php: -------------------------------------------------------------------------------- 1 | delete(); 45 | 46 | wp_send_json_success( 47 | array( 48 | 'message' => sprintf( _n( '%s entry cleared', '%s entries cleared', $count, 'better-search' ), number_format_i18n( $count ) ), 49 | ) 50 | ); 51 | } 52 | 53 | /** 54 | * Delete the Better Search cache. 55 | * 56 | * @since 3.3.0 57 | * 58 | * @param array $transients Array of transients to delete. 59 | * @return int Number of transients deleted. 60 | */ 61 | public static function delete( $transients = array() ) { 62 | $loop = 0; 63 | 64 | $default_transients = self::get_keys(); 65 | 66 | if ( ! empty( $transients ) ) { 67 | $transients = array_intersect( $default_transients, (array) $transients ); 68 | } else { 69 | $transients = $default_transients; 70 | } 71 | 72 | foreach ( $transients as $transient ) { 73 | $del = delete_transient( $transient ); 74 | if ( $del ) { 75 | ++$loop; 76 | } 77 | } 78 | return $loop; 79 | } 80 | 81 | /** 82 | * Get the default meta keys used for the cache 83 | * 84 | * @return array Transient meta keys 85 | */ 86 | public static function get_keys() { 87 | 88 | global $wpdb; 89 | 90 | $keys = array(); 91 | 92 | $sql = " 93 | SELECT option_name 94 | FROM {$wpdb->options} 95 | WHERE `option_name` LIKE '_transient_bs_%' 96 | "; 97 | 98 | $results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared 99 | 100 | if ( is_array( $results ) ) { 101 | foreach ( $results as $result ) { 102 | $keys[] = str_replace( '_transient_', '', $result->option_name ); 103 | } 104 | } 105 | 106 | return apply_filters( 'bsearch_cache_get_keys', $keys ); 107 | } 108 | 109 | /** 110 | * Get the meta key based on a list of parameters. 111 | * 112 | * @param mixed $attr Array of attributes typically. 113 | * @param string $context Context of the cache key to be set. 114 | * @return string Cache meta key 115 | */ 116 | public static function get_key( $attr, $context = 'query' ) { 117 | 118 | $key = sprintf( 'bs_cache_%1$s_%2$s', md5( wp_json_encode( $attr ) ), $context ); 119 | 120 | return $key; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Generally-applicable sniffs for WordPress plugins 4 | 5 | . 6 | */node_modules/* 7 | */phpunit/* 8 | */vendor/* 9 | */tests/* 10 | */index.php 11 | */index.asset.php 12 | */freemius/* 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | */phpunit/tests/*\.php$ 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | includes: 2 | - phpstan-baseline.neon 3 | parameters: 4 | level: 5 5 | paths: 6 | - better-search.php 7 | - uninstaller.php 8 | - includes/ 9 | - templates/ 10 | scanDirectories: 11 | - includes/ 12 | - templates/ 13 | - freemius/ 14 | scanFiles: 15 | - better-search.php 16 | - uninstaller.php 17 | ignoreErrors: 18 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | phpunit/tests/ 15 | 16 | 17 | 18 | 19 | 20 | ./src/ 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /phpunit/bootstrap.php: -------------------------------------------------------------------------------- 1 | [db-host] [wp-version]" 5 | exit 1 6 | fi 7 | 8 | DB_NAME=$1 9 | DB_USER=$2 10 | DB_PASS=$3 11 | DB_HOST=${4-localhost} 12 | WP_VERSION=${5-latest} 13 | 14 | TMPDIR=${TMPDIR-/tmp} 15 | TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") 16 | WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} 17 | WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} 18 | 19 | if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then 20 | WP_TESTS_TAG="branches/$WP_VERSION" 21 | elif [[ $WP_VERSION == 'trunk' ]]; then 22 | WP_TESTS_TAG="trunk" 23 | else 24 | LATEST_VERSION=$( curl -s https://api.wordpress.org/core/version-check/1.1/ | tail -1 ) 25 | if [[ -z "$LATEST_VERSION" ]]; then 26 | echo "Latest WordPress version could not be found" 27 | exit 1 28 | fi 29 | WP_TESTS_TAG="tags/$LATEST_VERSION" 30 | fi 31 | 32 | set -ex 33 | 34 | install_wp_and_test_suite() { 35 | # setup up WordPress 36 | if [ ! -d $WP_CORE_DIR ]; then 37 | mkdir -p $WP_CORE_DIR 38 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/src/ $WP_CORE_DIR 39 | fi 40 | 41 | # set up testing suite if it doesn't yet exist 42 | if [ ! -d $WP_TESTS_DIR ]; then 43 | # set up testing suite 44 | mkdir -p $WP_TESTS_DIR 45 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes 46 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data 47 | fi 48 | 49 | if [ ! -f wp-tests-config.php ]; then 50 | curl -s https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php > "$WP_TESTS_DIR"/wp-tests-config.php 51 | # remove all forward slashes in the end 52 | WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") 53 | sed -i "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php 54 | sed -i "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php 55 | sed -i "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php 56 | sed -i "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php 57 | sed -i "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php 58 | fi 59 | 60 | } 61 | 62 | install_db() { 63 | # parse DB_HOST for port or socket references 64 | local PARTS=(${DB_HOST//\:/ }) 65 | local DB_HOSTNAME=${PARTS[0]}; 66 | local DB_SOCK_OR_PORT=${PARTS[1]}; 67 | local EXTRA="" 68 | 69 | if ! [ -z $DB_HOSTNAME ] ; then 70 | if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then 71 | EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" 72 | elif ! [ -z $DB_SOCK_OR_PORT ] ; then 73 | EXTRA=" --socket=$DB_SOCK_OR_PORT" 74 | elif ! [ -z $DB_HOSTNAME ] ; then 75 | EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" 76 | fi 77 | fi 78 | 79 | # create database 80 | mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA 81 | } 82 | 83 | install_wp_and_test_suite 84 | install_db 85 | -------------------------------------------------------------------------------- /phpunit/tests/test-sample.php: -------------------------------------------------------------------------------- 1 | assertTrue( true ); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /security.md: -------------------------------------------------------------------------------- 1 | # How can I report security bugs? 2 | 3 | You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/better-search) 4 | -------------------------------------------------------------------------------- /templates/better-search-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 6 |
    7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
    16 | 17 | 18 |
    19 | 20 |
    21 | 22 |
    23 | 24 | 25 | -------------------------------------------------------------------------------- /templates/index.php: -------------------------------------------------------------------------------- 1 | 0, 20 | 'spam' => 0, 21 | 'deleted' => 0, 22 | ) 23 | ); 24 | 25 | foreach ( $sites as $site ) { 26 | switch_to_blog( (int) $site->blog_id ); 27 | bsearch_delete_data(); 28 | restore_current_blog(); 29 | } 30 | } else { 31 | bsearch_delete_data(); 32 | } 33 | 34 | 35 | /** 36 | * Delete plugin data. 37 | * 38 | * @since 2.5.0 39 | */ 40 | function bsearch_delete_data() { 41 | global $wpdb; 42 | 43 | if ( is_plugin_active( 'better-search-pro/better-search.php' ) ) { 44 | return; 45 | } 46 | 47 | if ( defined( 'BETTER_SEARCH_DELETE_DATA' ) && BETTER_SEARCH_DELETE_DATA ) { 48 | $wpdb->query( 'DROP TABLE ' . $wpdb->prefix . 'bsearch' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 49 | $wpdb->query( 'DROP TABLE ' . $wpdb->prefix . 'bsearch_daily' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 50 | } 51 | 52 | delete_option( 'ald_bsearch_settings' ); 53 | delete_option( 'bsearch_settings' ); 54 | delete_option( 'bsearch_db_version' ); 55 | delete_site_option( 'better_search_selected_sites' ); 56 | 57 | $wpdb->query( 'ALTER TABLE ' . $wpdb->posts . ' DROP INDEX bsearch' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 58 | $wpdb->query( 'ALTER TABLE ' . $wpdb->posts . ' DROP INDEX bsearch_title' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 59 | $wpdb->query( 'ALTER TABLE ' . $wpdb->posts . ' DROP INDEX bsearch_content' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 60 | 61 | // Drop fuzzy functions. 62 | $wpdb->query( 'DROP FUNCTION IF EXISTS wz_levenshtein' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 63 | $wpdb->query( 'DROP FUNCTION IF EXISTS wz_phrase_similarity_levenshtein' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 64 | $wpdb->query( 'DROP FUNCTION IF EXISTS wz_phrase_similarity_soundex' ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery 65 | 66 | $sql = " 67 | SELECT option_name 68 | FROM {$wpdb->options} 69 | WHERE `option_name` LIKE '_transient_bs_%' 70 | "; 71 | 72 | $results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared 73 | 74 | if ( is_array( $results ) ) { 75 | foreach ( $results as $result ) { 76 | $transient = str_replace( '_transient_', '', $result->option_name ); 77 | delete_transient( $transient ); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /wpml-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /wporg-assets/banner-1544x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/banner-1544x500.png -------------------------------------------------------------------------------- /wporg-assets/banner-772x250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/banner-772x250.png -------------------------------------------------------------------------------- /wporg-assets/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/icon-128x128.png -------------------------------------------------------------------------------- /wporg-assets/icon-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/icon-256x256.png -------------------------------------------------------------------------------- /wporg-assets/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/screenshot-1.png -------------------------------------------------------------------------------- /wporg-assets/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/screenshot-2.png -------------------------------------------------------------------------------- /wporg-assets/screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebberZone/better-search/0951982d5bff8eac50dba4d929740a6d5f383aab/wporg-assets/screenshot-3.png --------------------------------------------------------------------------------