├── .eslintignore ├── .eslintrc.js ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .prettierrc ├── .travis.yml ├── LICENSE ├── README.md ├── assets ├── css │ ├── adminiconstyle.css │ ├── base-admin.css │ ├── boldgrid-cart.css │ ├── boldgrid-dashboard.css │ ├── boldgrid-feedback.css │ ├── boldgrid-in-menu.css │ ├── boldgrid-inspirations.css │ ├── boldgrid-login.css │ ├── bootstrap │ │ └── bootstrap.min.css │ ├── easy-attachment-preview-size.css │ ├── fancybox.css │ ├── grid.css │ ├── my-inspiration.css │ ├── purchase_for_publish.css │ └── wp_iframe-media_upload.css ├── fonts │ ├── boldgrid.eot │ ├── boldgrid.svg │ ├── boldgrid.ttf │ └── boldgrid.woff ├── images │ ├── bg-coin-toolbar-graphic.png │ ├── bg-logo.svg │ ├── bg-seal.png │ ├── boldgrid-login-logo.png │ ├── bullet-selected.png │ ├── bullet-unselected.png │ ├── categoryarrow.png │ ├── cc │ │ └── cc.png │ ├── continue-rightarrow.png │ ├── customize.png │ ├── fancybox │ │ ├── blank.gif │ │ ├── fancybox_loading.gif │ │ ├── fancybox_loading@2x.gif │ │ ├── fancybox_overlay.png │ │ ├── fancybox_sprite.png │ │ └── fancybox_sprite@2x.png │ ├── goback-leftarrow.png │ ├── inspirations │ │ ├── arrow-left-filled.png │ │ ├── arrow-right-filled.png │ │ ├── arrow.png │ │ ├── cache │ │ │ └── w3-total-cache.png │ │ ├── click.png │ │ ├── contact-info-close-24ac47.png │ │ ├── features-templates-gridpic.png │ │ ├── features-themes-gridpic.png │ │ ├── fill.png │ │ ├── header-bg.png │ │ └── invoice │ │ │ └── sprout-invoices.png │ ├── minus.png │ ├── mobile-active.png │ ├── mobile-inactive.png │ ├── mobile.png │ ├── monitor-active.png │ ├── monitor-inactive.png │ ├── plus.png │ ├── preview-eye.png │ ├── previewbg1.png │ ├── search-glass.png │ ├── select-thumb.png │ ├── step1-active.png │ ├── step1-inactive.png │ ├── step2-active.png │ ├── step2-inactive.png │ ├── step3-active.png │ ├── step3-inactive.png │ ├── steps-arrow.png │ ├── steps-arrow1.png │ ├── steps-checkmark.png │ ├── steps-gear.png │ ├── tablet-active.png │ ├── tablet-inactive.png │ ├── tablet.png │ ├── wordpressinmotion.png │ ├── wordpresslogo.png │ └── wordpresswebhostinghub.png └── js │ ├── ajax │ └── ajax.js │ ├── all-pages-mine-count.js │ ├── base-admin.js │ ├── boldgrid-admin-notices.js │ ├── boldgrid-cart.js │ ├── boldgrid-feedback.js │ ├── boldgrid-inspirations.js │ ├── boldgrid-options.js │ ├── boldgrid-options.min.js │ ├── easy-attachment-preview-size.js │ ├── fancybox.js │ ├── handlebars │ ├── handle-bar-helpers.js │ ├── handlebars-v2.0.0.js │ └── templates │ │ ├── category.php │ │ ├── language.php │ │ ├── pagesetversion.php │ │ ├── preview.php │ │ ├── subcategory.php │ │ ├── theme.php │ │ ├── themegroup.php │ │ └── themeversion.php │ ├── image_search.js │ ├── inline │ ├── checking_out.js │ ├── checking_out_complete.js │ ├── checking_out_complete_with_errors.js │ ├── hide_plugin_list_during_installation.js │ └── print_pointers_in_header.js │ ├── insert-media-tab-manager.js │ ├── lazyload.js │ ├── manage_menu_assignment_within_editor.js │ ├── my-inspiration.js │ ├── screen │ └── id │ │ ├── appearance_page_staged-theme.js │ │ ├── media_page_boldgrid-connect-search.js │ │ ├── page.js │ │ ├── toplevel_page_boldgrid-inspirations.js │ │ └── upload.js │ ├── tinymce-plugin.js │ └── transaction_history.js ├── bin └── install-wp-tests.sh ├── boldgrid-inspirations.php ├── composer.json ├── composer.lock ├── includes ├── class-boldgrid-inspirations-admin-menu.php ├── class-boldgrid-inspirations-admin-notices.php ├── class-boldgrid-inspirations-ajax.php ├── class-boldgrid-inspirations-api.php ├── class-boldgrid-inspirations-asset-manager.php ├── class-boldgrid-inspirations-attachment.php ├── class-boldgrid-inspirations-attribution-asset.php ├── class-boldgrid-inspirations-attribution-page.php ├── class-boldgrid-inspirations-attribution-update.php ├── class-boldgrid-inspirations-attribution.php ├── class-boldgrid-inspirations-blog.php ├── class-boldgrid-inspirations-branding.php ├── class-boldgrid-inspirations-built.php ├── class-boldgrid-inspirations-cache.php ├── class-boldgrid-inspirations-coins.php ├── class-boldgrid-inspirations-config.php ├── class-boldgrid-inspirations-customizer.php ├── class-boldgrid-inspirations-dashboard-widget.php ├── class-boldgrid-inspirations-dashboard.php ├── class-boldgrid-inspirations-deploy-api.php ├── class-boldgrid-inspirations-deploy-bps.php ├── class-boldgrid-inspirations-deploy-cta.php ├── class-boldgrid-inspirations-deploy-image.php ├── class-boldgrid-inspirations-deploy-messages.php ├── class-boldgrid-inspirations-deploy-metadata.php ├── class-boldgrid-inspirations-deploy-pages.php ├── class-boldgrid-inspirations-deploy-post.php ├── class-boldgrid-inspirations-deploy-status.php ├── class-boldgrid-inspirations-deploy-theme.php ├── class-boldgrid-inspirations-deploy.php ├── class-boldgrid-inspirations-easy-attachment-preview-size.php ├── class-boldgrid-inspirations-enable-media-replace.php ├── class-boldgrid-inspirations-external-plugin.php ├── class-boldgrid-inspirations-feedback.php ├── class-boldgrid-inspirations-file.php ├── class-boldgrid-inspirations-filter-storage.php ├── class-boldgrid-inspirations-image-utility.php ├── class-boldgrid-inspirations-inspiration.php ├── class-boldgrid-inspirations-install-backup.php ├── class-boldgrid-inspirations-installed.php ├── class-boldgrid-inspirations-my-inspiration.php ├── class-boldgrid-inspirations-onboarding-progress.php ├── class-boldgrid-inspirations-onboarding-tasks.php ├── class-boldgrid-inspirations-options.php ├── class-boldgrid-inspirations-pages-and-posts.php ├── class-boldgrid-inspirations-purchase-coins.php ├── class-boldgrid-inspirations-purchase-for-publish.php ├── class-boldgrid-inspirations-receipts.php ├── class-boldgrid-inspirations-redirect.php ├── class-boldgrid-inspirations-screen.php ├── class-boldgrid-inspirations-staging.php ├── class-boldgrid-inspirations-start-over.php ├── class-boldgrid-inspirations-stock-photography.php ├── class-boldgrid-inspirations-survey.php ├── class-boldgrid-inspirations-theme-install.php ├── class-boldgrid-inspirations-update.php ├── class-boldgrid-inspirations-utility.php ├── class-boldgrid-inspirations-widget.php ├── class-boldgrid-inspirations-wp-help-pointers.php ├── class-boldgrid-inspirations.php ├── config │ ├── .gitignore │ ├── config.onboarding.php │ ├── config.plugin.php │ ├── config.sample.php │ ├── networks.config.php │ └── survey.config.php ├── configure_plugin │ ├── contact-form-7.php │ └── wc-gallery.php ├── deploy │ ├── class-author-ids.php │ ├── class-cache.php │ ├── class-crio-premium-utility.php │ ├── class-crio-utility.php │ ├── class-invoice.php │ ├── class-logo.php │ ├── class-menus.php │ ├── class-post-meta.php │ ├── class-social-menu.php │ └── invoice │ │ ├── forms │ │ └── get-a-quote.json │ │ └── posts │ │ └── get-a-quote.php ├── onboarding │ ├── class-task-card.php │ └── class-task.php ├── sprout │ └── class-utility.php ├── w3tc │ └── class-utility.php └── weforms │ └── class-utility.php ├── languages ├── boldgrid-inspirations-de_DE.mo ├── boldgrid-inspirations-de_DE.po └── boldgrid-inspirations.pot ├── package.json ├── pages ├── attribution.php ├── boldgrid-inspirations.php ├── cart.php ├── cart │ └── checking-out.php ├── deploy.php ├── image_search.php ├── includes │ ├── boldgrid-inspirations │ │ ├── contact.php │ │ └── menu.php │ ├── boldgrid-settings │ │ └── start_over.php │ ├── browse_category.php │ ├── cart_header.php │ └── post_submitbox_misc_actions_auto_add_to_menu.php ├── my-inspiration.php ├── purchase_coins.php ├── templates │ ├── attachment_details.php │ ├── boldgrid-connection-issue.php │ ├── boldgrid-inspirations.php │ ├── feedback-notice-1-1.php │ ├── feedback-widget.php │ ├── image_search_results.php │ ├── restrict-direct-access.php │ ├── settings-saved.php │ ├── transaction_history.php │ ├── unauthorized-request.php │ └── widget_customization.php └── transaction_history.php ├── phpunit.xml ├── readme.txt ├── tests ├── bootstrap.php └── test-boldgrid-inspiration.php ├── uninstall.php └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | assets/js/fancybox.js 2 | assets/js/handlebars/ 3 | assets/js/jquery-toggles/ 4 | assets/js/lazyload.js 5 | vendor/ 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | env: { 6 | browser: true 7 | }, 8 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 9 | extends: 'wordpress', 10 | plugins: [ 11 | 'html' 12 | ], 13 | // Add your custom rules here 14 | 'rules': { 15 | 'space-in-parens': ['error', 'always'], 16 | "wrap-iife": [2, "any"], 17 | // Allow async-await 18 | 'generator-star-spacing': 0, 19 | // Allow debugger during development 20 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | error_log 3 | *.swp 4 | logs* 5 | .buildpath 6 | .project 7 | .settings 8 | node_modules 9 | vendor 10 | assets/css/font-awesome/ 11 | assets/css/jquery-toggles/ 12 | assets/js/jquery-toggles/ 13 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "bracketSpacing": true, 4 | "useTabs": true, 5 | "singleQuote": true 6 | } 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | # Distrubution / environments: https://docs.travis-ci.com/user/reference/overview/ 4 | # Ubuntu Trusty does not support php8: https://docs.travis-ci.com/user/languages/php/ 5 | dist: xenial 6 | 7 | services: 8 | # Specifically including MySQL was not needed with Trusty, but other environments do need it. 9 | - mysql 10 | 11 | notifications: 12 | email: 13 | on_success: never 14 | on_failure: change 15 | slack: 16 | secure: "hku/sEQX6jMCmLaZx7GciHru54QkLwBmovONr3jMDBV5C1GxIDkmCvcmFiIGqQ9neMsL615diGN2tBqUXe90kqsy7vkUer75/8wCR47ClPXEmFns2f4bAG2/DRU/Zd6myWe5n/703j9WhS/IKTc85sVoxiJ+rrgGDmY5b5xG3huatRVE5clYD+c9dnIgj/upebgyytsLzOnHarqb/lYQ5dV51CQkYUnRa4RaY5tbrxxq6H0LllRLWe/tDCd+LH+ktnmCFHgdg9YG01RXd6HiIrzBiAqFVQ9HbnZlWbW1kfTJqPgH7sSN3+4CYnKiOZbMbJTVLapoOgkINJ515WVmZAx/9XEBeOnoK14QweusiThXCVdTGi01bcsSDs9DR9cUImHjutPf7v1p9U7lubk7hZ1k8c21lvpWV/IANm55QyXVulTI9P+j1bpTPhMWAgpw+KvzR/5tsq1FnsY14jpUAzkNYSI9BOb95BKz+utn3MOEk+OuuI4Fhmdfmr8ptpc5J5UChA8hmBI81WsKUjX4SsEk3FCOUhSAN4UGrAcZQDdXwhNJ5CgUo/s/fkOVRHgInMq5BaCLkMCBMDiYEG7gQdlqg4zHfBljHg0vkp2FTkja20e+gZFCxzoGWG4wt0nbzOO6qQ5rcWyStQwfq2nvw5Fyo+kcHXfNV7dYHyxQQ3I=" 17 | 18 | matrix: 19 | include: 20 | - php: 7.4 21 | before_script: 22 | - nvm install 10 23 | - nvm use 10 24 | - yarn 25 | - composer self-update --1 26 | - composer install -o 27 | - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION 28 | - php: 8.0 29 | before_script: 30 | - nvm install 10 31 | - nvm use 10 32 | - yarn 33 | - composer self-update --1 34 | # Lock file has phpunit 7. Remove it and install latest phpunit for php 8. 35 | - composer remove --dev phpunit/phpunit 36 | - composer require --dev phpunit/phpunit 37 | - composer install -o 38 | - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION 39 | 40 | env: 41 | - WP_VERSION=latest WP_MULTISITE=0 42 | 43 | script: 44 | - find . -name composer -prune -o -name node_modules -prune -o -name '*.php' -exec php -lf {} \; > /dev/null 45 | - vendor/phpunit/phpunit/phpunit --debug 46 | # Composer install was run above in the matrix, and included dev scripts. Run it again with --no-dev 47 | # to remove them. 48 | - composer install -o --no-dev 49 | before_deploy: 50 | - yes | gem update --system --force 51 | - gem install bundler 52 | - gem install uri 53 | - gem install logger 54 | deploy: 55 | - provider: releases 56 | api_key: "${GITHUB_TOKEN}" 57 | file: "boldgrid-inspirations.zip" 58 | skip_cleanup: true 59 | on: 60 | tags: true 61 | php: 7.4 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BoldGrid Inspirations # 2 | 3 | [![License](https://img.shields.io/badge/license-GPL--2.0%2B-orange.svg)](https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/master/LICENSE) 4 | [![Build Status](https://travis-ci.org/BoldGrid/boldgrid-backup.svg?branch=master)](https://travis-ci.org/BoldGrid/boldgrid-inspirations) 5 | [![PHP Version](https://img.shields.io/badge/PHP-5.4%2B-blue.svg)](https://php.net) 6 | 7 | BoldGrid Inspirations is an inspiration-driven plugin to assist with creating a fresh new website, or to customize an existing website. 8 | 9 | ## Description ## 10 | 11 | BoldGrid Inspirations is an inspiration-driven plugin to assist with creating a fresh new website, or to customize an existing website. 12 | 13 | The first phase is Inspiration; the guided tool creates your base website. If you already have a website, then you can skip this step. 14 | 15 | The second phase is Customization; tools to transform your website into your vision. 16 | 17 | ## Installation ## 18 | 19 | ### Minimum Requirements ### 20 | 21 | * PHP 5.4 or higher. PHP 7.3 or higher is recommended. 22 | * PHP cURL. 23 | * PHP setting "opcache.save_comments = 1" 24 | * PHP setting "opcache.load_comments = 1" 25 | 26 | ### Manually ### 27 | 1. Upload the entire boldgrid-inspirations folder to the /wp-content/plugins/ directory. 28 | 1. Run the development build commands to install the dependencies. 29 | 1. Activate the plugin through the Plugins menu in WordPress. 30 | 31 | ## Development ## 32 | 33 | Before you can use the development version of this plugin you must install the dependencies. 34 | 35 | ``` 36 | yarn 37 | composer install -o 38 | ``` 39 | -------------------------------------------------------------------------------- /assets/css/adminiconstyle.css: -------------------------------------------------------------------------------- 1 | /** 2 | * #.# Error alerts. 3 | * 4 | * These styles appear to be used by the BoldGrid library. @todo, confirm and move them to the library. 5 | */ 6 | 7 | .error-alerts { 8 | color: red; 9 | } 10 | 11 | .error-color::before { 12 | content: '*'; 13 | padding-right: 5px; 14 | } 15 | 16 | .error-color { 17 | color: red; 18 | } 19 | 20 | /** 21 | * #.# Theme install. 22 | * 23 | * These styles are for theme-install.php 24 | */ 25 | 26 | .theme-install-php #recommend-boldgrid p { 27 | margin: 0; 28 | position: relative; 29 | } 30 | 31 | .theme-install-php #recommend-boldgrid .recommend-boldgrid-text { 32 | padding-left: 41px; 33 | display: inline-block; 34 | left: 18px; 35 | padding-top: 10px; 36 | padding-bottom: 10px; 37 | } 38 | 39 | .theme-install-php .boldgrid-cert, 40 | .theme-install-php .theme[aria-describedby*="boldgrid-"] .theme-name:after { 41 | background: url(../images/bg-seal.png) no-repeat; 42 | } 43 | 44 | .theme-install-php .theme[aria-describedby*="boldgrid-"] .theme-name:after { 45 | content: ' '; 46 | width: 40px; 47 | height: 40px; 48 | display: block; 49 | position: absolute; 50 | left: -6px; 51 | bottom: 36px; 52 | background-size: 37px auto; 53 | } 54 | 55 | .theme-install-php .theme[aria-describedby*="boldgrid-"] .theme-name:before { 56 | content: 'Certified'; 57 | display: block; 58 | width: 100%; 59 | height: 18px; 60 | background: #262626; /* Old browsers */ 61 | background: -moz-linear-gradient(left, #262626 0%, #ffffff 100%); /* FF3.6-15 */ 62 | background: -webkit-linear-gradient(left, #262626 0%,#ffffff 100%); /* Chrome10-25,Safari5.1-6 */ 63 | background: linear-gradient(to right, #262626 0%,#ffffff 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ 64 | background-size: 100% 100%; 65 | padding: 2px 0px; 66 | position: absolute; 67 | bottom: 48px; 68 | left: 0px; 69 | color: white; 70 | text-transform: uppercase; 71 | text-indent: 38px; 72 | font-size: 10px; 73 | font-family: Josefin Sans; 74 | letter-spacing: .1em; 75 | font-weight: 500; 76 | } 77 | 78 | .theme-install-php .boldgrid-cert { 79 | width: 39px; 80 | height: 44px; 81 | display: inline-block; 82 | position: absolute; 83 | top: 50%; 84 | transform: translateY(-50%); 85 | } 86 | 87 | .theme-install-php .boldgrid-cert { 88 | background-position: -1px 5px; 89 | } 90 | 91 | #toplevel_page_boldgrid-inspirations span.bginsp-progress.complete { 92 | display: none; 93 | } 94 | 95 | #toplevel_page_boldgrid-inspirations span.bginsp-progress { 96 | background: green; 97 | padding: 2px 4px; 98 | border-radius: 35%; 99 | color: white; 100 | font-weight: 600; 101 | } 102 | -------------------------------------------------------------------------------- /assets/css/boldgrid-cart.css: -------------------------------------------------------------------------------- 1 | .container-fluid { 2 | max-width: 1024px; 3 | margin: 10px 0px 0px 0px; 4 | padding-left: 0px; 5 | padding-right: 0px; 6 | } 7 | 8 | .plugin-card-top .col-md-3 { 9 | width: 23%; 10 | padding: 0px; 11 | margin: 1%; 12 | } 13 | 14 | .plugin-card-top .col-md-3>div:first-child { 15 | border: 1px solid #ddd; 16 | padding: 10px; 17 | min-height: 64px; 18 | } 19 | 20 | .image-info { 21 | position: absolute; 22 | bottom: 10px; 23 | right: 10px; 24 | } 25 | 26 | .image-dimensions:before { 27 | content: "\f165"; 28 | display: inline-block; 29 | -webkit-font-smoothing: antialiased; 30 | font: normal 17px/1 'dashicons'; 31 | vertical-align: top; 32 | margin-right: 7px; 33 | margin-bottom: 5px; 34 | color: #a8a8a8; 35 | } 36 | 37 | .col-md-3 .spinner, 38 | #purchase_for_publish .image-select { 39 | position: absolute; 40 | top: 10px; 41 | right: 10px; 42 | margin: 0px; 43 | } 44 | 45 | /* 46 | * When an ajax call is being made to update the checked_in_cart attribute, all other checkboxes are 47 | * disabled. Change the cursor to show users they are disabled. 48 | */ 49 | #purchase_for_publish input[disabled] { 50 | cursor: progress; 51 | } 52 | 53 | .image-thumbnail { 54 | max-width: 40%; 55 | } 56 | 57 | .row-title { 58 | text-decoration: none; 59 | } 60 | 61 | .cart-summary .row { 62 | margin-left: 0px; 63 | margin-right: 0px; 64 | } 65 | 66 | .text-right { 67 | text-align: right; 68 | } 69 | 70 | /* cart-summary ************************************************************ */ 71 | hr { 72 | margin: 0px; 73 | } 74 | 75 | .cart-summary { 76 | margin-top: 15px; 77 | } 78 | 79 | .cart-summary .col-md-6.col-md-offset-6 { 80 | padding: 0px; 81 | } 82 | 83 | .cart-summary table tbody tr:first-child td { 84 | padding-bottom: 10px; 85 | } 86 | 87 | .cart-summary .plugin-card-top { 88 | min-height: initial; 89 | padding: 10px; 90 | } 91 | 92 | /* When you unselect an image, add opacity to show it is not selected */ 93 | .unselected-image { 94 | opacity: 0.3; 95 | background-color: #ddd; 96 | } 97 | 98 | .unselected-image .image-select{ 99 | outline: 1px solid #000; 100 | outline-offset: -2px; 101 | } 102 | 103 | /* When you hover over a page title, show the "Edit | View" links */ 104 | .row:hover div.row-actions { 105 | visibility: visible; 106 | } 107 | 108 | /* When we add the error class to plugin-card, it makes all borders red. We only want the left border changed. */ 109 | .plugin-card.error { 110 | border-top: 0px; 111 | border-right: 0px; 112 | border-bottom: 0px; 113 | } -------------------------------------------------------------------------------- /assets/css/boldgrid-dashboard.css: -------------------------------------------------------------------------------- 1 | /** BoldGrid Feedback Widget Styles **/ 2 | #boldgrid_feedback_widget select, 3 | #boldgrid_feedback_widget textarea, 4 | #boldgrid_feedback_widget input[type="text"] { 5 | width: 100%; 6 | } 7 | #boldgrid_feedback_widget .feedback-form-label { 8 | padding: .4em 0; 9 | } 10 | #boldgrid_feedback_widget #feedback-email-address, 11 | #boldgrid_feedback_widget #feedback-comment-area { 12 | display: none; 13 | } 14 | -------------------------------------------------------------------------------- /assets/css/boldgrid-feedback.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file should not be auto formatted. 3 | */ 4 | 5 | /* feedback-notice-1-1 . */ 6 | 7 | .feedback-form-label { 8 | float: left; 9 | font-weight: bold; 10 | margin-top: 11px; 11 | width: 170px; 12 | } 13 | 14 | .feedback-form-field { 15 | margin-top: 7px; 16 | margin-bottom: 7px; 17 | } 18 | 19 | #feedback-comment-area, 20 | #feedback-email-address, 21 | #feedback-diagnostic-report, 22 | #feedback-submit { 23 | display: none; 24 | } 25 | 26 | #feedback-notice-1-1 .boldgrid-icon:before { 27 | color: #f95b26; 28 | font-size: 41px; 29 | overflow: hidden; 30 | padding-right: 15px !important; 31 | } 32 | 33 | #feedback-notice-1-1-header .boldgrid-icon { 34 | float: left; 35 | margin-top: 21px; 36 | } 37 | 38 | #feedback-notice-1-1-intro h2 { 39 | margin-top: 10px; 40 | margin-bottom: 10px; 41 | } 42 | 43 | #boldgrid_feedback_widget #feedback-notice-1-1-intro p { 44 | margin: 0; 45 | } 46 | 47 | #feedback-notice-1-1-intro p { 48 | margin-top: -5px; 49 | margin-bottom: -5px; 50 | margin-left: 56px; 51 | overflow: hidden; 52 | } 53 | 54 | #feedback-notice-1-1-content { 55 | margin-top: 15px; 56 | } 57 | 58 | #feedback-email { 59 | margin-top: 7px; 60 | } 61 | 62 | #feedback-diagnostic-text { 63 | margin-top: 7px; 64 | } 65 | 66 | .feedback-form-field #feedback-submit { 67 | margin-top: 10px; 68 | margin-bottom: 10px; 69 | } 70 | 71 | #feedback-error-message { 72 | color: #ff0000; 73 | display: none; 74 | font-weight: bold; 75 | } 76 | 77 | #boldgrid-feedback-form .spinner { 78 | float: none; 79 | margin-top: 14px; 80 | } 81 | -------------------------------------------------------------------------------- /assets/css/boldgrid-in-menu.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This file should not be auto formatted. 3 | */ 4 | 5 | 6 | .boldgrid-auto-add-to-menu:before { 7 | content: "\f203"; 8 | font: 400 20px/1 dashicons; 9 | speak: none; 10 | display: inline-block; 11 | padding: 0 2px 0 0; 12 | top: 0; 13 | left: -1px; 14 | position: relative; 15 | vertical-align: top; 16 | -webkit-font-smoothing: antialiased; 17 | -moz-osx-font-smoothing: grayscale; 18 | text-decoration: none !important; 19 | color: #82878c; 20 | } 21 | 22 | #boldgrid-auto-add-to-menu-menu-listing { 23 | margin-top: 3px; 24 | } 25 | 26 | #boldgrid-auto-add-to-menu-menu-listing ul{ 27 | font-size: 12px; 28 | list-style: disc outside none !important; 29 | margin: 0px; 30 | padding-left: 30px; 31 | } 32 | 33 | .hide-boldgrid-auto-add-to-menu.button { 34 | margin-top: 8px; 35 | } 36 | 37 | #selected-menu-names { 38 | font-weight: bold; 39 | } 40 | -------------------------------------------------------------------------------- /assets/css/boldgrid-login.css: -------------------------------------------------------------------------------- 1 | body.login { 2 | background: #F1F1F1; 3 | } 4 | .login h1 a { 5 | background-size: 318px 158px; 6 | background-position: center top; 7 | background-repeat: no-repeat; 8 | color: #999; 9 | height: 159px; 10 | font-size: 20px; 11 | font-weight: normal; 12 | line-height: 1.3em; 13 | margin: 0 auto 25px; 14 | padding: 0; 15 | text-decoration: none; 16 | width: 318px; 17 | text-indent: -9999px; 18 | outline: none; 19 | overflow: hidden; 20 | display: block; 21 | } 22 | .login #login_error { 23 | border-left: 4px solid firebrick; 24 | background: #fff; 25 | } 26 | .login .message { 27 | border-left: 4px solid #00a0d2; 28 | background-color: #fff; 29 | } 30 | .login .button-primary:active, 31 | .login .button-primary { 32 | border: none !important; 33 | box-shadow: none; 34 | background-color:#FF6600 !important; 35 | text-shadow: none; 36 | } 37 | input, textarea, select, a { 38 | border: 1px solid transparent; 39 | } 40 | .boldgrid-login-bottom-text { 41 | text-align:center; 42 | } 43 | .login center > img { 44 | max-height: 60px; 45 | } 46 | -------------------------------------------------------------------------------- /assets/css/easy-attachment-preview-size.css: -------------------------------------------------------------------------------- 1 | select.easy-attachment-preview-size option { 2 | background: #fff; 3 | color: #000; 4 | } 5 | 6 | select.easy-attachment-preview-size option:hover { 7 | background: #1e90ff; 8 | color: #fff; 9 | } 10 | 11 | select#image_size option.recommended_image_size:hover { 12 | background: #009E00; 13 | } 14 | 15 | div#easy_attachment_preview_size { 16 | position: fixed; 17 | top: 30px; 18 | left: 30px; 19 | background-color: rgba(51, 204, 255, 0.75); 20 | font-size: 20px; 21 | padding: 0px; 22 | border: 3px solid #33CCFF; 23 | z-index: 200000; 24 | font-weight: bold; 25 | text-shadow: rgb(221, 221, 221) 1px 1px; 26 | } 27 | 28 | div#easy_attachment_preview_size.easy_attachment_preview_size_iframed { 29 | top: 0px; 30 | left: 0px; 31 | } 32 | 33 | div#easy_attachment_preview_size.easy_attachment_preview_size_100 { 34 | font-size: 12px; 35 | line-height: 14px; 36 | } 37 | 38 | select#image_size, select.easy-attachment-preview-size { 39 | position: absolute; 40 | z-index: 300001; 41 | width: 90%; 42 | max-width: 100%; 43 | } 44 | 45 | .easy-attachment-preview-size-hidden { 46 | visibility: hidden; 47 | } 48 | 49 | label.setting { 50 | min-height: 45px; 51 | } -------------------------------------------------------------------------------- /assets/css/purchase_for_publish.css: -------------------------------------------------------------------------------- 1 | #wpadminbar #wp-admin-bar-pfp .ab-icon:before { 2 | content: "\f174"; 3 | display: inline-block; 4 | -webkit-font-smoothing: antialiased; 5 | font: normal 20px/1 'dashicons'; 6 | vertical-align: top; 7 | } 8 | 9 | li#wp-admin-bar-pfp { 10 | float: right; 11 | } 12 | 13 | #coin_balance_container { 14 | float: right; 15 | margin: 15px 15px 0px 0px; 16 | } 17 | 18 | table.receipt .thumbnail img { 19 | max-width: 60px; 20 | } 21 | 22 | table.receipt .redownload a { 23 | visibility: hidden; 24 | } 25 | 26 | table.receipt tr:hover .redownload a { 27 | visibility: visible; 28 | } 29 | 30 | /* receipts - pagination */ 31 | .tablenav .tablenav-pages a.pagination-go-to-page { 32 | border: 0px; 33 | background-color: transparent; 34 | font-size: inherit; 35 | } 36 | 37 | /* receipts - pagination */ 38 | .tablenav .tablenav-pages a.pagination-go-to-page:hover { 39 | background-color: #0073aa; 40 | } 41 | 42 | /* receipts - pagination */ 43 | .tablenav .tablenav-pages a.pagination-go-to-page.current { 44 | font-weight: bold; 45 | border-bottom: 1px solid #ccc; 46 | } 47 | 48 | /* receipts - pagination */ 49 | .pagination-links { 50 | margin-left: 50px; 51 | } 52 | 53 | /* purchase coins */ 54 | div#boldgrid-transaction-tabs + .plugin-card { 55 | margin-top: 10px; 56 | } -------------------------------------------------------------------------------- /assets/fonts/boldgrid.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/fonts/boldgrid.eot -------------------------------------------------------------------------------- /assets/fonts/boldgrid.svg: -------------------------------------------------------------------------------- 1 | Generated by IcoMoon -------------------------------------------------------------------------------- /assets/fonts/boldgrid.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/fonts/boldgrid.ttf -------------------------------------------------------------------------------- /assets/fonts/boldgrid.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/fonts/boldgrid.woff -------------------------------------------------------------------------------- /assets/images/bg-coin-toolbar-graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/bg-coin-toolbar-graphic.png -------------------------------------------------------------------------------- /assets/images/bg-logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/bg-seal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/bg-seal.png -------------------------------------------------------------------------------- /assets/images/boldgrid-login-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/boldgrid-login-logo.png -------------------------------------------------------------------------------- /assets/images/bullet-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/bullet-selected.png -------------------------------------------------------------------------------- /assets/images/bullet-unselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/bullet-unselected.png -------------------------------------------------------------------------------- /assets/images/categoryarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/categoryarrow.png -------------------------------------------------------------------------------- /assets/images/cc/cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/cc/cc.png -------------------------------------------------------------------------------- /assets/images/continue-rightarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/continue-rightarrow.png -------------------------------------------------------------------------------- /assets/images/customize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/customize.png -------------------------------------------------------------------------------- /assets/images/fancybox/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/blank.gif -------------------------------------------------------------------------------- /assets/images/fancybox/fancybox_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/fancybox_loading.gif -------------------------------------------------------------------------------- /assets/images/fancybox/fancybox_loading@2x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/fancybox_loading@2x.gif -------------------------------------------------------------------------------- /assets/images/fancybox/fancybox_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/fancybox_overlay.png -------------------------------------------------------------------------------- /assets/images/fancybox/fancybox_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/fancybox_sprite.png -------------------------------------------------------------------------------- /assets/images/fancybox/fancybox_sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/fancybox/fancybox_sprite@2x.png -------------------------------------------------------------------------------- /assets/images/goback-leftarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/goback-leftarrow.png -------------------------------------------------------------------------------- /assets/images/inspirations/arrow-left-filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/arrow-left-filled.png -------------------------------------------------------------------------------- /assets/images/inspirations/arrow-right-filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/arrow-right-filled.png -------------------------------------------------------------------------------- /assets/images/inspirations/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/arrow.png -------------------------------------------------------------------------------- /assets/images/inspirations/cache/w3-total-cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/cache/w3-total-cache.png -------------------------------------------------------------------------------- /assets/images/inspirations/click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/click.png -------------------------------------------------------------------------------- /assets/images/inspirations/contact-info-close-24ac47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/contact-info-close-24ac47.png -------------------------------------------------------------------------------- /assets/images/inspirations/features-templates-gridpic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/features-templates-gridpic.png -------------------------------------------------------------------------------- /assets/images/inspirations/features-themes-gridpic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/features-themes-gridpic.png -------------------------------------------------------------------------------- /assets/images/inspirations/fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/fill.png -------------------------------------------------------------------------------- /assets/images/inspirations/header-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/header-bg.png -------------------------------------------------------------------------------- /assets/images/inspirations/invoice/sprout-invoices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/inspirations/invoice/sprout-invoices.png -------------------------------------------------------------------------------- /assets/images/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/minus.png -------------------------------------------------------------------------------- /assets/images/mobile-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/mobile-active.png -------------------------------------------------------------------------------- /assets/images/mobile-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/mobile-inactive.png -------------------------------------------------------------------------------- /assets/images/mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/mobile.png -------------------------------------------------------------------------------- /assets/images/monitor-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/monitor-active.png -------------------------------------------------------------------------------- /assets/images/monitor-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/monitor-inactive.png -------------------------------------------------------------------------------- /assets/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/plus.png -------------------------------------------------------------------------------- /assets/images/preview-eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/preview-eye.png -------------------------------------------------------------------------------- /assets/images/previewbg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/previewbg1.png -------------------------------------------------------------------------------- /assets/images/search-glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/search-glass.png -------------------------------------------------------------------------------- /assets/images/select-thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/select-thumb.png -------------------------------------------------------------------------------- /assets/images/step1-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step1-active.png -------------------------------------------------------------------------------- /assets/images/step1-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step1-inactive.png -------------------------------------------------------------------------------- /assets/images/step2-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step2-active.png -------------------------------------------------------------------------------- /assets/images/step2-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step2-inactive.png -------------------------------------------------------------------------------- /assets/images/step3-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step3-active.png -------------------------------------------------------------------------------- /assets/images/step3-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/step3-inactive.png -------------------------------------------------------------------------------- /assets/images/steps-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/steps-arrow.png -------------------------------------------------------------------------------- /assets/images/steps-arrow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/steps-arrow1.png -------------------------------------------------------------------------------- /assets/images/steps-checkmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/steps-checkmark.png -------------------------------------------------------------------------------- /assets/images/steps-gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/steps-gear.png -------------------------------------------------------------------------------- /assets/images/tablet-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/tablet-active.png -------------------------------------------------------------------------------- /assets/images/tablet-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/tablet-inactive.png -------------------------------------------------------------------------------- /assets/images/tablet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/tablet.png -------------------------------------------------------------------------------- /assets/images/wordpressinmotion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/wordpressinmotion.png -------------------------------------------------------------------------------- /assets/images/wordpresslogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/wordpresslogo.png -------------------------------------------------------------------------------- /assets/images/wordpresswebhostinghub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/assets/images/wordpresswebhostinghub.png -------------------------------------------------------------------------------- /assets/js/ajax/ajax.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.Ajax = function( configs ) { 4 | var self = this; 5 | 6 | this.configs = configs; 7 | this.api_url = this.configs.asset_server; 8 | this.api_key = this.configs.api_key; 9 | this.site_hash = this.configs.site_hash; 10 | this.lang = BoldGridInspirationsAjax; 11 | 12 | /** 13 | * Execute an AJAX call. 14 | * 15 | * @param array data Data to sent via POST. 16 | * @param string requestUrlKey Configuration index for the URL. 17 | * @param function successAction The success/done callback function. 18 | * @param function errorAction The errorAction/fail callback function. 19 | * @param function completeAction The completeAction/always callback function. 20 | */ 21 | this.ajaxCall = function( data, requestUrlKey, successAction, errorAction, completeAction ) { 22 | self.data = data || {}; 23 | self.requestUrlKey = requestUrlKey; 24 | 25 | if ( 'function' !== typeof errorAction ) { 26 | errorAction = self.errorAction; 27 | } 28 | if ( 'function' !== typeof completeAction ) { 29 | completeAction = function() { 30 | /** No Default * */ 31 | }; 32 | } 33 | 34 | data.key = self.api_key; 35 | data.site_hash = self.site_hash; 36 | 37 | jQuery.ajax( { 38 | type : 'POST', 39 | url : self.api_url + self.configs.ajax_calls[requestUrlKey], 40 | data : data, 41 | timeout : 120000, 42 | requestHeaders : { 43 | Accept : 'application/json' 44 | }, 45 | dataType : 'json', 46 | } ) 47 | .done( successAction ) 48 | .fail ( [ 49 | errorAction, 50 | self.errorLogAction 51 | ] ) 52 | .always( completeAction ); 53 | }; 54 | 55 | /** 56 | * Error handling. 57 | */ 58 | this.errorAction = function( jqXHR, textStatus, errorThrown ) { 59 | var message, $wpbody; 60 | 61 | switch ( textStatus ) { 62 | case 'timeout': 63 | message = self.lang.timeout; 64 | break; 65 | 66 | case 'parsererror': 67 | message = self.lang.unexpected; 68 | break; 69 | 70 | default: 71 | break; 72 | } 73 | 74 | if ( window.parent.jQuery( '#wpbody-content' ).length ) { 75 | $wpbody = window.parent.jQuery( '#wpbody-content' ); 76 | } else { 77 | $wpbody = jQuery( '#wpbody-content' ); 78 | } 79 | 80 | // Provide a friendly error for comm failure, if notice is not already displayed. 81 | if ( ! window.parent.jQuery( '#container_boldgrid_connection_notice' ).length && 82 | ! jQuery( '#container_boldgrid_connection_notice' ).length ) { 83 | if ( message ) { 84 | message += '
'; 85 | } else { 86 | message = ''; 87 | } 88 | 89 | $wpbody 90 | .hide() 91 | .before( 92 | '
' + 93 | '

' + 94 | self.lang.connectionIssue + 95 | '

' + 96 | '

' + 97 | self.lang.pleaseTryAgain + 98 | '

' + 99 | '

' + 100 | self.lang.checkStatusPage + 101 | '

' + 102 | '

' + 103 | message + 104 | '' + 107 | '

' + 108 | '
' 109 | ); 110 | } 111 | }; 112 | 113 | /** 114 | * Error log handling. 115 | * 116 | * @since 1.5.8 117 | */ 118 | this.errorLogAction = function( jqXHR, textStatus, errorThrown ) { 119 | var data = { 120 | action : 'check_asset_server', 121 | data : { 122 | request : { 123 | data : self.data, 124 | requestUrlKey : self.requestUrlKey 125 | }, 126 | response : { 127 | textStatus : textStatus 128 | } 129 | } 130 | }; 131 | 132 | jQuery.post( ajaxurl, data, null, 'json' ); 133 | }; 134 | 135 | /** 136 | * Set the api key. 137 | * 138 | * @since 1.7.0 139 | * 140 | * @param string apiKey The api key to set. 141 | */ 142 | this.setApiKey = function( apiKey ) { 143 | self.api_key = apiKey; 144 | } 145 | 146 | /** 147 | * Set the site hash. 148 | * 149 | * @since 1.7.0 150 | * 151 | * @param string siteHash the site hash to set. 152 | */ 153 | this.setSiteHash = function( siteHash ) { 154 | self.site_hash = siteHash; 155 | } 156 | }; 157 | -------------------------------------------------------------------------------- /assets/js/all-pages-mine-count.js: -------------------------------------------------------------------------------- 1 | /* global boldgridAttributionCount */ 2 | 3 | jQuery( function() { 4 | 5 | // Abort if we don't have a count to remove. 6 | if ( 'undefined' === typeof boldgridAttributionCount ) { 7 | return; 8 | } 9 | 10 | /** 11 | * On "All Pages", we remove the ninja forms preview page both from the list 12 | * of pages and the page count next to "All". 13 | * 14 | * There may be a "Mine(5)" page count at the top of the page as well. 15 | * However, there does not appear to be a filter to manage that count. So, 16 | * we will use JS to remove 1 from the count. 17 | */ 18 | var $mine_span = jQuery( 'li.mine a span' ), 19 | mineCount, 20 | newMineCount; 21 | 22 | // If we don't have a "Mine" element, abort. 23 | if ( 0 === $mine_span.length ) { 24 | return; 25 | } 26 | 27 | mineCount = parseInt( 28 | $mine_span 29 | .html() 30 | .replace( '(', '' ) 31 | .replace( ')', '' ) 32 | ); 33 | 34 | newMineCount = mineCount - parseInt( boldgridAttributionCount.removeFromMine ); 35 | 36 | // If the new_mine_count is not a number, abort. 37 | if ( isNaN( newMineCount ) ) { 38 | return; 39 | } 40 | 41 | $mine_span.html( '(' + newMineCount + ')' ); 42 | } ); 43 | -------------------------------------------------------------------------------- /assets/js/boldgrid-admin-notices.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.BoldGridAdminNotices = function( configs ) { 4 | var self = this; 5 | 6 | jQuery( function() { 7 | 8 | // Allow users to dismiss a notice. 9 | jQuery( '.boldgrid-admin-notice .notice-dismiss' ).on( 'click', function() { 10 | self.dismiss_boldgrid_admin_notice( this ); 11 | } ); 12 | } ); 13 | 14 | /** 15 | * Allow users to dismiss a notice. 16 | */ 17 | self.dismiss_boldgrid_admin_notice = function( dismiss_button ) { 18 | 19 | // Get the id of the notice. 20 | var admin_notice_id = jQuery( dismiss_button ) 21 | .parents( '.boldgrid-admin-notice' ) 22 | .attr( 'data-admin-notice-id' ); 23 | var data = { 24 | action: 'dismiss_boldgrid_admin_notice', 25 | id: admin_notice_id 26 | }; 27 | 28 | jQuery.post( ajaxurl, data, function( response ) {} ); 29 | }; 30 | }; 31 | 32 | new IMHWPB.BoldGridAdminNotices(); 33 | -------------------------------------------------------------------------------- /assets/js/boldgrid-options.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check for checked on acknowledgement checkbox, so the user knows 3 | * that they will be deleting content from their BoldGrid install. 4 | * 5 | * @since .21 6 | */ 7 | jQuery( document ).ready( function( $ ) { 8 | var $el = 9 | '#boldgrid_delete_forms, #boldgrid_delete_themes, #delete_pages, [name=\'start_over_active\'], [name=\'start_over_staging\']'; // Target these elements 10 | 11 | var $submit_button = $( '#start_over_button' ); 12 | 13 | $( '#start_over' ).change( function( e ) { 14 | 15 | // Setup State Machine 16 | if ( ! e.currentTarget.checked ) { 17 | 18 | // If agree to start over gets deselected after user selects 19 | $( '#boldgrid-alert-remove' ).fadeOut(); // Then hide the alert warning. 20 | $( $el ).attr( 'disabled', 'disabled' ); // Change our elements to be disabled, 21 | $( $el ).attr( 'readonly', 'true' ); // and don't forget to make them readonly. 22 | 23 | $submit_button.attr( 'disabled', 'disabled' ); 24 | } else { 25 | 26 | // Otherwise when agreement is checked 27 | $( '#boldgrid-alert-remove' ).fadeIn(); // Show another warning to make user aware. 28 | $( $el ).removeAttr( 'disabled' ); // Enable the additional options, 29 | $( $el ).removeAttr( 'readonly' ); // and make the elements able to submit value to form. 30 | 31 | $submit_button.removeAttr( 'disabled' ); 32 | } 33 | } ); 34 | $( '#start_over' ).trigger( 'change' ); 35 | } ); 36 | -------------------------------------------------------------------------------- /assets/js/boldgrid-options.min.js: -------------------------------------------------------------------------------- 1 | jQuery( document ).ready( function( b ) { 2 | var a = '#boldgrid_delete_forms, #boldgrid_delete_themes, #delete_pages'; 3 | b( '#start_over' ).change( function( c ) { 4 | if ( ! c.currentTarget.checked ) { 5 | b( '#boldgrid-alert-remove' ).hide( 'slow' ); 6 | b( a ).attr( 'disabled', 'disabled' ); 7 | b( a ).attr( 'readonly', 'true' ); 8 | } else { 9 | b( '#boldgrid-alert-remove' ).show( 'slow' ); 10 | b( a ).removeAttr( 'disabled' ); 11 | b( a ).removeAttr( 'readonly' ); 12 | } 13 | } ); 14 | b( '#start_over' ).trigger( 'change' ); 15 | } ); 16 | -------------------------------------------------------------------------------- /assets/js/handlebars/handle-bar-helpers.js: -------------------------------------------------------------------------------- 1 | Handlebars.registerHelper('toLowerCase', function(str) { 2 | return str.toLowerCase(); 3 | }); 4 | 5 | Handlebars.registerHelper('json', function(str) { 6 | return JSON.stringify(str); 7 | }); 8 | 9 | Handlebars.registerHelper('if_eq', function(a, b, opts) { 10 | if (a == b) 11 | return opts.fn(this); 12 | else 13 | return opts.inverse(this); 14 | }); 15 | 16 | Handlebars.registerHelper('objCount', function(obj) { 17 | // return str.toLowerCase(); 18 | return Object.keys(obj).length; 19 | }); 20 | 21 | Handlebars.registerHelper("getValueAtKey", function(object, key) { 22 | return object[key]; 23 | }); 24 | 25 | Handlebars.registerHelper("getValueAtKeyKey", function(object, key1, key2) { 26 | return object[key1][key2]; 27 | }); 28 | 29 | Handlebars.registerHelper("multiply", function(value, multiplier) { 30 | return parseInt(value) * parseInt(multiplier); 31 | }); 32 | 33 | // http://www.levihackwith.com/creating-new-conditionals-in-handlebars/ 34 | // Usage: {{#ifCond var1 '==' var2}} 35 | Handlebars.registerHelper('ifCond', function(v1, operator, v2, options) { 36 | switch (operator) { 37 | case '==': 38 | return (v1 == v2) ? options.fn(this) : options.inverse(this); 39 | case '===': 40 | return (v1 === v2) ? options.fn(this) : options.inverse(this); 41 | case '<': 42 | return (v1 < v2) ? options.fn(this) : options.inverse(this); 43 | case '<=': 44 | return (v1 <= v2) ? options.fn(this) : options.inverse(this); 45 | case '>': 46 | return (v1 > v2) ? options.fn(this) : options.inverse(this); 47 | case '>=': 48 | return (v1 >= v2) ? options.fn(this) : options.inverse(this); 49 | case '&&': 50 | return (v1 && v2) ? options.fn(this) : options.inverse(this); 51 | case '||': 52 | return (v1 || v2) ? options.fn(this) : options.inverse(this); 53 | default: 54 | return options.inverse(this); 55 | } 56 | }); 57 | 58 | // Determine if a variable is set and not null. 59 | // Only supports strings at this time. 60 | Handlebars.registerHelper('isSetAndNotNull', function(a, options) { 61 | var mytype = typeof a; 62 | 63 | switch (mytype) { 64 | case 'string': 65 | if ('' != a.trim()) { 66 | return options.fn(this); 67 | } else { 68 | return options.inverse(this); 69 | } 70 | break; 71 | default: 72 | // Return false by default. 73 | return options.inverse(this); 74 | } 75 | }); -------------------------------------------------------------------------------- /assets/js/handlebars/templates/category.php: -------------------------------------------------------------------------------- 1 | 14 | 22 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/language.php: -------------------------------------------------------------------------------- 1 | 14 | 22 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/pagesetversion.php: -------------------------------------------------------------------------------- 1 | 14 | 23 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/preview.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 26 | 27 | 37 | 38 | 47 | 48 | 54 | 55 | 56 | 57 | 62 | 63 | 71 | 72 | 81 | 82 | 83 | 84 | 105 | 106 | 113 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/subcategory.php: -------------------------------------------------------------------------------- 1 | 14 | 22 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/theme.php: -------------------------------------------------------------------------------- 1 | 14 | 22 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/themegroup.php: -------------------------------------------------------------------------------- 1 | 14 | 22 | -------------------------------------------------------------------------------- /assets/js/handlebars/templates/themeversion.php: -------------------------------------------------------------------------------- 1 | 14 | 23 | -------------------------------------------------------------------------------- /assets/js/inline/checking_out.js: -------------------------------------------------------------------------------- 1 | $installation_log = jQuery(".installation-log"); 2 | $deploy_log_line_count = jQuery(".deploy_log_line_count"); 3 | $link_toggle_log = jQuery(".toggle-log"); 4 | $spinner = jQuery(".spinner"); 5 | 6 | // As new lines are added to the deploy_log, update the line count. 7 | function update_deploy_log_line_count() { 8 | var line_count = $installation_log.find(".plugin-card-top").find("li").length; 9 | $deploy_log_line_count.html(line_count); 10 | } 11 | 12 | // Toggle the log as the user clicks "show / hide" 13 | $link_toggle_log.on("click", function() { 14 | $installation_log.slideToggle(); 15 | }); -------------------------------------------------------------------------------- /assets/js/inline/checking_out_complete.js: -------------------------------------------------------------------------------- 1 | $stop_and_explain = jQuery(".stop-and-explain"); 2 | $title_purchase = jQuery("h1.purchasing"); 3 | var ruler = "
"; 4 | 5 | // Hide the spinner. 6 | $spinner.remove(); 7 | 8 | // Hide the loading graphic. 9 | jQuery('.boldgrid-loading').remove(); 10 | 11 | // Move "stop and explain" to the top of the page. 12 | $stop_and_explain.insertBefore($title_purchase).slideToggle(1000); 13 | 14 | // Move the separator into place. 15 | jQuery(ruler).insertBefore($title_purchase); 16 | 17 | // Update the title of the page. 18 | $title_purchase 19 | .html( BoldGridInspirationsPurchase.purchaseComplete ) 20 | .prepend( "" ); 21 | 22 | // Scroll the user to the top of the page. 23 | jQuery("html").animate({ 24 | scrollTop : 0 25 | }, "slow"); -------------------------------------------------------------------------------- /assets/js/inline/checking_out_complete_with_errors.js: -------------------------------------------------------------------------------- 1 | $stop_and_explain = jQuery(".stop-and-explain"); 2 | $title_purchase = jQuery("h1.purchasing"); 3 | var ruler = "
"; 4 | 5 | // Hide the spinner. 6 | $spinner.remove(); 7 | 8 | // Hide the loading graphic. 9 | jQuery('.boldgrid-loading').remove(); 10 | 11 | // Move "stop and explain" to the top of the page. 12 | $stop_and_explain.insertBefore($title_purchase).slideToggle(1000); 13 | 14 | // Move the separator into place. 15 | jQuery(ruler).insertBefore($title_purchase); 16 | 17 | // Update the title of the page. 18 | $title_purchase 19 | .html( BoldGridInspirationsPurchase.withErrors ) 20 | .prepend( "" ); 21 | 22 | // Scroll the user to the top of the page. 23 | jQuery("html").animate({ 24 | scrollTop : 0 25 | }, "slow"); -------------------------------------------------------------------------------- /assets/js/inline/hide_plugin_list_during_installation.js: -------------------------------------------------------------------------------- 1 | // Hide the existing plugins because we want the user to refresh the page to see the new plugins 2 | jQuery("form#bulk-action-form").parent("div.wrap").addClass("hidden"); 3 | 4 | // Hide the activate buttons 5 | jQuery("div.wrap p a[href*=\'plugins.php\']").parent("p").addClass("hidden"); -------------------------------------------------------------------------------- /assets/js/inline/print_pointers_in_header.js: -------------------------------------------------------------------------------- 1 | jQuery(document) 2 | .ready( 3 | function($) { 4 | $ 5 | .each( 6 | WPHelpPointer.pointers, 7 | function(i) { 8 | var open_on_page_load = (typeof WPHelpPointer.pointers[i].options.position.open_on_page_load == 'undefined' || true == WPHelpPointer.pointers[i].options.position.open_on_page_load) ? true 9 | : false; 10 | 11 | if (true == open_on_page_load) { 12 | wp_help_pointer_open(i); 13 | } 14 | }); 15 | }); 16 | 17 | function wp_help_pointer_open(i) { 18 | pointer = WPHelpPointer.pointers[i]; 19 | 20 | options = jQuery.extend(pointer.options, { 21 | // ajax request to add this pointer to dismiss-wp-pointer 22 | close : function() { 23 | var pointer_selector = jQuery(pointer.target).attr( 24 | 'data-pointer-selector'); 25 | var pointer_id = jQuery(this).attr('data-pointer-id'); 26 | if (typeof pointer_id != 'undefined') { 27 | var pointer_index = WPHelpPointerIndex[pointer_selector]; 28 | } 29 | 30 | jQuery.post(ajaxurl, { 31 | pointer : pointer_id, 32 | action : 'dismiss-wp-pointer' 33 | }); 34 | 35 | // Dissmiss this pointer. 36 | jQuery(this).attr('data-pointer-is-dismissed', 'yes'); 37 | if (typeof pointer_index != 'undefined') { 38 | WPHelpPointer.pointers[pointer_index]['is-dismissed'] = 'yes'; 39 | } 40 | } 41 | }); 42 | 43 | jQuery(pointer.target).pointer(options).pointer('open'); 44 | 45 | // Add a data attribute tho this element, data-pointer-id. 46 | // When we need to dismiss this element's pointer, we'll use 47 | // this attribute to get the appropriate id. 48 | jQuery(pointer.target).attr('data-pointer-id', pointer.pointer_id); 49 | jQuery(pointer.target).attr('data-pointer-is-dismissed', 'no'); 50 | jQuery(pointer.target).attr('data-pointer-selector', pointer.target); 51 | jQuery(pointer.target).attr('data-pointer-index', i); 52 | } -------------------------------------------------------------------------------- /assets/js/screen/id/appearance_page_staged-theme.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.ScreenIdAppearancePageStagedTheme = function(configs) { 4 | var self = this; 5 | 6 | this.configs = configs; 7 | this.api_url = this.configs.asset_server; 8 | this.api_key = this.configs.api_key; 9 | 10 | this.api_param = 'key'; 11 | this.api_key_query_str = this.api_param + "=" + this.api_key; 12 | 13 | // location.reload does not scroll to the top of the page, so let's do that now 14 | jQuery(window).scrollTop(0); 15 | 16 | jQuery(function() { 17 | // MODULE: Staging 18 | // set staging theme 19 | jQuery('a.stage').on('click', function() { 20 | self.set_staging_theme(this); 21 | }); 22 | 23 | // MODULE: Staging 24 | // set staged theme as first theme in list 25 | jQuery("div.theme.active").prependTo('.themes'); 26 | }); 27 | 28 | // MODULE: Staging 29 | // set staging theme 30 | this.set_staging_theme = function(e) { 31 | var stylesheet = jQuery(e).data('stylesheet'); 32 | 33 | var data = { 34 | 'action' : 'set_staging_theme', 35 | 'stylesheet' : stylesheet 36 | }; 37 | 38 | // since 2.8 ajaxurl is always defined in the admin header and points to 39 | // admin-ajax.php 40 | jQuery.post(ajaxurl, data, function(response) { 41 | if ('success' == response) { 42 | location.reload(); 43 | } else { 44 | alert(response); 45 | } 46 | }); 47 | } 48 | }; 49 | 50 | new IMHWPB.ScreenIdAppearancePageStagedTheme(IMHWPB.configs); -------------------------------------------------------------------------------- /assets/js/screen/id/media_page_boldgrid-connect-search.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.ScreenIdMediaPageBoldGridConnectSearch = function() { 4 | var self = this; 5 | 6 | jQuery(function() { 7 | // When the page loads, resize the iframe. 8 | self.resize_boldgrid_connect_search(); 9 | 10 | // When the window size is changed, resize iframe. 11 | jQuery(window).resize(function() { 12 | self.resize_boldgrid_connect_search(); 13 | }); 14 | }); 15 | 16 | /** 17 | * 18 | */ 19 | this.resize_boldgrid_connect_search = function() { 20 | var body_height = jQuery("body").height(); 21 | jQuery(".wrap-boldgrid-connect-search").css("height", 22 | (body_height - 165) + "px"); 23 | } 24 | }; 25 | 26 | new IMHWPB.ScreenIdMediaPageBoldGridConnectSearch(); -------------------------------------------------------------------------------- /assets/js/screen/id/page.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.ScreenIdPage = function(configs) { 4 | var self = this; 5 | 6 | jQuery(function() { 7 | self.baseAdmin = new IMHWPB.BaseAdmin(); 8 | 9 | /** 10 | * MODULE: Pointers 11 | * 12 | * Pointer for "media search" 13 | */ 14 | jQuery(document.body).on('click', '#media-search-input', function() { 15 | self.baseAdmin.show_pointer(this, '#media-search-input'); 16 | }); 17 | }); 18 | 19 | }; 20 | 21 | new IMHWPB.ScreenIdPage(); -------------------------------------------------------------------------------- /assets/js/screen/id/toplevel_page_boldgrid-inspirations.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.ScreenIdToplevelPageBoldgridInspirations = function() { 4 | var self = this; 5 | 6 | jQuery(function() { 7 | // Event handler for clicking on the "Budget" button filter. 8 | jQuery('a.drawer-toggle').on('click', function() { 9 | self.toggle_budget(); 10 | }); 11 | 12 | // Handle the filter menus 13 | jQuery('ul.filter-links a').on('click', function() { 14 | self.toggle_filter(this); 15 | }); 16 | 17 | // Handle the dismissing of notices. 18 | // todo: this needs to be handled by admin notices in the future. 19 | jQuery(document).on( 20 | 'click', 21 | 'div.updated.notice.is-dismissible button.notice-dismiss', 22 | function() { 23 | jQuery(this).parent('div.updated.notice.is-dismissible') 24 | .hide(); 25 | }); 26 | }); 27 | 28 | /** 29 | * I wasn't able to figure out WP's click handling of the "Feature Filter", 30 | * so here's some code to handle the clicking of the "Budget" filter. 31 | */ 32 | this.toggle_budget = function() { 33 | jQuery('div.filter-drawer').toggle(); 34 | } 35 | 36 | /** 37 | * 38 | */ 39 | this.toggle_filter = function(e) { 40 | // At this time, Only the 'themes' tab has multiple tabs. 41 | // If we're not on the themes tab, there's nothing to toggle, 42 | // so just return. 43 | if (!jQuery('a#nav-step-2').hasClass('nav-tab-active')) { 44 | return false; 45 | } 46 | 47 | // get the data-toggle value. 48 | var toggle = jQuery(e).data('toggle'); 49 | 50 | // Remove 'current' class from all links. 51 | jQuery('ul.filter-links a').each(function(key, value) { 52 | jQuery(this).removeClass('current'); 53 | }); 54 | 55 | // Add 'current' class to the link clicked on. 56 | jQuery(e).addClass('current'); 57 | 58 | // Hide all divs. 59 | jQuery('.themes-current-category').hide(); 60 | jQuery('.themes-other-categories').each(function() { 61 | jQuery(this).hide(); 62 | }); 63 | 64 | // Show only the divs we've clicked on. 65 | jQuery('.' + toggle).show(); 66 | 67 | } 68 | 69 | }; 70 | 71 | new IMHWPB.ScreenIdToplevelPageBoldgridInspirations(); -------------------------------------------------------------------------------- /assets/js/screen/id/upload.js: -------------------------------------------------------------------------------- 1 | var IMHWPB = IMHWPB || {}; 2 | 3 | IMHWPB.ScreenIdUpload = function(configs) { 4 | var self = this; 5 | 6 | jQuery(function() { 7 | self.baseAdmin = new IMHWPB.BaseAdmin(); 8 | 9 | /** 10 | * MODULE: Pointers 11 | * 12 | * Pointer for "media search" 13 | */ 14 | jQuery(document.body).on('click', '#media-search-input', function() { 15 | self.baseAdmin.show_pointer(this, '#media-search-input'); 16 | }); 17 | }); 18 | 19 | }; 20 | 21 | new IMHWPB.ScreenIdUpload(); -------------------------------------------------------------------------------- /assets/js/tinymce-plugin.js: -------------------------------------------------------------------------------- 1 | function boldgrid_mce_image_left() { 2 | var left_image = 3 | '\'\'' + 4 | '

This is a paragraph with an image aligned to the left. Replace this text with your own text. It\'s easy! This is a paragraph with an image aligned to the left. Replace this text with your own text. It\'s easy! This is a paragraph with an image aligned to the left. Replace this text with your own text. It\'s easy! This is a paragraph with an image aligned to the left. Replace this text with your own text. It\'s easy!

This is a paragraph with an image aligned to the left. Replace this text with your own text. It\'s easy!

'; 5 | return left_image; 6 | } 7 | 8 | tinymce.create( 'tinymce.plugins.imhwpb', { 9 | 10 | /** 11 | * Initializes the plugin, this will be executed after the plugin has been 12 | * created. This call is done before the editor instance has finished it's 13 | * initialization so use the onInit event of the editor instance to 14 | * intercept that event. 15 | * 16 | * @param {tinymce.Editor} 17 | * ed Editor instance that the plugin is initialized in. 18 | * @param {string} 19 | * url Absolute URL to where the plugin is located. 20 | */ 21 | init: function( ed, url ) { 22 | ed.addButton( 'example', { 23 | text: 'Z', 24 | icon: false, 25 | title: 'TITLE GOES HERE', 26 | 27 | // image : url + '/../images/icon-toggle.gif', 28 | onclick: function() { 29 | 30 | // CustomButtonClick('learn_more'); 31 | myText = boldgrid_mce_image_left(); 32 | ed.execCommand( 'mceInsertContent', false, myText ); 33 | } 34 | } ); 35 | }, 36 | 37 | /** 38 | * Creates control instances based in the incomming name. This method is 39 | * normally not needed since the addButton method of the tinymce.Editor 40 | * class is a more easy way of adding buttons but you sometimes need to 41 | * create more complex controls like listboxes, split buttons etc then this 42 | * method can be used to create those. 43 | * 44 | * @param {String} 45 | * n Name of the control to create. 46 | * @param {tinymce.ControlManager} 47 | * cm Control manager to use inorder to create new control. 48 | * @return {tinymce.ui.Control} New control instance or null if no control 49 | * was created. 50 | */ 51 | createControl: function( n, cm ) { 52 | return null; 53 | } 54 | } ); 55 | 56 | tinymce.PluginManager.add( 'boldgrid_example', tinymce.plugins.imhwpb ); 57 | -------------------------------------------------------------------------------- /bin/install-wp-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ $# -lt 3 ]; then 4 | echo "usage: $0 [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 | WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib} 15 | WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/} 16 | 17 | set -ex 18 | 19 | install_wp() { 20 | mkdir -p $WP_CORE_DIR 21 | 22 | if [ $WP_VERSION == 'latest' ]; then 23 | local ARCHIVE_NAME='latest' 24 | else 25 | local ARCHIVE_NAME="wordpress-$WP_VERSION" 26 | fi 27 | 28 | # Install the WordPress files. 29 | # Unzip quietly (-qq) so the automated tests are not flooded with the unzip output. 30 | wget -nv -O /tmp/wordpress-latest.zip https://wordpress.org/nightly-builds/wordpress-latest.zip 31 | unzip -qq /tmp/wordpress-latest.zip -d /tmp 32 | 33 | wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php 34 | } 35 | 36 | install_test_suite() { 37 | # portable in-place argument for both GNU sed and Mac OSX sed 38 | if [[ $(uname -s) == 'Darwin' ]]; then 39 | local ioption='-i .bak' 40 | else 41 | local ioption='-i' 42 | fi 43 | 44 | # set up testing suite 45 | mkdir -p $WP_TESTS_DIR 46 | cd $WP_TESTS_DIR 47 | # As each new version of WP is released, the branch should be updated in the 2 lines below. 48 | svn co --quiet https://develop.svn.wordpress.org/branches/5.9/tests/phpunit/includes/ 49 | wget -nv -O wp-tests-config.php https://develop.svn.wordpress.org/branches/5.9/wp-tests-config-sample.php 50 | sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php 51 | sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php 52 | sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php 53 | sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php 54 | sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php 55 | } 56 | 57 | install_db() { 58 | # parse DB_HOST for port or socket references 59 | local PARTS=(${DB_HOST//\:/ }) 60 | local DB_HOSTNAME=${PARTS[0]}; 61 | local DB_SOCK_OR_PORT=${PARTS[1]}; 62 | local EXTRA="" 63 | 64 | if ! [ -z $DB_HOSTNAME ] ; then 65 | if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then 66 | EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" 67 | elif ! [ -z $DB_SOCK_OR_PORT ] ; then 68 | EXTRA=" --socket=$DB_SOCK_OR_PORT" 69 | elif ! [ -z $DB_HOSTNAME ] ; then 70 | EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" 71 | fi 72 | fi 73 | 74 | # create database 75 | mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA 76 | } 77 | 78 | install_wp 79 | install_test_suite 80 | install_db 81 | -------------------------------------------------------------------------------- /boldgrid-inspirations.php: -------------------------------------------------------------------------------- 1 | 7 | * Author URI: https://www.boldgrid.com/ 8 | * Description: Find inspiration, customize, and launch! BoldGrid Inspirations includes FREE WordPress themes and is the easiest way to launch a new WordPress site complete with custom content. 9 | * Text Domain: boldgrid-inspirations 10 | * Domain Path: /languages 11 | * License: GPL 12 | */ 13 | 14 | // Define version. 15 | if ( ! defined( 'BOLDGRID_INSPIRATIONS_VERSION' ) ) { 16 | define( 'BOLDGRID_INSPIRATIONS_VERSION', implode( get_file_data( __FILE__, array( 'Version' ), 'plugin' ) ) ); 17 | } 18 | 19 | // Used for this and other BoldGrid plugins to locate the core plugin directory. 20 | if ( ! defined( 'BOLDGRID_BASE_DIR' ) ) { 21 | define( 'BOLDGRID_BASE_DIR', dirname( __FILE__ ) ); 22 | } 23 | 24 | if ( ! defined( 'BOLDGRID_BASE_URL' ) ) { 25 | define( 'BOLDGRID_BASE_URL', plugins_url( '', __FILE__ ) ); 26 | } 27 | 28 | // Prevent direct calls. 29 | require BOLDGRID_BASE_DIR . '/pages/templates/restrict-direct-access.php'; 30 | 31 | // If our class is not loaded, then require it. 32 | if ( ! class_exists( 'Boldgrid_Inspirations' ) ) { 33 | require_once BOLDGRID_BASE_DIR . '/includes/class-boldgrid-inspirations.php'; 34 | } 35 | 36 | // If PHP is compatible, then load the rest. 37 | if ( Boldgrid_Inspirations::is_php_compatible() ) { 38 | // Classes needed ASAP. 39 | require_once BOLDGRID_BASE_DIR . '/includes/class-boldgrid-inspirations-inspiration.php'; 40 | require_once BOLDGRID_BASE_DIR . '/includes/class-boldgrid-inspirations-survey.php'; 41 | 42 | // Instantiate the inspiration class (also loads the parent class Boldgrid_Inspirations). 43 | $boldgrid_inspirations_inspiration = new Boldgrid_Inspirations_Inspiration(); 44 | 45 | // Add action to call pre_add_hooks after init. 46 | add_action( 'init', 47 | array( 48 | $boldgrid_inspirations_inspiration, 49 | 'pre_add_hooks', 50 | ) 51 | ); 52 | // Include the autoloader to set plugin options and create instance. 53 | $loader = require plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; 54 | 55 | // Load Library. 56 | $load = new Boldgrid\Library\Util\Load( 57 | array( 58 | 'type' => 'plugin', 59 | 'file' => plugin_basename( __FILE__ ), 60 | 'loader' => $loader, 61 | 'keyValidate' => true, 62 | 'licenseActivate', false, 63 | ) 64 | ); 65 | $boldgrid_inspirations_settings = get_option( 'boldgrid_settings' ); 66 | 67 | if ( ! empty( $boldgrid_inspirations_settings['library'] ) ) { 68 | // Load attribution module. 69 | new Boldgrid\Inspirations\Premium\Attribution; 70 | } 71 | 72 | // Inspirations survey. Needs to load ASAP in order to filter bgtfw configs. 73 | $survey = new BoldGrid_Inspirations_Survey(); 74 | $survey->add_hooks(); 75 | } else { 76 | // If PHP is not compatible, deactivate and die if activating from an admin page, or do nothing. 77 | add_action( 'admin_init', 'Boldgrid_Inspirations::check_php_wp_version' ); 78 | } 79 | 80 | register_deactivation_hook( __FILE__, array( 'Boldgrid_Inspirations_Attribution_Page', 'on_deactivate' ) ); 81 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "boldgrid/library": "^2.13.11", 4 | "boldgrid/boldgrid-inspirations-premium": "^1.1.3", 5 | "boldgrid/plugin-installer": "^1.0.9", 6 | "boldgrid/bgforms": "^1.2.3" 7 | }, 8 | "scripts": { 9 | "post-autoload-dump": [ 10 | "yarn run cpx -v 'node_modules/font-awesome/css/*' 'assets/css/font-awesome/css/'", 11 | "yarn run cpx -v 'node_modules/font-awesome/fonts/*' 'assets/css/font-awesome/fonts/'", 12 | "yarn run cpx -v 'node_modules/jquery-toggles/toggles*.js' 'assets/js/jquery-toggles/'", 13 | "yarn run cpx -v 'node_modules/jquery-toggles/css/toggles-full.css' 'assets/css/jquery-toggles/'", 14 | "composer run-script post-autoload-dump -d ./vendor/boldgrid/library" 15 | ] 16 | }, 17 | "require-dev": { 18 | "phpunit/phpunit": "^7", 19 | "yoast/phpunit-polyfills": "^1.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-admin-menu.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Inspirations Admin Menu. 13 | * 14 | * Methods for managing dashboard menus. 15 | * 16 | * @since 1.4.1 17 | */ 18 | class Boldgrid_Inspirations_Admin_Menu { 19 | 20 | /** 21 | * Remove a submenu item. 22 | * 23 | * This function already exists natively in WordPress, remove_submenu_page(). 24 | * 25 | * Natively, this function can be easy to use. 26 | * Remove "Themes": 27 | * remove_submenu_page( 'themes.php', 'themes.php' ); 28 | * 29 | * However, this function can be a little confusing too. 30 | * Remove "Header": 31 | * remove_submenu_page( 'themes.php', 'customize.php?return=%2Fwp-admin%2Findex.php&autofocus%5Bcontrol%5D=header_image' ); 32 | * 33 | * To make this function easier to use, we'll remove submenu pages by their Title instead of 34 | * their slug. 35 | * 36 | * @since 1.4.1 37 | * 38 | * @global array $submenu 39 | * 40 | * @param string $parent Parent menu slug, such as themes.php. 41 | * @param string $title Title of menu item to remove, such as "Background". 42 | * @return bool Returns true when a submenu item has been removed. 43 | */ 44 | public static function remove_submenu_page( $parent, $title ) { 45 | global $submenu; 46 | 47 | if ( empty( $submenu[ $parent ] ) ) { 48 | return false; 49 | } 50 | 51 | foreach ( $submenu[ $parent ] as $key => $item ) { 52 | if ( $title === $item[0] ) { 53 | unset( $submenu[ $parent ][ $key ] ); 54 | return true; 55 | } 56 | } 57 | 58 | return false; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-ajax.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspiration Ajax class. 13 | */ 14 | class Boldgrid_Inspirations_Ajax { 15 | /** 16 | * Enqueue. 17 | * 18 | * @since 1.7.0 19 | */ 20 | public static function enqueue() { 21 | $handle = 'inspiration-ajax'; 22 | wp_register_script( 23 | $handle, 24 | plugins_url( '/assets/js/ajax/ajax.js', BOLDGRID_BASE_DIR . '/boldgrid-inspirations.php' ), 25 | array(), 26 | BOLDGRID_INSPIRATIONS_VERSION, 27 | true 28 | ); 29 | wp_localize_script( 30 | $handle, 31 | 'BoldGridInspirationsAjax', 32 | array( 33 | 'checkStatusPage' => sprintf( 34 | wp_kses( 35 | // translators: 1 The opening anchor tag to the BoldGrid Status page, 2 its closing anchor tag. 36 | __( 'If the issue persists, then please feel free to check our %1$sBoldGrid Status%2$s page.', 'boldgrid-inspirations' ), 37 | array( 'a' => array( 'target' => array( '_blank' ), 'href' => array(), ) ) 38 | ), 39 | '', 40 | '' 41 | ), 42 | 'connectionIssue' => esc_html__( 'BoldGrid Connection Issue', 'boldgrid-inspirations' ), 43 | 'pleaseTryAgain' => esc_html__( 'There was an issue reaching the BoldGrid Connect server. Some BoldGrid features may be temporarily unavailable. Please try again in a moment.', 'boldgrid-inspirations' ), 44 | 'timeout' => esc_html__( 'Ajax error: timeout. Please try your request again.', 'boldgrid-inspirations' ), 45 | 'tryAgain' => esc_html__( 'Try Again', 'boldgrid-inspirations' ), 46 | 'unexpected' => esc_html__( 'Ajax error: Unexpected return. In some cases, trying your request again may help.', 'boldgrid-inspirations' ), 47 | ) 48 | ); 49 | wp_enqueue_script( $handle ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-attachment.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * An attachment utility class. 13 | * 14 | * @since 1.4.8 15 | */ 16 | class Boldgrid_Inspirations_Attachment { 17 | 18 | /** 19 | * Add a new size an attachment's metadata. 20 | * 21 | * @since 1.4.8 22 | * 23 | * @param int $id Attachment id. 24 | * @param string $size The label for the new size. 25 | * @param string $filepath Filepath of the new image. 26 | */ 27 | public static function add_metadata_size( $id, $size, $filepath ) { 28 | $metadata = wp_get_attachment_metadata( $id ); 29 | 30 | $mime_type = get_post_mime_type( $id ); 31 | 32 | $image = wp_get_image_editor( $filepath ); 33 | $dimensions = $image->get_size(); 34 | 35 | /* 36 | * Note: As of PHP 7.1.0, applying the empty index operator on a string throws a fatal 37 | * error. Formerly, the string was silently converted to an array. 38 | * 39 | * @link http://php.net/manual/en/language.types.array.php 40 | */ 41 | if ( ! is_array( $metadata ) ) { 42 | $metadata = array(); 43 | } 44 | 45 | $metadata['sizes'][$size] = array( 46 | 'file' => basename( $filepath ), 47 | 'width' => $dimensions['width'], 48 | 'height' => $dimensions['height'], 49 | 'mime-type' => $mime_type, 50 | ); 51 | 52 | wp_update_attachment_metadata( $id, $metadata ); 53 | } 54 | 55 | /** 56 | * Check if a size exists for an attachment. 57 | * 58 | * @since 1.4.8 59 | * 60 | * @param int $id Attachment id. 61 | * @param int $width 62 | * @param int $height 63 | * @return boolean 64 | */ 65 | public static function size_exists( $id, $width, $height ) { 66 | $width = (int) $width; 67 | $height = (int) $height; 68 | 69 | $src = wp_get_attachment_image_src( $id, array( $width, $height ) ); 70 | 71 | return is_array( $src ) && $width === $src[1] && $height === $src[2]; 72 | } 73 | 74 | /** 75 | * Resize an attachment and add info to metadata. 76 | * 77 | * @since 1.4.8 78 | * 79 | * @param int $id Attachment id. 80 | * @param int $width 81 | * @param int $height 82 | * @return boolean True if on success. 83 | */ 84 | public static function resize( $id, $width, $height ) { 85 | $width = (int) $width; 86 | $height = (int) $height; 87 | 88 | $suffix = $width . 'x' . $height; 89 | 90 | if( self::size_exists( $id, $width, $height ) ) { 91 | return true; 92 | } 93 | 94 | $filepath = get_attached_file( $id ); 95 | 96 | $image = wp_get_image_editor( $filepath ); 97 | 98 | // Generate new filename. 99 | $pathinfo = pathinfo( $filepath ); 100 | $new_filepath = $image->generate_filename( $suffix, $pathinfo['dirname'], $pathinfo['extension'], $pathinfo['filename'] ); 101 | 102 | $is_resized = $image->resize( $width, $height, true ); 103 | if ( is_wp_error( $is_resized ) ) { 104 | return false; 105 | } 106 | 107 | $is_saved = $image->save( $new_filepath ); 108 | if ( is_wp_error( $is_saved ) ) { 109 | return false; 110 | } 111 | 112 | self::add_metadata_size( $id, 'boldgrid_deployment_resize', $new_filepath ); 113 | 114 | return true; 115 | } 116 | } -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-attribution-update.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Attribution Update class. 13 | * 14 | * This file includes all functionality necessary to ensure our "Custom Post Type" attribution pages 15 | * are backwards compatible. 16 | * 17 | * @since 1.3.1 18 | */ 19 | class Boldgrid_Inspirations_Attribution_Update { 20 | 21 | /** 22 | * Add hooks. 23 | * 24 | * @since 1.3.1 25 | */ 26 | public function add_hooks() { 27 | $this->upgrade_to_cpt(); 28 | 29 | add_filter( 'pre_option_boldgrid_staging_boldgrid_attribution', array( $this, 'pre_option_boldgrid_attribution' ), 20 ); 30 | add_filter( 'pre_option_boldgrid_attribution', array( $this, 'pre_option_boldgrid_attribution' ), 20 ); 31 | } 32 | 33 | /** 34 | * Return older format of boldgrid_attribution option. 35 | * 36 | * @since 1.3.1 37 | */ 38 | public function pre_option_boldgrid_attribution() { 39 | $return = array(); 40 | 41 | $attribution_page = Boldgrid_Inspirations_Attribution_Page::get(); 42 | 43 | $return['page']['id'] = $attribution_page->ID; 44 | 45 | return $return; 46 | } 47 | 48 | 49 | /** 50 | * Upgrade the Attribution system to use custom post types. 51 | * 52 | * @since 1.3.1 53 | */ 54 | public function upgrade_to_cpt() { 55 | /* 56 | * Do we need to perform this upgrade? 57 | * 58 | * This upgrade only needs to be ran once. If the option 59 | * boldgrid_attribution_upgraded_to_cpt has a value, it means that we've already ran this 60 | * method. 61 | * 62 | * Part of the upgrade process involves flush_rewrite_rules. It is when we run that, that we 63 | * set boldgrid_attribution_upgraded_to_cpt to true. Please see: 64 | * BoldGrid_Inspirations_Attribution_Page::register_post_type(); 65 | */ 66 | if( false !== get_option( 'boldgrid_attribution_upgraded_to_cpt' ) ) { 67 | return; 68 | } 69 | 70 | $lang = Boldgrid_Inspirations_Attribution::get_lang(); 71 | 72 | // These are the pages that we will find and delete. 73 | $slugs = array( $lang['attribution'], $lang['attribution'] . '-staging' ); 74 | 75 | foreach( $slugs as $slug ) { 76 | $attribution_page = get_page_by_path( $slug ); 77 | 78 | if( is_object( $attribution_page ) && isset( $attribution_page->ID ) ) { 79 | $attribution_page->post_type = $lang['post_type']; 80 | wp_delete_post( $attribution_page->ID, true ); 81 | } 82 | } 83 | 84 | // Flag this option as true so that the next visit to Attribution triggers a rebuild. 85 | update_option( 'boldgrid_attribution_rebuild', true ); 86 | update_option( 'boldgrid_staging_boldgrid_attribution_rebuild', true ); 87 | 88 | // These options are no longer needed, delete them. 89 | delete_option( 'boldgrid_attribution' ); 90 | delete_option( 'boldgrid_staging_boldgrid_attribution' ); 91 | } 92 | } -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-blog.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Blog class. 13 | * 14 | * @since 1.4 15 | */ 16 | class Boldgrid_Inspirations_Blog { 17 | 18 | /** 19 | * Configs. 20 | * 21 | * @since 1.4 22 | * @var array 23 | */ 24 | public $configs; 25 | 26 | /** 27 | * The page id of the blog page. 28 | * 29 | * @since SINCEVERSION 30 | * @var int 31 | */ 32 | public $page_id; 33 | 34 | /** 35 | * The title of our blog page. 36 | * 37 | * @since SINCEVERSION 38 | * @var string 39 | */ 40 | public $title; 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @since 1.4 46 | * 47 | * @param array $configs 48 | */ 49 | public function __construct( $configs = array() ) { 50 | $this->configs = $configs; 51 | $this->title = __( 'Blog', 'boldgrid-inspirations' ); 52 | } 53 | 54 | /** 55 | * Create the blog menu item. 56 | * 57 | * @since 1.4 58 | * 59 | * @param int $menu_id 60 | * @param int $menu_order Default value is 150. This number was previously in the code without 61 | * any comments. 62 | */ 63 | public function create_menu_item( $menu_id, $menu_order = 150 ) { 64 | $data = array( 65 | 'menu-item-object-id' => $this->page_id, 66 | 'menu-item-parent-id' => 0, 67 | 'menu-item-object' => 'page', 68 | 'menu-item-type' => 'post_type', 69 | 'menu-item-status' => 'publish', 70 | 'menu-item-position' => $menu_order, 71 | ); 72 | 73 | return wp_update_nav_menu_item( $menu_id, 0, $data ); 74 | } 75 | 76 | /** 77 | * Create our blog page. 78 | * 79 | * @since SINCEVERSION 80 | */ 81 | public function create_page() { 82 | $page = Boldgrid_Inspirations_Utility::get_page_by_title( $this->title ); 83 | 84 | if ( ! empty( $page->post_status ) && 'published' === $page->post_status ) { 85 | $page_id = $page->ID; 86 | } else { 87 | $page_id = wp_insert_post( array( 88 | 'post_title' => $this->title, 89 | 'post_name' => sanitize_key( $this->title ), 90 | 'post_status' => 'publish', 91 | 'post_type' => 'page', 92 | 'comment_status' => 'closed', 93 | ) ); 94 | } 95 | 96 | $this->page_id = (int) $page_id; 97 | 98 | return ! empty( $this->page_id ); 99 | } 100 | 101 | /** 102 | * Create widgets. 103 | * 104 | * During an Inspirations Deployment, if we are installing a blog, create a set of widgets and 105 | * add them to the sidebar. 106 | * 107 | * @since 1.4 108 | */ 109 | public function create_sidebar_widgets() { 110 | /* 111 | * Set our sidebar id. 112 | * 113 | * With v1 themes it used to be 'sidebar-1'. As Inspirations has transitioned to installing 114 | * Crio themes, the sidebar is now 'primary-sidebar'. 115 | */ 116 | $theme = wp_get_theme(); 117 | $sidebar = 'Crio' === $theme->get( 'Name' ) ? 'primary-sidebar' : 'sidebar-1'; 118 | 119 | /** 120 | * Filter the sidebar to add our new widgets to. 121 | * 122 | * Not all themes have a 'sidebar-1'. 123 | * 124 | * @since 1.4 125 | * 126 | * @param string $sidebar. 127 | */ 128 | $sidebar = apply_filters( 'boldgrid_deploy_blog_sidebar', $sidebar ); 129 | 130 | $widgets_to_create = $this->configs[ 'new_blog_widgets' ]; 131 | 132 | /** 133 | * Filter the widgets that we will create. 134 | * 135 | * @since 1.4 136 | * 137 | * @param array $widgets_to_create An array of widgets. 138 | */ 139 | $widgets_to_create = apply_filters( 'boldgrid_deploy_blog_widgets', $widgets_to_create ); 140 | 141 | /* 142 | * Empty the sidebar before we start adding widgets to it, otherwise we will end up with 143 | * duplicate items in the sidebar after more than one deployment. 144 | */ 145 | Boldgrid_Inspirations_Widget::empty_sidebar( $sidebar ); 146 | 147 | foreach( $widgets_to_create as $widget ) { 148 | $key = Boldgrid_Inspirations_Widget::create_widget( $widget['type'], $widget['value'] ); 149 | 150 | Boldgrid_Inspirations_Widget::add_to_sidebars( $sidebar, $widget['type'] . '-' . $key ); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-coins.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Coins class. 13 | */ 14 | class Boldgrid_Inspirations_Coins extends Boldgrid_Inspirations { 15 | /** 16 | * Get the user's coin balance. 17 | * 18 | * First, try getting it from the transient. 19 | * If it doesn't exist there, reach out to the asset server to get it. 20 | * 21 | * @see Boldgrid_Inspirations_Api::boldgrid_api_call(). 22 | * 23 | * @return string 24 | */ 25 | public function get_coin_balance() { 26 | // Check for the coin balance in a transient. 27 | $user_coin_balance = get_transient( 'boldgrid_coin_balance' ); 28 | 29 | // If we have an invalid balance, get the latest balance from the asset server. 30 | if ( ! $user_coin_balance && Boldgrid_Inspirations_Api::get_is_asset_server_available() ) { 31 | // Configure our API call. 32 | $boldgrid_configs = $this->get_configs(); 33 | 34 | $url_to_get_balance = $boldgrid_configs['ajax_calls']['get_coin_balance']; 35 | 36 | // Make API Call. 37 | $response = Boldgrid_Inspirations_Api::boldgrid_api_call( 38 | $url_to_get_balance, false, array(), 'POST' 39 | ); 40 | 41 | set_transient( 'boldgrid_coin_balance', $user_coin_balance, 10 * MINUTE_IN_SECONDS ); 42 | } 43 | 44 | $balance = ( 45 | isset( $response->result->data->balance ) ? $response->result->data->balance : '?' 46 | ); 47 | 48 | return $balance; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-customizer.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspirations Customizer class. 13 | */ 14 | class Boldgrid_Inspirations_Customizer { 15 | /** 16 | * Add hooks. 17 | */ 18 | public function add_hooks() { 19 | if ( is_customize_preview() ) { 20 | // If in admin add CSS and JS to dashboard for widget and styling. 21 | add_action( 22 | 'customize_controls_print_styles', 23 | array( 24 | $this, 'remove_change_themes' 25 | ), 999 26 | ); 27 | } 28 | } 29 | 30 | /** 31 | * This function adds some styles to the WordPress Customizer. 32 | */ 33 | public function remove_change_themes() { 34 | ?> 35 | 40 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Dashboard Widget class. 13 | * 14 | * @since 2.1.0 15 | */ 16 | class Boldgrid_Inspirations_Dashboard_Widget { 17 | /** 18 | * Add admin hooks. 19 | * 20 | * @since 2.1.0 21 | */ 22 | public function add_admin_hooks() { 23 | add_filter( 'Boldgrid\Library\Notifications\DashboardWidget\getFeaturePlugin\boldgrid-inspirations', array( $this, 'filter_feature' ), 10, 2 ); 24 | } 25 | 26 | /** 27 | * Filter the Inspirations item in the dashboard widget. 28 | * 29 | * @since 2.1.0 30 | * 31 | * @param \Boldgrid\Library\Library\Ui\Feature The feature object. 32 | * @param \Boldgrid\Library\Library\Plugin\Plugin The plugin object. 33 | */ 34 | public function filter_feature( \Boldgrid\Library\Library\Ui\Feature $feature, \Boldgrid\Library\Library\Plugin\Plugin $plugin ) { 35 | $feature->icon = ''; 36 | $onboarding_progress = get_option( 'boldgrid_onboarding_progress' ); 37 | 38 | if ( ! Boldgrid_Inspirations_Installed::has_built_site() ) { 39 | $feature->content .= '

' . wp_kses( 40 | sprintf( 41 | // translators: 1 The opening anchor tag to the Inspirations page, 2 its closing tag. 42 | __( 'It looks like you haven\'t completed the Inspirations process yet. %1$sClick here to begin%2$s.', 'boldgrid-inspirations' ), 43 | '', 44 | '' 45 | ), 46 | [ 'a' => [ 'href' => [] ] ] 47 | ) . '

'; 48 | } elseif ( 1 > $onboarding_progress ) { 49 | $feature->content .= '

' . wp_kses( 50 | sprintf( 51 | // translators: 1 The opening anchor tag to the Inspirations page, 2 its closing tag. 52 | __( 'It looks like there is still more you can do with BoldGrid. %1$sClick here to continue%2$s.', 'boldgrid-inspirations' ), 53 | '', 54 | '' 55 | ), 56 | array( 'a' => array( 'href' => array() ) ) 57 | ) . '

'; 58 | } 59 | 60 | return $feature; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-cta.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * Class: Boldgrid_Inspirations_Deploy_Cta. 13 | * 14 | * Responsible for installing pages during deployment. 15 | * 16 | * @since 1.0.7 17 | * @package Boldgrid_Inspirations_Deploy_Pages. 18 | * @subpackage Boldgrid_Inspirations_Deploy_Pages. 19 | * @author BoldGrid . 20 | * 21 | * @link https://boldgrid.com. 22 | */ 23 | class Boldgrid_Inspirations_Deploy_Cta { 24 | 25 | /** 26 | * Does content have CTA widget displayed. 27 | * 28 | * @access public 29 | * 30 | * @since 1.3.5 31 | */ 32 | public $has_cta = false; 33 | 34 | /** 35 | * Is BSTW going to be enabled. Default is true. 36 | * 37 | * @access public 38 | * 39 | * @since 1.3.5 40 | */ 41 | public $bstw_enabled = true; 42 | 43 | /** 44 | * Util. 45 | * 46 | * @since 2.7.6 47 | * 48 | * @var Boldgrid_Inspirations_Utility 49 | */ 50 | public $util; 51 | 52 | /** 53 | * Initialize Class. 54 | * 55 | * @since 1.3.5 56 | * 57 | * @access public 58 | */ 59 | public function __construct() { 60 | $this->util = new Boldgrid_Inspirations_Utility(); 61 | } 62 | 63 | /** 64 | * Add hooks. 65 | * 66 | * @since 1.3.5 67 | * 68 | * @access public 69 | */ 70 | public function add_hooks() { 71 | // add_filter( 'boldgrid_deployment_pre_insert_post', array( $this, 'has_cta' ) ); 72 | // add_action( 'boldgrid_deployment_deploy_theme_pre_return', array( $this, 'set_theme_mod' ) ); 73 | } 74 | 75 | /** 76 | * Check if content has a Call To Action Widget. 77 | * 78 | * This runs on the boldgrid_deployement_pre_insert_post filter, 79 | * and doesn't modify the actual post content for this. 80 | * 81 | * @since 1.3.5 82 | * 83 | * @access public 84 | * 85 | * @param Array $post Contains the post content. 86 | * 87 | * @return Array $post Contains the post content. 88 | */ 89 | public function has_cta( $post ) { 90 | $dom = new DOMDocument; 91 | $dom->loadHTML( $post['post_content'] ); 92 | $this->has_cta = $this->util->attribute_exists( $dom, 'data-cta', 'homepage' ); 93 | 94 | return $post; 95 | } 96 | 97 | /** 98 | * Gets the theme mods for theme being installed. 99 | * 100 | * @since 1.3.6 101 | * 102 | * @access public 103 | * 104 | * @return Array The collection of theme mods for a theme. 105 | */ 106 | public function get_theme_mods( $theme_folder_name ) { 107 | return get_option( 'theme_mods_' . $theme_folder_name, array() ); 108 | } 109 | 110 | /** 111 | * Set the bstw_enabled option for the theme being installed. 112 | * 113 | * @since 1.3.5 114 | * 115 | * @param String $theme_folder_name the name of theme being installed. 116 | */ 117 | public function set_theme_mod( $theme_folder_name ) { 118 | $mods = $this->get_theme_mods( $theme_folder_name ); 119 | 120 | // Set the value of bstw_enabled theme mod. 121 | $mods['bstw_enabled'] = $this->bstw_enabled; 122 | 123 | update_option( 'theme_mods_' . $theme_folder_name, $mods ); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-image.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * Class: Boldgrid_Inspirations_Deploy_Image. 13 | * 14 | * @since 1.4.8 15 | */ 16 | class Boldgrid_Inspirations_Deploy_Image { 17 | 18 | /** 19 | * Add hooks. 20 | * 21 | * @since 1.4.8 22 | */ 23 | public function add_hooks() { 24 | add_filter( 'boldgrid_deploy_post_process_image', array( $this, 'post_process_image' ), 10, 3 ); 25 | } 26 | 27 | /** 28 | * Method for boldgrid_deploy_post_process_image filter. 29 | * 30 | * @since 1.4.8 31 | * 32 | * @param int $id Attachment id. 33 | * @param int $width 34 | * @param int $height 35 | * @return string Url to attachment. 36 | */ 37 | public function post_process_image( $id, $width, $height ) { 38 | $width = (int) $width; 39 | $height = (int) $height; 40 | 41 | if( 0 === $width || 0 === $height ) { 42 | return wp_get_attachment_url( $id ); 43 | } 44 | 45 | Boldgrid_Inspirations_Attachment::resize( $id, $width, $height ); 46 | 47 | $image_src = wp_get_attachment_image_src( $id, array( $width, $height ) ); 48 | 49 | return $image_src[0]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-metadata.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Inspirations Deploy Metadata class. 13 | * 14 | * This class is designated for working with metadata surrounding a new site deployment. 15 | * 16 | * @since 1.3.9 17 | */ 18 | class Boldgrid_Inspirations_Deploy_Metadata{ 19 | 20 | /** 21 | * Get private posts. 22 | * 23 | * If you installed a Staging site via Inspirations, and that site included posts, those posts 24 | * were set to private. This method will return an array of those private post ids. 25 | * 26 | * @since 1.3.9 27 | * 28 | * @return array 29 | */ 30 | public static function get_private_posts() { 31 | $posts = array(); 32 | 33 | $metadata = get_option( 'boldgrid_staging_boldgrid_installed_pages_metadata', array() ); 34 | 35 | foreach( $metadata as $post_id => $post_data ) { 36 | if( 'private' === $post_data['post_status'] && 'post' === $post_data['post_type'] ) { 37 | $posts[] = $post_id; 38 | } 39 | } 40 | 41 | return $posts; 42 | } 43 | } 44 | 45 | ?> -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-pages.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * Class: Boldgrid_Inspirations_Deploy_Pages. 13 | * 14 | * Responsible for installing pages during deployment. 15 | * 16 | * @since 1.0.7 17 | * @package Boldgrid_Inspirations_Deploy_Pages. 18 | * @subpackage Boldgrid_Inspirations_Deploy_Pages. 19 | * @author BoldGrid . 20 | * 21 | * @link https://boldgrid.com. 22 | */ 23 | class Boldgrid_Inspirations_Deploy_Pages { 24 | 25 | /** 26 | * Variables relevant to page deploment. 27 | * 28 | * @since 1.0.7 29 | * @access protected 30 | * @var array $deployment_variables 31 | */ 32 | protected $deployment_variables = array (); 33 | 34 | /** 35 | * Temporary pages created for the purpose of forcing image replacement. 36 | * 37 | * @since 1.0.7 38 | * @access protected 39 | * @var array $temp_pages 40 | */ 41 | protected $temp_pages; 42 | 43 | /** 44 | * Pass deployment variables that are relevant to page installation 45 | * 46 | * @param array $deployment_variables 47 | * Variables relevant to page installation 48 | */ 49 | public function __construct( $deployment_variables ) { 50 | $this->deployment_variables = $deployment_variables; 51 | } 52 | 53 | /** 54 | * Create pages so that when the images are dynamically inserted, 55 | * the content markup us updated with the image urls. 56 | * 57 | * @since 1.0.7 58 | * 59 | * @param array $full_page_list 60 | * List of all pages returned from asset sever. 61 | * @return array $installed_page_ids List of installed pages. 62 | */ 63 | public function deploy_temp_pages( $full_page_list, $installed_page_ids ) { 64 | $this->temp_pages = array (); 65 | $requested_ids = array_keys( $installed_page_ids ); 66 | if ( ! empty( $full_page_list['pages']['additional'] ) ) { 67 | foreach ( $full_page_list['pages']['additional'] as $page ) { 68 | 69 | // Set Page variables 70 | $post['post_content'] = $page->code; 71 | $post['post_name'] = $page->page_slug; 72 | $post['post_title'] = $page->page_title; 73 | $post['post_status'] = $this->deployment_variables['post_status']; 74 | $post['post_type'] = $page->post_type; 75 | $post['comment_status'] = 'closed'; 76 | 77 | // Insert Post 78 | $post_id = wp_insert_post( $post ); 79 | 80 | $this->temp_pages[$page->id] = $post_id; 81 | 82 | /** 83 | * Create an entry into installed page_ids 84 | * This occurs AFTER this option is stored into the the DB, 85 | * but before this class property is used to replace media images 86 | */ 87 | $installed_page_ids[$page->id] = $post_id; 88 | } 89 | } 90 | 91 | return $installed_page_ids; 92 | } 93 | 94 | /** 95 | * Create pages so that when the images are dynamically inserted, 96 | * the content markup us updated with the image urls. 97 | * 98 | * @since 1.0.7 99 | * 100 | * @param array $full_page_list 101 | * List of all pages returned from asset sever. 102 | * @param array $installed_page_ids 103 | * List of installed pages. 104 | */ 105 | public function cleanup_temp_pages( $full_page_list, $installed_page_ids ) { 106 | $posts = array (); 107 | 108 | foreach ( $installed_page_ids as $page_id => $post_id ) { 109 | $post = get_post( $post_id ); 110 | 111 | // Store updated Content 112 | $posts[$page_id] = $post->post_content; 113 | 114 | // Delete the temp post 115 | if ( ! empty( $this->temp_pages[$page_id] ) ) { 116 | wp_delete_post( $this->temp_pages[$page_id], true ); 117 | } 118 | } 119 | 120 | foreach ( $full_page_list['pages']['pages_in_pageset'] as &$page ) { 121 | $page->code = ! empty( $posts[$page->id] ) ? $posts[$page->id] : ''; 122 | } 123 | foreach ( $full_page_list['pages']['additional'] as &$page ) { 124 | $page->code = ! empty( $posts[$page->id] ) ? $posts[$page->id] : ''; 125 | } 126 | 127 | update_option( 'boldgrid_static_pages', $full_page_list ); 128 | } 129 | } -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-post.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspiration Deploy Post class. 13 | * 14 | * This class handles tasks to take after a deployment has finished. 15 | * 16 | * @since 1.7.0 17 | */ 18 | class Boldgrid_Inspirations_Deploy_Post { 19 | /** 20 | * An instance of Boldgrid_Inspirations_Deploy_Status. 21 | * 22 | * @since 1.7.0 23 | * @access private 24 | * @var Boldgrid_Inspirations_Deploy_Status 25 | */ 26 | private $deploy_status; 27 | 28 | /** 29 | * An instance of Boldgrid_Inspirations_Installed. 30 | * 31 | * @since 1.7.0 32 | * @access private 33 | * @var Boldgrid_Inspirations_Installed 34 | */ 35 | private $installed; 36 | 37 | /** 38 | * Whether or not we are in the call immediately after a deployment. 39 | * 40 | * This is the call that triggers the after_switch_theme action. 41 | * 42 | * @since 1.7.0 43 | * @access private 44 | * @var bool 45 | */ 46 | private $is_post_deploy = false; 47 | 48 | /** 49 | * Constructor. 50 | * 51 | * @since 1.7.0 52 | */ 53 | public function __construct() { 54 | $this->is_post_deploy = ! empty( $_GET['doing_wp_cron'] ) && 'fire-after-theme-switch-hooks' === $_GET['doing_wp_cron']; 55 | 56 | $this->installed = new Boldgrid_Inspirations_Installed(); 57 | 58 | $this->deploy_status = new Boldgrid_Inspirations_Deploy_Status(); 59 | } 60 | 61 | /** 62 | * Add hooks. 63 | * 64 | * These hooks are added via the Boldgrid_Inspirations_Inspiration class, within its 65 | * add_hooks_always method. These hooks are added regardless of is_admin(). 66 | * 67 | * This method is ran within the "init" filter. Keep this in mind when adding filters below. 68 | * 69 | * @since 1.7.0 70 | */ 71 | public function add_hooks() { 72 | add_filter( 'option_theme_switched', array( $this, 'stop_switch_theme' ), 10, 2 ); 73 | 74 | if ( $this->is_post_deploy ) { 75 | add_filter( 'after_switch_theme', array( $this, 'install_widgets' ), 15 ); 76 | 77 | if ( ! empty( $_POST['install_cache'] ) ) { 78 | add_filter( 'wp_loaded', '\Boldgrid\Inspirations\W3TC\Utility::deploy_post_setup' ); 79 | } 80 | } 81 | } 82 | 83 | /** 84 | * Install widgets after a deployment. 85 | * 86 | * @since 1.7.0 87 | */ 88 | public function install_widgets() { 89 | // If we installed a blog, setup the blog widgets. 90 | if ( $this->installed->get_install_option( 'install_blog' ) ) { 91 | $configs = Boldgrid_Inspirations_Config::get_format_configs(); 92 | 93 | $blog = new Boldgrid_Inspirations_Blog( $configs ); 94 | $blog->create_sidebar_widgets(); 95 | } 96 | } 97 | 98 | /** 99 | * Prevent "after_switch_theme" action from running too soon. 100 | * 101 | * Within WordPress' switch_theme() function, the "theme_switched" option is set to the old 102 | * theme's stylesheet at the end of the method: 103 | * @link https://github.com/WordPress/WordPress/blob/03240dd3f4442546562824bc6a10ed7c197bd6b2/wp-includes/theme.php#L780 104 | * 105 | * If the "theme_switched" option is found, then ultimately the "after_switch_theme" action will 106 | * be ran. 107 | * @link https://github.com/WordPress/WordPress/blob/03240dd3f4442546562824bc6a10ed7c197bd6b2/wp-includes/theme.php#L2875 108 | * 109 | * If we are in the middle of deploying a site with Inspirations, then we don't want the 110 | * "after_switch_theme" action to run, as we're still in the middle of setting up the new site. 111 | * 112 | * To prevent this from happening, we will hook into the call to get the "theme_switched" option 113 | * and return false if we're in the middle of a deployment. 114 | * 115 | * @since 1.7.0 116 | * 117 | * @param mixed $value Value of the option. If stored serialized, it will be unserialized prior 118 | * to being returned. 119 | * @param string $option Option name. 120 | * 121 | */ 122 | public function stop_switch_theme( $value, $option ) { 123 | return $this->deploy_status->is_deploying() ? false : $value; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-deploy-status.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspiration Deploy Post class. 13 | * 14 | * This class is responsible for monitoring the status of the deployment process. 15 | * 16 | * @since 1.7.0 17 | */ 18 | class Boldgrid_Inspirations_Deploy_Status { 19 | /** 20 | * The expiration time of our transient. 21 | * 22 | * When a deployment starts, we set a transient to indicate this. A transient is used because 23 | * if an option was set instead and some fatal error prevented us from finishing the install, 24 | * we don't want the system to indefinitely think we're in the middle of installing a site. 25 | * 26 | * Current transient expiration is set to 3 minutes. 27 | * 28 | * @since 1.7.0 29 | * @access private 30 | * @var int 31 | */ 32 | private $transient_expiration = 180; 33 | 34 | /** 35 | * The transient name. 36 | * 37 | * @since 1.7.0 38 | * @access private 39 | * @var string 40 | */ 41 | private $transient_name = 'boldgrid_inspirations_full_deploy'; 42 | 43 | /** 44 | * Whether or not we are in the middle of deploying a site. 45 | * 46 | * @since 1.7.0 47 | * 48 | * @return bool 49 | */ 50 | public function is_deploying() { 51 | return false !== get_transient( $this->transient_name ); 52 | } 53 | 54 | /** 55 | * Flag that we are beginning a deployment. 56 | * 57 | * @since 1.7.0 58 | */ 59 | public function start() { 60 | set_transient( $this->transient_name, time(), $this->transient_expiration ); 61 | } 62 | 63 | /** 64 | * Flag that we have completed a deployment. 65 | * 66 | * @since 1.7.0 67 | */ 68 | public function stop() { 69 | delete_transient( $this->transient_name ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-easy-attachment-preview-size.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Inspirations Easy Attachment Preview Size. 13 | */ 14 | class Boldgrid_Inspirations_Easy_Attachment_Preview_Size { 15 | 16 | /** 17 | * Add hooks 18 | */ 19 | public function add_hooks() { 20 | if ( is_admin() ) { 21 | add_action( 'admin_enqueue_scripts', 22 | array ( 23 | $this, 24 | 'admin_enqueue_scripts' 25 | ) ); 26 | } 27 | } 28 | 29 | /** 30 | */ 31 | public function admin_enqueue_scripts( $hook ) { 32 | $allowed_hooks = array ( 33 | 'post.php', 34 | 'media-upload-popup' 35 | ); 36 | 37 | // Abort if necessary. 38 | if ( ! in_array( $hook, $allowed_hooks ) ) { 39 | return; 40 | } 41 | 42 | // Add our javascript. 43 | wp_enqueue_script( 'easy-attachment-preview-size', 44 | plugins_url( 'assets/js/easy-attachment-preview-size.js', 45 | BOLDGRID_BASE_DIR . '/boldgrid-inspirations.php' ), array (), BOLDGRID_INSPIRATIONS_VERSION, 46 | true ); 47 | 48 | // Add our css. 49 | wp_register_style( 'easy-attachment-preview-size', 50 | plugins_url( '/assets/css/easy-attachment-preview-size.css', 51 | BOLDGRID_BASE_DIR . '/boldgrid-inspirations.php' ), array (), BOLDGRID_INSPIRATIONS_VERSION ); 52 | wp_enqueue_style( 'easy-attachment-preview-size' ); 53 | } 54 | } -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-external-plugin.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid External Plugin class. 13 | */ 14 | class Boldgrid_Inspirations_External_Plugin { 15 | 16 | /** 17 | * An instance of WPB_Plugin. 18 | * 19 | * @var WPB_Plugin 20 | */ 21 | protected $configs; 22 | 23 | /** 24 | * Array of plugin statuses. 25 | * 26 | * @var array 27 | */ 28 | protected $boldgrid_plugins_status; 29 | 30 | /** 31 | * Accessor for active plugins. 32 | * 33 | * @return array 34 | */ 35 | public function get_active_boldgrid_plugins() { 36 | return $this->boldgrid_plugins_status; 37 | } 38 | 39 | /** 40 | * Accessor for configs. 41 | * 42 | * @return array 43 | */ 44 | public function get_configs() { 45 | return $this->configs; 46 | } 47 | 48 | /** 49 | * Checks if a paticular boldgrid plugin is active by name. 50 | * 51 | * @param string $name 52 | * @return boolean 53 | */ 54 | public function plugin_is_active( $name ) { 55 | return isset( $this->boldgrid_plugins_status[$name] ) ? $this->boldgrid_plugins_status[$name] : null; 56 | } 57 | 58 | /** 59 | * Accepts configs. 60 | * 61 | * @param array $configs 62 | */ 63 | public function __construct( $boldgrid_configs = null ) { 64 | $this->configs = $boldgrid_configs; 65 | 66 | add_action( 'wp_loaded', array ( 67 | $this, 68 | 'find_plugins' 69 | ) ); 70 | } 71 | 72 | /** 73 | * Check if plugin is active, before admin_init. 74 | * 75 | * @param string $plugin_name Sub-directory/file. 76 | */ 77 | public function is_active( $plugin_name ) { 78 | $all_active_plugins = $this->get_all_active_plugins(); 79 | return ( false !== array_search( $plugin_name, $all_active_plugins, true ) ); 80 | } 81 | 82 | /** 83 | * Get all active plugins. 84 | */ 85 | public function get_all_active_plugins() { 86 | $site_plugins = get_option( 'active_plugins', array () ); 87 | $sitewide_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); 88 | return array_unique( array_merge( $site_plugins, $sitewide_plugins ) ); 89 | } 90 | 91 | /** 92 | * Find all plugins that are active. 93 | */ 94 | public function find_plugins() { 95 | $configs = $this->get_configs(); 96 | 97 | $active_plugins = $this->get_all_active_plugins(); 98 | 99 | if ( ! empty( $configs ) ) { 100 | foreach ( $configs['plugins'] as $name => $plugin ) { 101 | $this->boldgrid_plugins_status[$name] = false !== array_search( $plugin['path'], 102 | $active_plugins ); 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-file.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | */ 11 | 12 | /** 13 | * The BoldGrid File class. 14 | */ 15 | class Boldgrid_Inspiration_File { 16 | /** 17 | * Zip. 18 | * 19 | * @link http://stackoverflow.com/questions/1334613/how-to-recursively-zip-a-directory-in-php 20 | * 21 | * @param unknown $source 22 | * @param unknown $destination 23 | * @return boolean 24 | */ 25 | public function zip( $source, $destination, $include_dir = true ) { 26 | if ( ! extension_loaded( 'zip' ) || ! file_exists( $source ) ) { 27 | wp_die( 28 | esc_html__( 'You do not have the zip extension loaded', 'boldgrid-inspirations' ) 29 | ); 30 | 31 | return false; 32 | } 33 | 34 | if ( file_exists( $destination ) ) { 35 | unlink( $destination ); 36 | } 37 | 38 | $zip = new ZipArchive(); 39 | 40 | if ( ! $zip->open( $destination, ZIPARCHIVE::CREATE ) ) { 41 | return false; 42 | } 43 | $source = str_replace( '\\', '/', realpath( $source ) ); 44 | 45 | if ( is_dir( $source ) ) { 46 | 47 | $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $source ), 48 | RecursiveIteratorIterator::SELF_FIRST ); 49 | 50 | if ( $include_dir ) { 51 | 52 | $arr = explode( '/', $source ); 53 | $maindir = $arr[count( $arr ) - 1]; 54 | 55 | $source = ''; 56 | for ( $i = 0; $i < count( $arr ) - 1; $i ++ ) { 57 | $source .= '/' . $arr[$i]; 58 | } 59 | 60 | $source = substr( $source, 1 ); 61 | 62 | $zip->addEmptyDir( $maindir ); 63 | } 64 | 65 | foreach ( $files as $file ) { 66 | $file = str_replace( '\\', '/', $file ); 67 | 68 | // Ignore "." and ".." folders 69 | if ( in_array( substr( $file, strrpos( $file, '/' ) + 1 ), 70 | array( 71 | '.', 72 | '..', 73 | ), true ) ) { 74 | continue; 75 | } 76 | 77 | $file = realpath( $file ); 78 | 79 | if ( is_dir( $file ) ) { 80 | $zip->addEmptyDir( str_replace( $source . '/', '', $file . '/' ) ); 81 | } else if ( is_file( $file ) ) { 82 | $zip->addFromString( str_replace( $source . '/', '', $file ), 83 | file_get_contents( $file ) ); 84 | } 85 | } 86 | } else if ( is_file( $source ) ) { 87 | $zip->addFromString( basename( $source ), file_get_contents( $source ) ); 88 | } 89 | 90 | return $zip->close(); 91 | } 92 | 93 | /** 94 | * Pass this function an absolute path to a directory. 95 | * It will scan the directory and return info about the file last updated. 96 | * 97 | * @param unknown $dir 98 | * @return Ambigous 99 | */ 100 | public function oldest_file_timestamp_in_directory( $dir ) { 101 | $greatest['time'] = 0; 102 | $greatest['file'] = ''; 103 | $result = scandir( $dir ); 104 | 105 | foreach ( $result as $k => $v ) { 106 | // if we're dealing with . or .., continue 107 | if ( in_array( $v, array( 108 | '.', 109 | '..' 110 | ), true ) ) { 111 | continue; 112 | } 113 | 114 | // If this is a file. 115 | $full_path = $dir . '/' . $v; 116 | 117 | if ( is_file( $full_path ) ) { 118 | // Get the timestamp of this file. 119 | $files_unix_time = filemtime( $dir . '/' . $v ); 120 | 121 | // If it's the oldest file, keep track of it. 122 | if ( $files_unix_time > $greatest['time'] ) { 123 | $greatest['time'] = $files_unix_time; 124 | $greatest['file'] = $full_path; 125 | } 126 | } elseif ( is_dir( $full_path ) ) { 127 | $directorys_greatest = $this->oldest_file_timestamp_in_directory( $full_path ); 128 | if ( $directorys_greatest['time'] > $greatest['time'] ) { 129 | $greatest['time'] = $directorys_greatest['time']; 130 | $greatest['file'] = $directorys_greatest['file']; 131 | } 132 | } 133 | } 134 | 135 | return $greatest; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-filter-storage.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Filter Storage class. 13 | * 14 | * Stores a value and calls any existing function with this value. 15 | */ 16 | class Boldgrid_Filter_Storage { 17 | /** 18 | * Filled by __construct(). 19 | * Used by __call(). 20 | * 21 | * @type mixed Any type you need. 22 | */ 23 | private $values; 24 | private $class; 25 | 26 | /** 27 | * Stores the values for later use. 28 | * 29 | * @param mixed $values 30 | */ 31 | public function __construct( $values, $class ) { 32 | $this->values = $values; 33 | $this->class = $class; 34 | } 35 | 36 | /** 37 | * Catches all function calls except __construct(). 38 | * 39 | * Be aware: Even if the function is called with just one string as an 40 | * argument it will be sent as an array. 41 | * 42 | * @param string $callback 43 | * Function name 44 | * @param array $arguments 45 | * @return mixed 46 | * @throws InvalidArgumentException 47 | */ 48 | public function __call( $callback, $arguments ) { 49 | if ( is_callable( array ( 50 | $this->class, 51 | $callback 52 | ) ) ) { 53 | return call_user_func( array ( 54 | $this->class, 55 | $callback 56 | ), $arguments, $this->values ); 57 | } 58 | 59 | // Wrong function called. No need to translate this error message. 60 | throw new InvalidArgumentException( 61 | sprintf( 62 | 'File: %1$s
Line %2$d
Not callable: %3$s', __FILE__, __LINE__, 63 | print_r( 64 | array ( 65 | $this->class, 66 | $callback, 67 | ), true 68 | ) 69 | ) 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-image-utility.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * An image utility class. 13 | * 14 | * @since 1.4.7 15 | */ 16 | class Boldgrid_Inspirations_Image_Utility { 17 | 18 | /** 19 | * Crop an image to a specific aspect ratio. 20 | * 21 | * If you have an original image 302px by 300px and you request to crop 22 | * it to an aspect ratio of 1:1, this method will return an image resource 23 | * 300px by 300px. 24 | * 25 | * @since 1.4.7 26 | * 27 | * @param string $filepath Path to the image. 28 | * @param int $width Width. 29 | * @param int $height Height. 30 | * @return bool True on success. 31 | */ 32 | public static function crop_to_aspect_ratio( $filepath, $width, $height ) { 33 | $width = (int) $width; 34 | $height = (int) $height; 35 | 36 | $image = wp_get_image_editor( $filepath ); 37 | if ( is_wp_error( $image ) ) { 38 | return false; 39 | } 40 | 41 | $image_size = $image->get_size(); 42 | 43 | // Abort if aspect ratios alrady match. 44 | if ( $width / $height === $image_size['width'] / $image_size['height'] ) { 45 | return true; 46 | } 47 | 48 | /* 49 | * Calculate largest area we can crop the existing image by while 50 | * keeping aspect ratio of requested width and height. 51 | * 52 | * Start off by using the image's width at the max width. If that 53 | * results in an image height too large, then use the image's height as 54 | * the max height. 55 | */ 56 | $new_width = $image_size['width']; 57 | $new_height = round( ( $height * $new_width ) / $width ); 58 | if ( $new_height > $image_size['height'] ) { 59 | $new_height = $image_size['height']; 60 | $new_width = round( ( $width * $new_height ) / $height ); 61 | } 62 | 63 | // Calculate new coordinates. 64 | $x0 = round( ( $image_size['width'] / 2 ) - ( $new_width / 2 ) ); 65 | $y0 = round( ( $image_size['height'] / 2 ) - ( $new_height / 2 ) ); 66 | 67 | $is_cropped = $image->crop( $x0, $y0, $new_width, $new_height ); 68 | if ( is_wp_error( $is_cropped ) ) { 69 | return false; 70 | } 71 | 72 | $is_saved = $image->save( $filepath ); 73 | if ( is_wp_error( $is_saved ) ) { 74 | return false; 75 | } 76 | 77 | return true; 78 | } 79 | } 80 | 81 | 82 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-installed.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspiration Installed class. 13 | * 14 | * This class is responsible for checking on the content that Inspirations has installed. 15 | * 16 | * @since 1.7.0 17 | */ 18 | class Boldgrid_Inspirations_Installed { 19 | /** 20 | * Get all pages installed by Inspirations. 21 | * 22 | * @since 1.7.0 23 | * 24 | * @link https://developer.wordpress.org/reference/functions/get_posts/ 25 | * 26 | * @return array An array of post objects or post IDs. 27 | */ 28 | public function get_all_pages( $args = array() ) { 29 | $page_ids = $this->get_page_ids( false ); 30 | 31 | $defaults = array( 32 | 'include' => $page_ids, 33 | 'post_type' => 'any', 34 | ); 35 | 36 | $args = wp_parse_args( $args, $defaults ); 37 | 38 | $pages = get_posts( $args ); 39 | 40 | return $pages; 41 | } 42 | 43 | /** 44 | * Get the page id's installed via Inspirations. 45 | * 46 | * They are stored as an array in the following format: 47 | * # KEY - The page id on the API server. 48 | * # VALUE - The local WordPress page id. 49 | * 50 | * Example: https://pastebin.com/drmnU0VC 51 | * 52 | * @since 1.7.0 53 | * 54 | * @param bool $as_is True to return the raw option value, false to return only the local page ids. 55 | */ 56 | public function get_page_ids( $as_is = true ) { 57 | $page_ids = get_option( 'boldgrid_installed_page_ids', array() ); 58 | 59 | return $as_is ? $page_ids : array_values( $page_ids ); 60 | } 61 | 62 | /** 63 | * Get all posts that Inspirations installed. 64 | * 65 | * This can be used to check whether or not the Inspirations process installed a blog or any 66 | * other posts. 67 | * 68 | * @return array An array of post objects or post IDs. 69 | */ 70 | public function get_all_posts() { 71 | $args = array( 72 | 'post_type' => 'post', 73 | ); 74 | 75 | return $this->get_all_pages( $args ); 76 | } 77 | 78 | /** 79 | * Get a single install option. 80 | * 81 | * @since 1.7.0 82 | * 83 | * @param string $key The specific install option. 84 | * @param mixed $default The default value returned if install option does not exist. 85 | * @return mixed 86 | */ 87 | public function get_install_option( $key, $default = false ) { 88 | $options = $this->get_install_options(); 89 | 90 | return isset( $options[$key] ) ? $options[$key] : $default; 91 | } 92 | 93 | /** 94 | * Get the install options. 95 | * 96 | * Management of the 'boldgrid_install_options' option was originally within the deploy class, 97 | * and has been moved here as of 1.7.0. 98 | * 99 | * @since 1.7.0 100 | * 101 | * @return array 102 | */ 103 | public function get_install_options() { 104 | return get_option( 'boldgrid_install_options', array() ); 105 | } 106 | 107 | /** 108 | * Determine whether or not we have deployed a site with Inspirations. 109 | * 110 | * @since 1.7.0 111 | * 112 | * @return bool 113 | */ 114 | public static function has_built_site() { 115 | return 'yes' === get_option( 'boldgrid_has_built_site' ); 116 | } 117 | 118 | /** 119 | * Check whether or not Inspirations has installed any posts. 120 | * 121 | * @since 1.7.0 122 | * 123 | * @return bool 124 | */ 125 | public function has_installed_posts() { 126 | $posts = $this->get_all_posts(); 127 | 128 | return ! empty( $posts ); 129 | } 130 | 131 | /** 132 | * Update the install options. 133 | * 134 | * Management of the 'boldgrid_install_options' option was originally within the deploy class, 135 | * and has been moved here as of 1.7.0. 136 | * 137 | * @since 1.7.0 138 | * 139 | * @param array $args 140 | */ 141 | public function update_install_options( $args = array() ) { 142 | update_option( 'boldgrid_install_options', $args ); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-purchase-coins.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Inspirations Purchase Coins class. 13 | */ 14 | class Boldgrid_Inspirations_Purchase_Coins extends Boldgrid_Inspirations { 15 | 16 | /** 17 | * Constructor. 18 | */ 19 | public function __construct() { 20 | parent::__construct(); 21 | } 22 | 23 | /** 24 | * Add hooks. 25 | */ 26 | public function add_hooks() { 27 | if ( is_admin() ) { 28 | ( Boldgrid_Inspirations_Config::use_boldgrid_menu() ? add_action( 'admin_menu', 29 | array ( 30 | $this, 31 | 'menu_purchase_coins' 32 | ), 1238 ) : add_action( 'admin_menu', 33 | array ( 34 | $this, 35 | 'menu_purchase_coins' 36 | ), 1456 ) ); 37 | } 38 | } 39 | 40 | /** 41 | * Purchase Coins submenu item. 42 | */ 43 | public function menu_purchase_coins() { 44 | ( Boldgrid_Inspirations_Config::use_boldgrid_menu() ? add_submenu_page( 45 | 'boldgrid-transactions', __( 'Purchase Coins', 'boldgrid-inspirations' ), __( 'Purchase Coins', 'boldgrid-inspirations' ), 'administrator', 46 | 'boldgrid-purchase-coins', array ( 47 | $this, 48 | 'page_purchase_coins' 49 | ) ) : add_submenu_page( 'boldgrid-inspirations', __( 'Purchase Coins', 'boldgrid-inspirations' ), __( 'Purchase Coins', 'boldgrid-inspirations' ), 50 | 'administrator', 'boldgrid-purchase-coins', 51 | array ( 52 | $this, 53 | 'page_purchase_coins' 54 | ) ) ); 55 | } 56 | 57 | /** 58 | * Menu callback. 59 | */ 60 | public function page_purchase_coins() { 61 | include BOLDGRID_BASE_DIR . '/pages/purchase_coins.php'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-redirect.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Inspiration Redirect class. 13 | * 14 | * This class is responsible for redirecting the user to the Inspirations process. 15 | * 16 | * @since 1.7.0 17 | */ 18 | class Boldgrid_Inspirations_Redirect { 19 | /** 20 | * The minimum Inspirations version required in order to auto redirect the user to the Inspirations 21 | * process. 22 | * 23 | * @since 1.7.0 24 | * @var string 25 | * @access private 26 | */ 27 | private $minimum_version = '1.7.0'; 28 | 29 | /** 30 | * The option name which stores redirect info. 31 | * 32 | * @since 1.7.0 33 | * @var string 34 | * @access private 35 | */ 36 | private $option_name = 'boldgrid_inspirations_redirect'; 37 | 38 | /** 39 | * Add Admin hooks. 40 | * 41 | * This method is called via the Boldgrid_Inspirations_Inspiration::add_hooks method, specifically 42 | * within the is_admin conditional. 43 | * 44 | * @since 1.7.0 45 | */ 46 | public function add_admin_hooks() { 47 | add_action( 'current_screen', array( $this, 'redirect' ) ); 48 | } 49 | 50 | /** 51 | * Get our option. 52 | * 53 | * @since 1.7.0 54 | * 55 | * @return mixed False if no option set, otherwise the time we redirected the user. 56 | */ 57 | private function get_option() { 58 | return get_option( $this->option_name ); 59 | } 60 | 61 | /** 62 | * Determine whether or not we need to redirect. 63 | * 64 | * @since 1.7.0 65 | */ 66 | private function maybe_redirect() { 67 | // If we're already on the Inspirations page, don't redirect. 68 | if ( Boldgrid_Inspirations_Built::is_inspirations() ) { 69 | /* 70 | * Flag that we've already done the redirect so that after the deployment it will 71 | * properly redirect to My Inspiration rather than back to Inspirations. 72 | */ 73 | $this->set_option(); 74 | 75 | return false; 76 | } 77 | 78 | // If we're not on the minimum required version, don't redirect. 79 | if ( ! version_compare( BOLDGRID_INSPIRATIONS_VERSION, $this->minimum_version, '>=' ) ) { 80 | return false; 81 | } 82 | 83 | // If the user doesn't have permission, don't redirect. 84 | if ( ! current_user_can( 'update_plugins' ) ) { 85 | return false; 86 | } 87 | 88 | // If we've already redirected the user before, don't do it again. 89 | $option_value = get_option( $this->option_name ); 90 | if ( ! empty( $option_value ) ) { 91 | return false; 92 | } 93 | 94 | return true; 95 | } 96 | 97 | /** 98 | * Redirect to Inspirations. 99 | * 100 | * @since 1.7.0 101 | */ 102 | public function redirect() { 103 | if ( $this->maybe_redirect() ) { 104 | $this->set_option(); 105 | 106 | wp_redirect( admin_url( 'admin.php?page=boldgrid-inspirations' ) ); 107 | exit; 108 | } 109 | } 110 | 111 | /** 112 | * Set our option value. 113 | * 114 | * @since 1.7.0 115 | */ 116 | public function set_option() { 117 | // Flag that we are redirecting the user to Inspirations. 118 | update_option( $this->option_name, time() ); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-screen.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * The BoldGrid Screen class. 13 | * 14 | * Handles actions based upon the wordpress admin screen. 15 | */ 16 | class Boldgrid_Inspirations_Screen { 17 | /** 18 | * Screen. 19 | * 20 | * @since 2.7.6 21 | * 22 | * @var WP_Screen 23 | */ 24 | public $screen; 25 | 26 | /** 27 | * Add hooks. 28 | */ 29 | public function add_hooks() { 30 | /** 31 | * Enqueue js and css files. 32 | */ 33 | 34 | // current_screen is an admin hook triggered after the necessary elements 35 | // to identify a screen are set up. 36 | add_action( 'current_screen', 37 | array( 38 | $this, 39 | 'enqueue_script_per_screen_id', 40 | ) 41 | ); 42 | 43 | // Pointers are registered per screen, which makes it fitting to configure them within 44 | // this screen class. 45 | add_action( 'current_screen', 46 | array( 47 | $this, 48 | 'enqueue_pointers_per_screen_id', 49 | ) 50 | ); 51 | 52 | // Load handlebar templates per screen. 53 | add_action( 'admin_footer', 54 | array( 55 | $this, 56 | 'admin_footer_handlebars_per_screen_id', 57 | ) 58 | ); 59 | } 60 | 61 | /** 62 | * Admin footer per screen id. 63 | */ 64 | public function admin_footer_handlebars_per_screen_id() { 65 | $this->set_screen(); 66 | 67 | $js_per_screen_id = array(); 68 | 69 | if ( in_array( $this->screen->id, $js_per_screen_id ) ) { 70 | include BOLDGRID_BASE_DIR . '/pages/templates/screen/id/' . $this->screen->id . '.php'; 71 | } 72 | } 73 | 74 | /** 75 | * Pointers (tooltips). 76 | * 77 | * Pointers are registered per screen, which makes it fitting to configure them within this 78 | * screen class. 79 | */ 80 | public function enqueue_pointers_per_screen_id() { 81 | include_once BOLDGRID_BASE_DIR . 82 | '/includes/class-boldgrid-inspirations-wp-help-pointers.php'; 83 | 84 | $pointers = new Boldgrid_WP_Help_Pointers(); 85 | 86 | $pointers->add_hooks(); 87 | } 88 | 89 | /** 90 | * Enqueue javascript based upon the screen id. 91 | */ 92 | public function enqueue_script_per_screen_id() { 93 | $this->set_screen(); 94 | 95 | $js_per_screen_id = array( 96 | 'appearance_page_staged-theme', 97 | 'media_page_boldgrid-connect-search', 98 | 'page', 99 | 'upload', 100 | ); 101 | 102 | if ( in_array( $this->screen->id, $js_per_screen_id, true ) ) { 103 | // Setup some vars. 104 | $handle = 'screen_id_js' . $this->screen->id; 105 | 106 | $file_path = 'assets/js/screen/id/' . $this->screen->id . '.js'; 107 | 108 | // Enqueue the js. 109 | wp_enqueue_script( 110 | $handle, 111 | plugins_url( 112 | $file_path, 113 | BOLDGRID_BASE_DIR . '/boldgrid-inspirations.php' 114 | ), 115 | array(), 116 | BOLDGRID_INSPIRATIONS_VERSION, 117 | true 118 | ); 119 | } 120 | } 121 | 122 | /** 123 | * Set screen. 124 | */ 125 | public function set_screen() { 126 | // Get the current screen if we don't already have it. 127 | if ( ! isset( $this->screen ) ) { 128 | $this->screen = get_current_screen(); 129 | 130 | // Uncomment the below during dev to see which screen you're on. 131 | // die( "
" . print_r( $this->screen, 1 ) . "
" ); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /includes/class-boldgrid-inspirations-widget.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Widget class. 13 | * 14 | * @since 1.4 15 | */ 16 | class Boldgrid_Inspirations_Widget { 17 | 18 | /** 19 | * Create a widget. 20 | * 21 | * Create a widget based upon the standard WordPress widgets. The option name is widget_$type, 22 | * it's an array, and each instance of that widget has a numeric key. 23 | * 24 | * @since 1.4 25 | * 26 | * @param string $type Such as "search" or "recent-posts". 27 | * @param mixed $value The value of your new widget, such as array(). 28 | * @return int The key of the new widget. 29 | */ 30 | public static function create_widget( $type, $value ) { 31 | $widget_name = 'widget_' . $type; 32 | 33 | $widgets = get_option( $widget_name ); 34 | 35 | $widgets[] = $value; 36 | 37 | update_option( $widget_name, $widgets ); 38 | 39 | return max( array_keys( $widgets ) ); 40 | } 41 | 42 | /** 43 | * Return the sidebars_widgets option. 44 | * 45 | * @since 1.4 46 | * 47 | * @return array 48 | */ 49 | public static function get_sidebars_widgets() { 50 | return get_option( 'sidebars_widgets', array() ); 51 | } 52 | 53 | /** 54 | * Update sidebars_widgets. 55 | * 56 | * @since 1.4 57 | * 58 | * @param string $sidebar The sidebar to update, such as 'sidebar-1'. 59 | * @param string $id The new widget to add, such as 'search-4'. 60 | * @return bool True if update was successful. 61 | */ 62 | public static function add_to_sidebars( $sidebar, $id ) { 63 | $widgets = self::get_sidebars_widgets(); 64 | 65 | $widgets[ $sidebar ][] = $id; 66 | 67 | return self::update_sidebars_widgets( $widgets ); 68 | } 69 | 70 | /** 71 | * Empty a sidebar within the sidebars_widgets option. 72 | * 73 | * @since 1.4 74 | * 75 | * @param string $sidebar The sidebar to empty, such as 'sidebar-1'. 76 | */ 77 | public static function empty_sidebar( $sidebar ) { 78 | $sidebars_widgets = self::get_sidebars_widgets(); 79 | 80 | $sidebars_widgets[ $sidebar ] = array(); 81 | 82 | self::update_sidebars_widgets( $sidebars_widgets ); 83 | } 84 | 85 | /** 86 | * Update the sidebars_widgets option. 87 | * 88 | * @since 1.4 89 | * 90 | * @param array $value The new value. 91 | */ 92 | public static function update_sidebars_widgets( $value ) { 93 | return update_option( 'sidebars_widgets', $value ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /includes/config/.gitignore: -------------------------------------------------------------------------------- 1 | *.local.php -------------------------------------------------------------------------------- /includes/config/config.sample.php: -------------------------------------------------------------------------------- 1 | 'https://wp-assets-dev.boldgrid.com', 16 | 'preview_server' => 'https://wp-preview-dev.boldgrid.com', 17 | 'author_preview_server' => 'https://wp-staging-dev.boldgrid.com', 18 | ); 19 | /* @formatter:on */ -------------------------------------------------------------------------------- /includes/config/survey.config.php: -------------------------------------------------------------------------------- 1 | %1$s', 21 | $email 22 | ); 23 | 24 | $map_iframe = sprintf( 25 | '', 26 | urlencode( $address ) 27 | ); 28 | 29 | return array( 30 | 'find_and_replace' => array( 31 | array( 32 | 'removal_key' => 'phone', 33 | 'value' => $phone, 34 | 'display' => $display_phone, 35 | 'on_success' => 'node_value', 36 | ), 37 | array( 38 | 'removal_key' => 'address', 39 | 'value' => $address, 40 | 'display' => $display_address, 41 | 'on_success' => 'node_value', 42 | ), 43 | array( 44 | 'removal_key' => 'email', 45 | 'value' => $email, 46 | 'display' => $display_email, 47 | 'parent_attributes' => array( 'href' => 'mailto:' . $email, ), 48 | 'on_success' => 'node_value', 49 | ), 50 | array( 51 | 'removal_key' => 'map', 52 | 'value' => $map_iframe, 53 | 'display' => $display_address, 54 | 'on_success' => 'remove_children', 55 | 'parent_style' => true, 56 | ), 57 | ), 58 | 'footer_company_details' => array( 59 | '© ' . date( 'Y' ) . ' ' . $blogname, 60 | $display_address ? $address : null, 61 | $display_phone ? $phone : null, 62 | $display_email ? $mailto : null, 63 | ), 64 | ); 65 | ?> -------------------------------------------------------------------------------- /includes/configure_plugin/contact-form-7.php: -------------------------------------------------------------------------------- 1 | ID . '" title="Contact form 1"]'; 13 | 14 | // update the post and replace [imhwpb-form] with the shortcode used by cf7 15 | // $post_id is coming from the file in which this was included 16 | $page_needing_form = get_post( $post_id ); 17 | $page_needing_form->post_content = str_replace( '[imhwpb-form]', $short_code, 18 | $page_needing_form->post_content ); 19 | wp_update_post( $page_needing_form ); 20 | 21 | // update the email address of the recipient 22 | global $current_user; 23 | get_currentuserinfo(); 24 | $postmeta = get_post_meta( $auto_created_form->ID, '_mail', true ); 25 | $postmeta['recipient'] = "wpb@boldgrid.com"; 26 | if ( $current_user->user_email != "" ) { 27 | $postmeta['recipient'] = $current_user->user_email; 28 | } 29 | update_post_meta( $auto_created_form->ID, '_mail', $postmeta ); 30 | 31 | -------------------------------------------------------------------------------- /includes/configure_plugin/wc-gallery.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Crio Premium Utility class. 15 | * 16 | * This handles the storing of author ids and coorelation between them and local IDs. 17 | * 18 | * @since sinceversion 19 | */ 20 | class Author_Ids { 21 | 22 | /** 23 | * Set Author IDs. 24 | * 25 | * Sets the author IDs option. 26 | * 27 | * @param array $author_ids Author IDs. 28 | * 29 | * @static 30 | */ 31 | public static function set_author_ids( $author_ids_to_local ) { 32 | update_option( 'boldgrid_author_ids_to_local', $author_ids_to_local ); 33 | } 34 | 35 | /** 36 | * Get Author ID From Local ID. 37 | * 38 | * Returns the author id using the local ID as reference. 39 | * 40 | * @return string Author ID. 41 | * 42 | * @static 43 | */ 44 | public static function get_from_local( $local_id ) { 45 | $ids_option = get_option( 'boldgrid_author_ids_to_local', array() ); 46 | 47 | return array_search( $local_id, $ids_option ) ? array_search( $local_id, $ids_option ) : $local_id; 48 | } 49 | 50 | /** 51 | * Get Local ID from Author ID. 52 | * 53 | * Returns the local ID using the author ID as reference. 54 | * 55 | * @return string Local ID. 56 | * 57 | * @static 58 | */ 59 | public static function get_from_author( $author_id ) { 60 | $ids_option = get_option( 'boldgrid_author_ids_to_local', array() ); 61 | 62 | return isset( $ids_option[ $author_id ] ) ? $ids_option[ $author_id ] : $author_id; 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /includes/deploy/class-cache.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Deploy Cache class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Cache { 19 | /** 20 | * Our deploy class. 21 | * 22 | * @since 2.5.0 23 | * @access private 24 | * @var Boldgrid_Inspirations_Deploy 25 | */ 26 | private $deploy; 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @since 2.5.0 32 | * 33 | * @param Boldgrid_Inspirations_Deploy $deploy 34 | */ 35 | public function __construct( \Boldgrid_Inspirations_Deploy $deploy ) { 36 | $this->deploy = $deploy; 37 | } 38 | 39 | /** 40 | * Install our caching plugin. 41 | * 42 | * @since 2.5.0 43 | */ 44 | public function install() { 45 | $data = (object) [ 46 | 'plugin_zip_url' => 'https://downloads.wordpress.org/plugin/w3-total-cache.zip', 47 | 'plugin_title' => 'W3 Total Cache', 48 | 'plugin_activate_path' => 'w3-total-cache/w3-total-cache.php', 49 | ]; 50 | 51 | $this->deploy->download_and_install_plugin( 52 | $data->plugin_zip_url, 53 | $data->plugin_activate_path, 54 | null, 55 | $data 56 | ); 57 | 58 | $slug = explode( '/', $data->plugin_activate_path )[0]; 59 | $this->deploy->messages->print_plugin( $data->plugin_title, $slug ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /includes/deploy/class-crio-utility.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Crio Utility class. 15 | * 16 | * @since sinceversion 17 | */ 18 | class Crio_Utility { 19 | /** 20 | * Setup our template locations taxonomy. 21 | * 22 | * This code is copied directly from Crio. In the future, it would help if these were static methods 23 | * within Crio that we could call directly. 24 | * @see /src/includes/page-headers/templates/class-crio-premium-page-headers-templates.php 25 | * 26 | * @since SINCEVERSION 27 | */ 28 | public static function register_template_locations() { 29 | $taxonomy = 'template_locations'; 30 | 31 | // Labels part for the GUI 32 | $labels = array( 33 | 'name' => __( 'Template Location', 'bgtfw' ), 34 | 'singular_name' => _x( 'Template Location', 'taxonomy singular name' ), 35 | 'search_items' => __( 'Search Template Locations', 'bgtfw' ), 36 | 'all_items' => null, 37 | 'parent_item' => null, 38 | 'parent_item_colon' => null, 39 | 'edit_item' => __( 'Edit Template Location', 'bgtfw' ), 40 | 'update_item' => __( 'Update Template Location', 'bgtfw' ), 41 | 'add_new_item' => null, 42 | 'new_item_name' => null, 43 | 'menu_name' => __( 'Template Locations', 'bgtfw' ), 44 | 'most_used' => null, 45 | ); 46 | 47 | $locations = array( 48 | 'header', 49 | 'sticky-header', 50 | 'footer', 51 | ); 52 | 53 | // Register our taxonomy. It may already exist if Crio is already installed. 54 | if ( ! taxonomy_exists( $taxonomy ) ) { 55 | register_taxonomy( 56 | $taxonomy, 57 | 'crio_page_header', 58 | array( 59 | 'hierarchical' => true, 60 | 'labels' => $labels, 61 | 'public' => true, 62 | 'show_ui' => true, 63 | 'show_in_menu' => false, 64 | 'show_in_rest' => true, 65 | 'update_count_callback' => '_update_post_term_count', 66 | 'query_var' => true, 67 | 'rewrite' => array( 'slug' => 'template_location' ), 68 | 'meta_box_cb' => false, 69 | 'capabilities' => array( 70 | 'manage_terms' => '', 71 | 'edit_terms' => '', 72 | 'delete_terms' => '', 73 | 'assign_terms' => 'edit_posts', 74 | ), 75 | ) 76 | ); 77 | } 78 | 79 | // Add our terms. 80 | foreach ( $locations as $slug ) { 81 | $name = ucwords( str_replace( '-', ' ', $slug ) ); 82 | // Crio may already be installed, so check for existing terms. 83 | if ( ! term_exists( $slug, $taxonomy ) ) { 84 | wp_insert_term( $name, $taxonomy, array( 'slug' => $slug ) ); 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /includes/deploy/class-invoice.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Deploy Invoice class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Invoice { 19 | /** 20 | * Our deploy class. 21 | * 22 | * @since 2.5.0 23 | * @access private 24 | * @var Boldgrid_Inspirations_Deploy 25 | */ 26 | private $deploy; 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @since 2.5.0 32 | * 33 | * @param Boldgrid_Inspirations_Deploy $deploy 34 | */ 35 | public function __construct( \Boldgrid_Inspirations_Deploy $deploy ) { 36 | $this->deploy = $deploy; 37 | } 38 | 39 | /** 40 | * Run the deployment of our invoicing plugin. 41 | * 42 | * @since 2.5.0 43 | * 44 | * @param array $args An array of arguments. 45 | */ 46 | public function deploy( $args = array() ) { 47 | $this->install(); 48 | 49 | // Import our weForms form and get the id. 50 | \Boldgrid\Inspirations\Weforms\Utility::import_json_file( dirname( __FILE__ ) . '/invoice/forms/get-a-quote.json' ); 51 | $form = \Boldgrid\Inspirations\Weforms\Utility::get_by_title( 'Get a Quote Form' ); 52 | if ( empty( $form->id ) ) { 53 | return false; 54 | } 55 | 56 | // Insert our "Get a Quote" page. $form->id is used in get-a-quote.php below. 57 | $post = include 'invoice/posts/get-a-quote.php'; 58 | $post_id = wp_insert_post( $post ); 59 | 60 | // Add the new post to the menu. 61 | wp_update_nav_menu_item( $args['menu_id'], 0, array( 62 | 'menu-item-object-id' => $post_id, 63 | 'menu-item-parent-id' => 0, 64 | 'menu-item-object' => 'page', 65 | 'menu-item-type' => 'post_type', 66 | 'menu-item-status' => 'publish' 67 | ) ); 68 | 69 | // Print a message to the user that we just created this page. 70 | $post_object = new \stdClass(); 71 | $post_object->page_title = $post['post_title']; 72 | $this->deploy->messages->print_page( $post_object ); 73 | } 74 | 75 | /** 76 | * Install Sprout Invoices. 77 | * 78 | * @since 2.5.0 79 | */ 80 | public function install() { 81 | $data = (object) [ 82 | 'plugin_zip_url' => 'https://downloads.wordpress.org/plugin/sprout-invoices.zip', 83 | 'plugin_title' => 'Sprout Invoices', 84 | 'plugin_activate_path' => 'sprout-invoices/sprout-invoices.php', 85 | ]; 86 | 87 | $this->deploy->download_and_install_plugin( 88 | $data->plugin_zip_url, 89 | $data->plugin_activate_path, 90 | null, 91 | $data 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /includes/deploy/class-logo.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Deploy Logo class. 15 | * 16 | * @since SINCEVERSION 17 | */ 18 | class Logo { 19 | /** 20 | * Download and setup a logo. 21 | * 22 | * @since SINCEVERSION 23 | * 24 | * @param int $asset_id The asset_id of our logo. 25 | * @param Boldgrid_Inspirations_Deploy $deploy Our deployment class. 26 | */ 27 | public static function deploy( $asset_id, $deploy ) { 28 | if ( ! is_numeric( $asset_id ) ) { 29 | return false; 30 | } 31 | 32 | $attachment_data = $deploy->asset_manager->download_and_attach_asset( false, $asset_id, null, 'all' ); 33 | 34 | if ( empty( $attachment_data['attachment_id'] ) || ! is_numeric( $attachment_data['attachment_id'] ) ) { 35 | return false; 36 | } else { 37 | $attachment_id = $attachment_data['attachment_id']; 38 | } 39 | 40 | set_theme_mod( 'custom_logo', $attachment_id ); 41 | update_option( 'site_logo', $attachment_id ); 42 | 43 | return true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /includes/deploy/class-post-meta.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Post Meta Class. 15 | * 16 | * This handles the deploying of post meta. 17 | * 18 | * @since sinceversion 19 | */ 20 | class Post_Meta { 21 | /** 22 | * Post Meta Keys. 23 | * 24 | * These post meta keys are to be imported when setting 25 | * post meta. Any post meta that is not in this array will 26 | * not be imported during the inspirations process. 27 | * 28 | * @var array post meta keys. 29 | */ 30 | public static $post_meta_keys = array( 31 | 'crio-premium-page-header-override', 32 | 'crio-premium-page-header-select', 33 | 'crio-premium-page-header-background', 34 | 'crio-premium-page-header-featured-image-background', 35 | 'crio-premium-template-has-page-title', 36 | 'crio-premium-include-site-header', 37 | ); 38 | 39 | /** 40 | * Set Post Meta 41 | * 42 | * This is run after all pages / posts are added to the site. 43 | * 44 | * Currently this is only used to add post meta fields for Crio Premium, 45 | * but it can be used by other plugins as well. 46 | * 47 | * @param int $post_id Post ID. 48 | * @param array $post_meta Post Meta. 49 | * @param bool $filter_post_meta Whether or not the post_meta should be filtered to replace the local ID with the author ID. 50 | */ 51 | public static function set_post_meta( $post_id, $post_meta, $filter_post_meta = false ) { 52 | foreach ( $post_meta as $key => $value ) { 53 | if ( false !== array_search( $key, self::$post_meta_keys, true ) && false !== $filter_post_meta ) { 54 | $filtered_value = \Boldgrid\Inspirations\Deploy\Author_Ids::get_from_author( $value[0] ); 55 | update_post_meta( $post_id, $key, $filtered_value ); 56 | } else if ( false !== array_search( $key, self::$post_meta_keys, true ) ) { 57 | update_post_meta( $post_id, $key, $value ); 58 | } 59 | } 60 | } 61 | 62 | } 63 | 64 | -------------------------------------------------------------------------------- /includes/deploy/class-social-menu.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Deploy; 12 | 13 | /** 14 | * Social Menu class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Social_Menu { 19 | /** 20 | * Our deploy class. 21 | * 22 | * @since 2.5.0 23 | * @access private 24 | * @var Boldgrid_Inspirations_Deploy 25 | */ 26 | private $deploy; 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @since 2.5.0 32 | * 33 | * @param Boldgrid_Inspirations_Deploy $deploy 34 | */ 35 | public function __construct( \Boldgrid_Inspirations_Deploy $deploy ) { 36 | $this->deploy = $deploy; 37 | } 38 | 39 | /** 40 | * Create a unique menu for our social links. 41 | * 42 | * @since 2.5.0 43 | * 44 | * @param string $name Menu name. 45 | * @return int Id of menu created. 46 | */ 47 | public function create_menu( $name ) { 48 | $original_name = $name; 49 | $count = 2; 50 | 51 | /* 52 | * Get a unique name for our menu. 53 | * 54 | * Start off by trying to create $name. If it doesn't exist, try $name-1, $name-2, etc. 55 | */ 56 | $menu_object = wp_get_nav_menu_object( $name ); 57 | while( ! empty( $menu_object ) ) { 58 | $name = $original_name . '-' . $count; 59 | $menu_object = wp_get_nav_menu_object( $name ); 60 | $count++; 61 | } 62 | 63 | return wp_create_nav_menu( $name ); 64 | } 65 | 66 | /** 67 | * Create a social media menu based off of survey data and assign to social nav menu location. 68 | * 69 | * This method should only be ran for Crio themes. 70 | * 71 | * This method has been introduced for Crio. Prior, the social media menu was created by filtering 72 | * the bgtfw configs. As of Crio, that code no longer exists, and so we must actually create a menu. 73 | * 74 | * @since 2.5.0 75 | */ 76 | public function deploy() { 77 | // Make sure we have social media data. 78 | $socials = $this->get_social(); 79 | if ( empty( $socials ) ) { 80 | return; 81 | } 82 | 83 | // Create a menu. 84 | $menu_id = $this->create_menu( 'social' ); 85 | if ( is_wp_error( $menu_id ) ) { 86 | return; 87 | } 88 | 89 | // Add all of our menu items. 90 | foreach ( $socials as $network => $url ) { 91 | wp_update_nav_menu_item( 92 | $menu_id, 93 | 0, 94 | [ 95 | 'menu-item-title' => $network, 96 | 'menu-item-url' => $url, 97 | 'menu-item-status' => 'publish', 98 | ] 99 | ); 100 | } 101 | 102 | // Save our new menu to the theme's nav_menu_locations. 103 | $locations = get_theme_mod( 'nav_menu_locations', array() ); 104 | $locations['footer-social'] = $menu_id; 105 | $locations['social'] = $menu_id; 106 | set_theme_mod( 'nav_menu_locations', $locations ); 107 | } 108 | 109 | /** 110 | * Get our social media data. 111 | * 112 | * Data is gathered from the user via the Inspirations process. 113 | * 114 | * @since 2.5.0 115 | * 116 | * @return array Example: https://pastebin.com/ANt5G8uq 117 | */ 118 | public function get_social() { 119 | $social = $this->deploy->survey->get_social(); 120 | 121 | // Preview sites should show a social media menu. If preview server, set dummy data. 122 | if ( empty( $social ) && $this->deploy->is_preview_server ) { 123 | $social = [ 124 | 'facebook' => 'https://facebook.com', 125 | 'twitter' => 'https://twitter.com', 126 | ]; 127 | } 128 | 129 | return $social; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /includes/deploy/invoice/posts/get-a-quote.php: -------------------------------------------------------------------------------- 1 | 'get-a-quote', 7 | 'post_title' => 'Get a Quote', 8 | 'post_status' => 'publish', 9 | 'post_type' => 'page', 10 | 'comment_status' => 'closed', 11 | 'post_content' => ' 12 |
13 |
14 |
15 |
16 |

 

17 |

Are you looking to get a quote for our services? Please fill out the form below and provide us with all necessary information for us to generate a quote. We will get back with you within 1 to 2 business days.

18 |

[weforms id="' . $form->id . '"]

19 |
20 |
21 |
22 |
23 | ', 24 | ); 25 | 26 | return $post; 27 | -------------------------------------------------------------------------------- /includes/onboarding/class-task-card.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Onboarding; 12 | 13 | /** 14 | * Onboarding Task class. 15 | * 16 | * @since 2.8.0 17 | */ 18 | class Task_Card { 19 | /** 20 | * The card ID. 21 | * 22 | * @since 2.8.0 23 | * 24 | * @var string 25 | */ 26 | var $id; 27 | 28 | /** 29 | * The card title. 30 | * 31 | * @since 2.8.0 32 | * 33 | * @var string 34 | */ 35 | var $title; 36 | 37 | /** 38 | * The card description. 39 | * 40 | * @since 2.8.0 41 | * 42 | * @var string 43 | */ 44 | var $description; 45 | 46 | /** 47 | * The card color. 48 | * 49 | * @since 2.8.0 50 | * 51 | * @var string 52 | */ 53 | var $color; 54 | 55 | /** 56 | * The card icon. 57 | * 58 | * @since 2.8.0 59 | * 60 | * @var string 61 | */ 62 | var $icon; 63 | 64 | /** 65 | * The card tasks. 66 | * 67 | * @since 2.8.0 68 | * 69 | * @var array 70 | */ 71 | var $tasks; 72 | 73 | /** 74 | * Constructor. 75 | * 76 | * @since 2.8.0 77 | * 78 | * @param string $id The card ID. 79 | * @param string $title The card title. 80 | * @param string $description The card description. 81 | * @param string $color The card color. 82 | * @param string $icon The card icon. 83 | * @param array $tasks The card tasks. 84 | */ 85 | public function __construct( $id, $title, $description, $colors, $icon, $tasks ) { 86 | $this->id = $id; 87 | $this->title = $title; 88 | $this->description = $description; 89 | $this->colors = $colors; 90 | $this->icon = $icon; 91 | $this->tasks = $tasks; 92 | } 93 | 94 | /** 95 | * Render 96 | * 97 | * @since 2.8.0 98 | * 99 | * @return string The rendered HTML. 100 | */ 101 | public function render() { 102 | $tasks = ''; 103 | foreach ( $this->tasks as $task_data ) { 104 | $task = new Task( 105 | $task_data['id'], 106 | $task_data['title'], 107 | $task_data['description'], 108 | $task_data['card_id'], 109 | empty( $task_data['links'] ) ? array() : $task_data['links'], 110 | empty( $task_data['buttons'] ) ? array() : $task_data['buttons'], 111 | $task_data['task_complete'] 112 | ); 113 | 114 | $tasks .= $task->render(); 115 | } 116 | 117 | $card = sprintf( 118 | '
119 |
120 |

%4$s

121 |
%5$s
122 |
123 |
124 | 125 |
126 |
%7$s
127 |
', 128 | esc_attr( $this->id ), 129 | esc_attr( $this->colors[0] ), 130 | esc_attr( $this->colors[1] ), 131 | esc_html( $this->title ), 132 | wp_kses_post( $this->description ), 133 | esc_attr( $this->icon ), 134 | wp_kses_post( $tasks ) 135 | ); 136 | 137 | return $card; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /includes/sprout/class-utility.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Sprout; 12 | 13 | /** 14 | * Sprout Utility Class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Utility { 19 | /** 20 | * Prevent Sprout from redirecting after being installed by Inspirations. 21 | * 22 | * Sprout's normal hook at 10 adds the option - which will trigger the redirect. We hook in at 23 | * priority 15 and delete the option. 24 | * 25 | * @since 2.5.0 26 | */ 27 | public static function cancel_activation_redirection() { 28 | delete_option( 'si_do_activation_redirect' ); 29 | } 30 | 31 | /** 32 | * Get an instace of \Boldgrid\Library\Library\Plugin for this plugin. 33 | * 34 | * @since 2.5.0 35 | * 36 | * @return \Boldgrid\Library\Library\Plugin 37 | */ 38 | public static function get_plugin() { 39 | return \Boldgrid\Library\Library\Plugin\Factory::create( 'sprout-invoices' ); 40 | } 41 | 42 | /** 43 | * Whether or not Sprout was installed during a deployment. 44 | * 45 | * @since 2.5.0 46 | * 47 | * @return bool 48 | */ 49 | public static function is_deploy() { 50 | $installed = new \Boldgrid_Inspirations_Installed(); 51 | $option = $installed->get_install_option( 'install_invoice' ); 52 | 53 | return ! empty( $option ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /includes/w3tc/class-utility.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\W3TC; 12 | 13 | /** 14 | * W3TC Utility Class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Utility { 19 | /** 20 | * Configure W3TC after an Inspiration's deploy. 21 | * 22 | * @since 2.5.0 23 | * 24 | * @see Boldgrid_Inspirations_Deploy_Post::add_hooks. 25 | */ 26 | public static function deploy_post_setup() { 27 | if ( ! class_exists( '\W3TC\Config' ) ) { 28 | return; 29 | } 30 | 31 | $changes_made = false; 32 | 33 | $config = new \W3TC\Config(); 34 | 35 | // If page cache is not enabled, enable it. 36 | if ( ! $config->get_boolean( 'pgcache.enabled' ) ) { 37 | $config->set( 'pgcache.enabled', true ); 38 | $config->set( 'pgcache.engine', 'file' ); 39 | $changes_made = true; 40 | } 41 | 42 | if ( $changes_made ) { 43 | $config->save(); 44 | } 45 | } 46 | 47 | /** 48 | * Get an instace of \Boldgrid\Library\Library\Plugin for this plugin. 49 | * 50 | * @since 2.5.0 51 | * 52 | * @return \Boldgrid\Library\Library\Plugin 53 | */ 54 | public static function get_plugin() { 55 | return \Boldgrid\Library\Library\Plugin\Factory::create( 'w3-total-cache' ); 56 | } 57 | 58 | /** 59 | * Whether or not W3TC was installed during a deployment. 60 | * 61 | * @since 2.5.0 62 | * 63 | * @return bool 64 | */ 65 | public static function is_deploy() { 66 | $installed = new \Boldgrid_Inspirations_Installed(); 67 | $option = $installed->get_install_option( 'install_cache' ); 68 | 69 | return ! empty( $option ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /includes/weforms/class-utility.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | namespace Boldgrid\Inspirations\Weforms; 12 | 13 | /** 14 | * weForms Untility class. 15 | * 16 | * @since 2.5.0 17 | */ 18 | class Utility { 19 | /** 20 | * Get all forms. 21 | * 22 | * @since 2.5.0 23 | * 24 | * @return array 25 | */ 26 | public static function get_all_forms() { 27 | $forms_manager = new \WeForms_Form_Manager(); 28 | 29 | $all_forms = $forms_manager->all(); 30 | 31 | return empty( $all_forms['forms'] ) ? array() : $all_forms['forms']; 32 | } 33 | 34 | /** 35 | * Get a form by title. 36 | * 37 | * Returns the first form that matches. 38 | * 39 | * @since 2.5.0 40 | * 41 | * @param string $title 42 | * @return mixed WeForms_Form Object on success, false when not found. 43 | */ 44 | public static function get_by_title( $title ) { 45 | $all_forms = self::get_all_forms(); 46 | 47 | foreach ( $all_forms as $form ) { 48 | if ( $title === $form->data->post_title ) { 49 | return $form; 50 | } 51 | } 52 | 53 | return false; 54 | } 55 | 56 | /** 57 | * Import a json file. 58 | * 59 | * @since 2.5.0 60 | * 61 | * @param string $filepath Path to json file. 62 | * @return bool Status of import. 63 | */ 64 | public static function import_json_file( $filepath ) { 65 | if ( ! class_exists( 'WeForms_Form' ) ) { 66 | require_once WP_PLUGIN_DIR . '/weforms/includes/class-form.php'; 67 | } 68 | 69 | if ( ! class_exists( 'WeForms_Admin_Tools' ) ) { 70 | require_once WP_PLUGIN_DIR . '/weforms/includes/admin/class-admin-tools.php'; 71 | } 72 | 73 | return \WeForms_Admin_Tools::import_json_file( $filepath ); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /languages/boldgrid-inspirations-de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoldGrid/boldgrid-inspirations/ac2c50772ec7e60fd75023e64b5dddd740a96aaa/languages/boldgrid-inspirations-de_DE.mo -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "boldgrid-inspirations", 3 | "version": "2.9.4", 4 | "description": "BoldGrid Inspirations WordPress plugin", 5 | "directories": { 6 | "test": "tests" 7 | }, 8 | "scripts": { 9 | "build": "npm run create-pot", 10 | "create-pot": "php -d xdebug.max_nesting_level=500 \"$(which wp)\" i18n make-pot . languages/boldgrid-inspirations.pot", 11 | "js-lint": "prettier-eslint assets/**/*.js --list-different", 12 | "js-lint-fix": "prettier-eslint assets/**/*.js --write" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/boldgrid/boldgrid-inspirations.git" 17 | }, 18 | "keywords": [ 19 | "boldgrid" 20 | ], 21 | "author": "BoldGrid", 22 | "license": "GPL-2.0", 23 | "bugs": { 24 | "url": "https://github.com/boldgrid/boldgrid-inspirations/issues" 25 | }, 26 | "homepage": "https://github.com/boldgrid/boldgrid-inspirations#readme", 27 | "devDependencies": { 28 | "cpx": "^1.5.0", 29 | "eslint": "6.6.*", 30 | "eslint-config-wordpress": "^2.0.0", 31 | "eslint-plugin-html": "^6.0.0", 32 | "prettier-eslint": "^9.0.1", 33 | "prettier-eslint-cli": "^5.0.0" 34 | }, 35 | "dependencies": { 36 | "font-awesome": "4.7", 37 | "jquery-toggles": "^4.0.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /pages/attribution.php: -------------------------------------------------------------------------------- 1 | ' . esc_html__( 'This site has been created with the help of many different people and companies.', 'boldgrid-inspirations' ) . '

'; 6 | $attribution_image_heading = '

' . esc_html__( 'In particular, a special thanks goes to the following for content running on this site:', 'boldgrid-inspirations' ) . '

'; 7 | 8 | // Create attribution for the web host reseller. 9 | $reseller = get_option( 'boldgrid_reseller' ); 10 | 11 | if ( false !== $reseller && ! empty( $reseller['reseller_title'] ) ) { 12 | if ( ! empty( $reseller['reseller_website_url'] ) ) { 13 | $reseller_link = '' . esc_html( $reseller['reseller_title'] ) . '.'; 14 | } else { 15 | $reseller_link = $reseller['reseller_title'] . '.'; 16 | } 17 | // translators: 1 a link to the resller. 18 | $reseller_attribution = ' ' . sprintf( __( 'Web hosting support is provided by %1$s', 'boldgrid-inspirations' ), $reseller_link ); 19 | } else { 20 | $reseller_attribution = ''; 21 | } 22 | 23 | // This var used by includes/class-boldgrid-inspirations-attribution.php. 24 | $attribution_wordpress_and_inspirations = 25 | '

%s ' . 26 | sprintf( 27 | wp_kses( 28 | // translators: 1 a link to boldgrid.com, 2 a link to wordpress.org. 29 | __( 'site was built on a powerful, Inspirations based web builder called %1$s. It is running on %2$s, the most popular content management software online today.', 'boldgrid-inspirations' ), 30 | array( 'a' => array( 'href' => array() ), 'target' => array(), ) 31 | ), 32 | 'BoldGrid', 33 | 'WordPress' 34 | ) . 35 | $reseller_attribution . 36 | '

'; 37 | 38 | /* 39 | * Create attribution for plugins we install from 3rd Party sources. 40 | * 41 | * This var used by includes/class-boldgrid-inspirations-attribution.php 42 | */ 43 | $attribution_additional_plugins = ''; 44 | if ( function_exists( 'is_plugin_active' ) ) { 45 | // Check if some plugins are active. 46 | $is_boldgrid_ninja_forms_active = ( bool ) is_plugin_active( 'boldgrid-ninja-forms/ninja-forms.php' ); 47 | $is_boldgrid_gallery_active = ( bool ) is_plugin_active( 'boldgrid-gallery/wc-gallery.php' ); 48 | 49 | if ( $is_boldgrid_ninja_forms_active || $is_boldgrid_gallery_active ) { 50 | $attribution_additional_plugins .= ' 51 |
52 |

' . esc_html__( 'Additional functionality provided by', 'boldgrid-inspirations' ) . ':

53 |
    '; 54 | if ( $is_boldgrid_ninja_forms_active ) { 55 | $attribution_additional_plugins .= '
  • Ninja Forms
  • '; 56 | } 57 | if ( $is_boldgrid_gallery_active ) { 58 | $attribution_additional_plugins .= '
  • WP Canvas - Gallery
  • '; 59 | } 60 | $attribution_additional_plugins .= ' 61 |
62 |
63 | '; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /pages/cart/checking-out.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 26 | 27 |
28 | 29 |

30 | 31 |
32 | 33 |

34 | : 35 | 36 | () 37 |

38 | 39 | 43 | 44 |
45 | 46 |
47 | 48 | 74 | 75 |
76 | 77 | -------------------------------------------------------------------------------- /pages/deploy.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 24 | 25 | 60 | 61 |
62 | 63 | 67 | 68 |
69 | 70 |
71 |

72 |
73 | 74 | get_configs() ); 81 | $new_deploy->do_deploy(); 82 | -------------------------------------------------------------------------------- /pages/image_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
12 |
13 |
14 |
15 |
16 | :
17 | 18 |
19 |
20 |
21 | 29 |
30 |
31 |
    32 | 33 | has_been_dismissed( 'bgcs_license_info' ) ) { 39 | ?> 40 |
    41 |
      42 |
    • 43 |

      44 | 45 | 46 |

      47 |
    • 48 |
    • 49 |

      50 | 51 | Creative Commons, but it is not a guarantee it is legally Creative Commons. Those images may be subject to other copyrights. You, as the website owner, are responsible for content on your site.', 'boldgrid-inspirations' ), 56 | array( 'a' => array( 'href' => array(), 'target' => array() ) ) 57 | ), 58 | 'https://creativecommons.org/about/' 59 | ); 60 | ?> 61 |

      62 |
    • 63 |
    64 |
    65 |

    66 | 67 |

    68 |
    69 | 72 | 73 | 74 |
75 |
76 |
77 |
78 | -------------------------------------------------------------------------------- /pages/includes/boldgrid-inspirations/menu.php: -------------------------------------------------------------------------------- 1 | 'welcome' === $active_menu_item ? 'active' : 'disabled', 24 | 'data-step' => 'welcome', 25 | 'disabled' => false, 26 | 'title' => esc_html__( 'Welcome', 'boldgrid-inspirations' ), 27 | ), 28 | array( 29 | 'class' => 'design' === $active_menu_item ? 'active' : 'disabled', 30 | 'data-step' => 'design', 31 | 'disabled' => 'design' !== $active_menu_item, 32 | 'title' => esc_html__( 'Design', 'boldgrid-inspirations' ), 33 | ), 34 | array( 35 | 'class' => 'disabled', 36 | 'data-step' => 'content', 37 | 'disabled' => true, 38 | 'title' => esc_html__( 'Content', 'boldgrid-inspirations' ), 39 | ), 40 | array( 41 | 'class' => 'disabled', 42 | 'data-step' => 'contact', 43 | 'disabled' => true, 44 | 'title' => esc_html__( 'Essentials', 'boldgrid-inspirations' ), 45 | ), 46 | array( 47 | 'class' => 'install' === $active_menu_item ? 'active' : 'disabled', 48 | 'data-step' => 'install', 49 | 'disabled' => 'install' === $active_menu_item ? false : true, 50 | 'title' => esc_html__( 'Finish', 'boldgrid-inspirations' ), 51 | ), 52 | ); 53 | 54 | ?> 55 | 56 |
57 | 60 | 61 |
62 | ' . esc_html( $step['title'] ) . ''; 78 | 79 | $last_class = $step['class']; 80 | } 81 | ?> 82 |
83 |
-------------------------------------------------------------------------------- /pages/includes/boldgrid-settings/start_over.php: -------------------------------------------------------------------------------- 1 |

2 | 3 | user_has_built_a_boldgrid_site() || true == $show_start_over ) { 9 | ?> 10 | 11 |

12 | 13 |
14 | 15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 |

23 | 24 | array() ) 29 | ), 30 | '', 31 | '' 32 | ); ?> 33 | 34 |

35 | 36 | 37 | 38 | 39 | 50 |

51 | 52 | staging_installed ) { 70 | ?> 71 |
72 |
73 |

74 | 77 | 79 | 82 | 83 |
84 |


85 | 86 | 87 |
88 |
89 |
90 | 91 | 'start_over_button' 96 | ) ); 97 | ?> 98 |
99 | 100 | 101 | 102 |

103 | BoldGrid Inspirations', esc_url( add_query_arg( 'page', 'boldgrid-inspirations', admin_url( 'admin.php' ) ) ) ); 105 | // translators: 1 The url to access BoldGrid Inspirations in your WordPress dashboard. 106 | printf( __( 'You do not have a BoldGrid site to delete! You can build a new website using %1$s.', 'boldgrid-inspirations' ), $link ); 107 | ?> 108 |

109 | 112 | 113 |
114 | -------------------------------------------------------------------------------- /pages/includes/browse_category.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 | 12 |
13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /pages/includes/cart_header.php: -------------------------------------------------------------------------------- 1 | get_coin_balance(); 16 | 17 | // configure the active tab 18 | $checkout_active = ( 'boldgrid-cart' == $_GET['page'] ? 'nav-tab-active' : '' ); 19 | 20 | $transactions_active = ( 'boldgrid-transactions' == $_GET['page'] ? 'nav-tab-active' : '' ); 21 | 22 | $purchase_coins_active = ( 'boldgrid-purchase-coins' == $_GET['page'] ? 'nav-tab-active' : '' ); 23 | ?> 24 | 25 | 26 |
27 | : 28 |
29 | 30 | 31 |
32 | 41 |
42 | -------------------------------------------------------------------------------- /pages/includes/post_submitbox_misc_actions_auto_add_to_menu.php: -------------------------------------------------------------------------------- 1 | 11 |
12 | : 13 | 14 | 15 | 16 |
17 | 18 |

19 | 20 | 21 |

22 |
23 | 24 |
25 | -------------------------------------------------------------------------------- /pages/my-inspiration.php: -------------------------------------------------------------------------------- 1 | 19 | 20 |
21 | 22 |

23 | 24 | 25 |
26 |

27 | ✓ 28 |

29 |
30 | 31 | 32 |
33 | 34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 | screen_id, 'container1', null ); ?> 42 | 43 |
44 | screen_id, 'container2', null ); ?> 45 |
46 | 47 |
48 | screen_id, 'container3', null ); ?> 49 |
50 | 51 |
52 | 53 |
54 | 55 |
56 | screen_id, 'container4', null ); ?> 57 |
58 | 59 |
60 | 61 |
62 | screen_id, 'container6', null ); ?> 63 |
64 | 65 |
66 | screen_id, 'container5' ,null ); ?> 67 |
68 | 69 |
70 | 71 |
72 | 73 |
74 | 75 |
76 | -------------------------------------------------------------------------------- /pages/purchase_coins.php: -------------------------------------------------------------------------------- 1 | BoldGrid Central.', 'boldgrid-inspirations' ), 12 | array( 'a' => array( 'href' => array(), 'target' => array() ) ) 13 | ), 14 | esc_url( $reseller->centralUrl ) 15 | ); 16 | if ( $reseller->hasCoinUrl() && isset( $reseller->data['reseller_title'] ) ) { 17 | $reseller_link = sprintf( 18 | wp_kses( 19 | // translators: 1 URL to reseller's page where user can purchase additional BoldGrid Connect Coins, 2 the name of the reseller. 20 | __( 'You can purchase additional coins through your official BoldGrid reseller, %2$s.', 'boldgrid-inspirations' ), 21 | array( 'a' => array( 'href' => array(), 'target' => array() ) ) 22 | ), 23 | $reseller->data['reseller_coin_url'], 24 | $reseller->data['reseller_title'] 25 | ); 26 | } 27 | 28 | ?> 29 | 30 |
31 | 32 | 36 | 37 |
38 | 39 |
40 |

44 |
45 | 46 |
47 | 48 |
-------------------------------------------------------------------------------- /pages/templates/boldgrid-connection-issue.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | ?> 14 |
15 |

16 | 17 |

18 |

19 | 25 |

26 |

27 | ', 35 | '' 36 | ); 37 | ?> 38 |

39 |
40 | -------------------------------------------------------------------------------- /pages/templates/boldgrid-inspirations.php: -------------------------------------------------------------------------------- 1 | 19 | 20 | 69 | 70 | 83 | 84 | -------------------------------------------------------------------------------- /pages/templates/image_search_results.php: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /pages/templates/restrict-direct-access.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | // Prevent direct calls. 14 | if ( ! defined( 'WPINC' ) ) { 15 | header( 'Status: 403 Forbidden' ); 16 | header( 'HTTP/1.1 403 Forbidden' ); 17 | exit(); 18 | } 19 | -------------------------------------------------------------------------------- /pages/templates/settings-saved.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | ?> 14 |
15 |

16 | 22 |

23 |
24 | -------------------------------------------------------------------------------- /pages/templates/transaction_history.php: -------------------------------------------------------------------------------- 1 | 34 | 35 | 38 | 39 | 40 | 75 | 76 | 81 | -------------------------------------------------------------------------------- /pages/templates/unauthorized-request.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | 13 | ?> 14 |
15 |

16 | 22 |

23 |
24 | -------------------------------------------------------------------------------- /pages/templates/widget_customization.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 23 | -------------------------------------------------------------------------------- /pages/transaction_history.php: -------------------------------------------------------------------------------- 1 | 10 |
11 | 14 |

15 |
16 |
17 |
18 | 19 |
20 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | ./tests/ 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | 11 | /** 12 | * BoldGrid Plugin Test class. 13 | */ 14 | class Test_Boldgrid_Inspiration extends WP_UnitTestCase { 15 | /** 16 | * Class property $testClass. 17 | */ 18 | protected $testClass; 19 | 20 | /** 21 | * Class property $settings. 22 | */ 23 | protected $settings = array ( 24 | 'configDir' => 'includes/config' 25 | ); 26 | 27 | /** 28 | * Setup. 29 | */ 30 | public function set_up() { 31 | // include('includes/class-boldgrid-inspirations.php'); 32 | $this->testClass = new Boldgrid_Inspirations( $this->settings ); 33 | } 34 | 35 | /** 36 | * Test set get configs. 37 | */ 38 | public function testSetGetConfigs() { 39 | $configs = $this->testClass->get_configs(); 40 | $this->assertNotEmpty( $configs ); 41 | $this->testClass->set_configs( 'foo' ); 42 | $this->assertSame( 'foo', $this->testClass->get_configs() ); 43 | } 44 | 45 | /** 46 | * Test passes API check. 47 | */ 48 | public function testPassesApiCheck() { 49 | $this->assertTrue( $this->testClass->api->passes_api_check() ); 50 | $this->assertFalse( ( bool ) $this->testClass->api->passes_api_check( true ) ); 51 | } 52 | 53 | /** 54 | * Test Hash success without dashes. 55 | */ 56 | public function test_hash_api_key_success_no_dashes() { 57 | 58 | $result = Boldgrid_Inspirations_Api::hash_api_key( "hghghhhhhhhhhhhhhhhhhhhhhhhhhhhh" ); 59 | $this->assertEquals( "fd66458e615abecd3ec47d3b355af162", $result ); 60 | 61 | } 62 | 63 | /** 64 | * Test Hash success with dashes. 65 | */ 66 | public function test_hash_api_key_success_with_dashes() { 67 | 68 | $result = Boldgrid_Inspirations_Api::hash_api_key( "hghgh-hhhhhhh-hhhhh-hhhhh-hhhhhhhhhh" ); 69 | $this->assertEquals( "fd66458e615abecd3ec47d3b355af162", $result ); 70 | 71 | } 72 | 73 | /** 74 | * Test Hash failure with to short. 75 | */ 76 | public function test_hash_api_key_failure_too_short() { 77 | 78 | $result = Boldgrid_Inspirations_Api::hash_api_key( "hghgh" ); 79 | $this->assertEquals( null, $result ); 80 | 81 | } 82 | 83 | /** 84 | * Test Hash failure with too long. 85 | */ 86 | public function test_hash_api_key_failure_too_long() { 87 | 88 | $result = Boldgrid_Inspirations_Api::hash_api_key( 89 | "hghghhhhhhhhhhhhhhhhhhhhhhhhhhhhhghghhhhhhhhhhhhhhhhhhhhhhhhhhhh" ); 90 | $this->assertEquals( null, $result ); 91 | 92 | } 93 | 94 | /** 95 | * Test Hash failure with too short, 31 characters + 1 dash. 96 | */ 97 | public function test_hash_api_key_failure_too_short_with_dash() { 98 | 99 | $result = Boldgrid_Inspirations_Api::hash_api_key( 100 | "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj-" ); 101 | $this->assertEquals( null, $result ); 102 | 103 | } 104 | 105 | /** 106 | * Test Hash failure with empty string passed. 107 | */ 108 | public function test_hash_api_key_failure_empty_string() { 109 | 110 | $result = Boldgrid_Inspirations_Api::hash_api_key( '' ); 111 | $this->assertEquals( null, $result ); 112 | 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 |