| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| # WP Maintenance Mode # | ||
| **Contributors:** [themeisle](https://profiles.wordpress.org/themeisle/) | ||
| **Plugin Name:** WP Maintenance Mode | ||
| **Plugin URI:** https://themeisle.com/ | ||
| **Author:** Themeisle | ||
| **Author URI:** https://themeisle.com/ | ||
| **Tags:** maintenance mode, admin, administration, unavailable, coming soon, multisite, landing page, under construction, contact form, subscribe, countdown | ||
| **Requires at least:** 3.5 | ||
| **Tested up to:** 5.9 | ||
| **Stable tag:** trunk | ||
| **Requires PHP:** 5.6 | ||
| **License:** GPL-2.0+ | ||
|
|
||
| Adds a splash page to your site that lets visitors know your site is down for maintenance. It's perfect for a coming soon page. The new Bot functionality is here! | ||
|
|
||
| ## Description ## | ||
|
|
||
| Add a maintenance page to your blog that lets visitors know your blog is down for maintenance, or add a coming soon page for a new website. User with admin rights gets full access to the blog including the front end. | ||
|
|
||
| Activate the plugin and your blog is in maintenance-mode, works and only registered users with enough rights can see the front end. You can use a date with a countdown timer for visitor information or set a value and unit for information. | ||
|
|
||
| Also works with WordPress Multisite installs (each blog from the network has its own maintenance settings). | ||
|
|
||
| ### Features ### | ||
|
|
||
| * Fully customizable (change colors, texts and backgrounds); | ||
| * Subscription form (export emails to .csv file); | ||
| * Countdown timer (remaining time); | ||
| * Contact form (receive emails from visitors); | ||
| * Coming soon page; | ||
| * Landing page templates; | ||
| * WordPress multisite; | ||
| * Responsive design; | ||
| * Social media icons; | ||
| * Works with any WordPress theme; | ||
| * SEO options; | ||
| * Exclude URLs from maintenance; | ||
| * Bot functionality to collect the emails in a friendly and efficient way; | ||
| * GDPR Ready; | ||
|
|
||
| ### Bugs, technical hints or contribute ### | ||
|
|
||
| Please give us feedback, contribute and file technical bugs on [GitHub Repo](https://github.com/andrianvaleanu/WP-Maintenance-Mode). | ||
|
|
||
| ### Credits ### | ||
|
|
||
| Developed by [Themeisle](https://themeisle.com) | ||
|
|
||
| ## Installation ## | ||
|
|
||
| 1. Unpack the download package | ||
| 2. Upload all files to the `/wp-content/plugins/` directory, include folders | ||
| 3. Activate the plugin through the 'Plugins' menu in WordPress | ||
| 4. Go to `Settings` page, where you can change what settings you need (pay attention to **Exclude** option!) | ||
|
|
||
| ## Screenshots ## | ||
|
|
||
| 1. Maintenance Mode Example | ||
| 2. Maintenance Mode Example #2 | ||
| 3. Bot Example | ||
| 4. Dashboard General Settings | ||
| 5. Dashboard Design Settings | ||
| 6. Dashboard Modules Settings | ||
| 7. Dashboard Bot Settings | ||
| 8. Contact Form | ||
|
|
||
| ## Frequently Asked Questions ## | ||
|
|
||
| ### How to use plugin filters ### | ||
| Check out our [Snippet Library](https://github.com/codeinwp/Snippet-Library/). | ||
|
|
||
| ### Cache Plugin Support ### | ||
| WP Maintenance Mode can be unstable due to the cache plugins; we recommend deactivating any cache plugin when maintenance mode is active. If you **really** want to use a cache plugin, make sure you delete the entire cache after each change. | ||
|
|
||
| ### Exclude list ### | ||
| If you change your login url, please add the new slug (url: http://domain.com/newlogin, then you should add: newlogin) to Exclude list from plugin settings -> General Tab. | ||
|
|
||
| Notice: `wp-cron.php` is excluded by default. | ||
|
|
||
| ## Changelog ## | ||
|
|
||
| ##### [Version 2.4.3](https://github.com/Codeinwp/wp-maintenance-mode/compare/v2.4.2...v2.4.3) (2022-01-27) | ||
|
|
||
| - Change ownership to Themeisle | ||
|
|
||
|
|
||
|
|
||
|
|
||
| ### 2.4.2 (18/01/2022) ### | ||
| * Misc: 900 000 Active Installs Celebrations! | ||
| * Misc: WordPress 5.9 compatibility | ||
| * Fix: jQuery UI CSS theme reference from jQuery CDN | ||
| * Misc: Text fixes in the dashboard | ||
|
|
||
| ### 2.4.1 (20/07/2021) ### | ||
| * Misc: WordPress 5.8 compatibility | ||
|
|
||
| ### 2.4.0 (13/05/2021) ### | ||
| * Design: add "Custom CSS" setting; Finally! :) | ||
| * Design: add "Footer links" color setting | ||
| * Design: add a list of available shortcodes under the "Text" editor | ||
| * Bot: make {visitor_name} placeholder work in all messages after the visitor types his name | ||
| * Misc: add [embed] shortcode for responsive video embeds; Compatible with YouTube, Vimeo, DailyMotion. | ||
| * Misc: make the exclude mechanism work with Cyrillic characters | ||
| * Misc: add `wpmm_maintenance_template` filter; It works the same way as the `wpmm_contact_template` filter, but for the maintenance template. | ||
| * Misc: now you can override the `contact` email template too; Check `/views/contact.php` for more details. | ||
| * Misc: better compatibility with translation plugins like Loco Translate | ||
| * Misc: the image uploaders (from the dashboard) are now translatable | ||
| * Misc: improve uninstall routine | ||
| * Misc: add `wpmm_delete_cache` action; It is called after each setting change. | ||
| * Misc: add support for cache plugins like WP Rocket, WP Fastest Cache, Endurance Page Cache, Swift Performance Lite, Cache Enabler, SG Optimizer, LiteSpeed Cache, Nginx Helper; | ||
| * Misc: remove `wpmm_count_where` helper function | ||
| * Misc: code improvements | ||
|
|
||
| ### 2.3.0 (07/12/2020) ### | ||
| * Modules: add support for Google Analytics 4 measurement ID | ||
| * Design: enable media buttons on wp_editor (now you can add images from the editor) | ||
| * Bot: fix translation issue | ||
| * Misc: add filters for capabilities `wpmm_settings_capability`, `wpmm_subscribers_capability`, and `wpmm_all_actions_capability` (the last one can be used to override all capabilities) | ||
| * Misc: fix [loginform] shortcode redirect attribute | ||
| * Misc: a few CSS & Javascript improvements | ||
| * Misc: bump "Tested up to" version to 5.6 | ||
|
|
||
| ### 2.2.4 (20/05/2019) ### | ||
| * bump "Tested up to" to 5.2.0 | ||
| * fix typo in Italian translation (it_IT) | ||
| * Bot: add a note about how you can export the list of subscribers [#195](https://github.com/andrianvaleanu/WP-Maintenance-Mode/issues/195) | ||
| * Bot: add client-side sanitization to the input fields [#176](https://github.com/andrianvaleanu/WP-Maintenance-Mode/issues/176) | ||
|
|
||
| ### 2.2.3 (20/02/2019) ### | ||
| * bump "Tested up to" version to 5.1.0 | ||
| * replace "wpmu_new_blog" action with "wp_initialize_site" action for WP 5.1.0 users because the first one is deprecated in the new version | ||
| * small improvement to "check_exclude" method from "WP_Maintenance_Mode" class | ||
|
|
||
| ### 2.2.2 (27/11/2018) ### | ||
| * Google Analytics module: migrate from analytics.js to gtag.js + add ip anonymization [#178](https://github.com/andrianvaleanu/WP-Maintenance-Mode/issues/178) | ||
| * GDPR module: accept links inside texareas + add policy link target [#188](https://github.com/andrianvaleanu/WP-Maintenance-Mode/issues/188) | ||
| * add charset meta tag [#200](https://github.com/andrianvaleanu/WP-Maintenance-Mode/issues/200) | ||
| * fix PHP Notice: Undefined index: HTTP_USER_AGENT | ||
| * add plural and single form translation for subscribers number (settings page) | ||
|
|
||
| ### Earlier versions ### | ||
| For the changelog of earlier versions, please refer to the [full changelog](http://plugins.svn.wordpress.org/wp-maintenance-mode/trunk/changelog.txt). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| BUILD_VERSION=$(node -pe "require('./package.json').version") | ||
| export BUILD_VERSION | ||
| BUILD_NAME=$(node -pe "require('./package.json').name") | ||
| export BUILD_NAME | ||
|
|
||
| if [ ! -d "dist" ]; then | ||
| mkdir "dist" | ||
| fi | ||
|
|
||
| if [ ! -d "artifact" ]; then | ||
| mkdir "artifact" | ||
| fi | ||
|
|
||
| rsync -rc --exclude-from ".distignore" "./" "dist/$BUILD_NAME" | ||
|
|
||
| cd dist | ||
| zip -r "../artifact/$BUILD_NAME" "./$BUILD_NAME/" | ||
| cd - |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| if [ $# -lt 3 ]; then | ||
| echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| DB_NAME=$1 | ||
| DB_USER=$2 | ||
| DB_PASS=$3 | ||
| DB_HOST=${4-localhost} | ||
| WP_VERSION=${5-latest} | ||
| SKIP_DB_CREATE=${6-false} | ||
|
|
||
| TMPDIR=${TMPDIR-/tmp} | ||
| TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") | ||
| WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} | ||
| WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} | ||
|
|
||
| download() { | ||
| if [ `which curl` ]; then | ||
| curl -s "$1" > "$2"; | ||
| elif [ `which wget` ]; then | ||
| wget -nv -O "$2" "$1" | ||
| fi | ||
| } | ||
|
|
||
| if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then | ||
| WP_TESTS_TAG="branches/$WP_VERSION" | ||
| elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
| if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then | ||
| # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x | ||
| WP_TESTS_TAG="tags/${WP_VERSION%??}" | ||
| else | ||
| WP_TESTS_TAG="tags/$WP_VERSION" | ||
| fi | ||
| elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then | ||
| WP_TESTS_TAG="trunk" | ||
| else | ||
| # http serves a single offer, whereas https serves multiple. we only want one | ||
| download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json | ||
| grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json | ||
| LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') | ||
| if [[ -z "$LATEST_VERSION" ]]; then | ||
| echo "Latest WordPress version could not be found" | ||
| exit 1 | ||
| fi | ||
| WP_TESTS_TAG="tags/$LATEST_VERSION" | ||
| fi | ||
|
|
||
| set -ex | ||
|
|
||
| install_wp() { | ||
|
|
||
| if [ -d $WP_CORE_DIR ]; then | ||
| return; | ||
| fi | ||
|
|
||
| mkdir -p $WP_CORE_DIR | ||
|
|
||
| if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then | ||
| mkdir -p $TMPDIR/wordpress-nightly | ||
| download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip | ||
| unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ | ||
| mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR | ||
| else | ||
| if [ $WP_VERSION == 'latest' ]; then | ||
| local ARCHIVE_NAME='latest' | ||
| elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then | ||
| # https serves multiple offers, whereas http serves single. | ||
| download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json | ||
| if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then | ||
| # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x | ||
| LATEST_VERSION=${WP_VERSION%??} | ||
| else | ||
| # otherwise, scan the releases and get the most up to date minor version of the major release | ||
| local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` | ||
| LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) | ||
| fi | ||
| if [[ -z "$LATEST_VERSION" ]]; then | ||
| local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
| else | ||
| local ARCHIVE_NAME="wordpress-$LATEST_VERSION" | ||
| fi | ||
| else | ||
| local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
| fi | ||
| download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz | ||
| tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR | ||
| fi | ||
|
|
||
| download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php | ||
| } | ||
|
|
||
| install_test_suite() { | ||
| # portable in-place argument for both GNU sed and Mac OSX sed | ||
| if [[ $(uname -s) == 'Darwin' ]]; then | ||
| local ioption='-i.bak' | ||
| else | ||
| local ioption='-i' | ||
| fi | ||
|
|
||
| # set up testing suite if it doesn't yet exist | ||
| if [ ! -d $WP_TESTS_DIR ]; then | ||
| # set up testing suite | ||
| mkdir -p $WP_TESTS_DIR | ||
| svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes | ||
| svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data | ||
| fi | ||
|
|
||
| if [ ! -f wp-tests-config.php ]; then | ||
| download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php | ||
| # remove all forward slashes in the end | ||
| WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") | ||
| sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php | ||
| sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
| sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
| sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
| sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php | ||
| fi | ||
|
|
||
| } | ||
|
|
||
| install_db() { | ||
|
|
||
| if [ ${SKIP_DB_CREATE} = "true" ]; then | ||
| return 0 | ||
| fi | ||
|
|
||
| # parse DB_HOST for port or socket references | ||
| local PARTS=(${DB_HOST//\:/ }) | ||
| local DB_HOSTNAME=${PARTS[0]}; | ||
| local DB_SOCK_OR_PORT=${PARTS[1]}; | ||
| local EXTRA="" | ||
|
|
||
| if ! [ -z $DB_HOSTNAME ] ; then | ||
| if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then | ||
| EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" | ||
| elif ! [ -z $DB_SOCK_OR_PORT ] ; then | ||
| EXTRA=" --socket=$DB_SOCK_OR_PORT" | ||
| elif ! [ -z $DB_HOSTNAME ] ; then | ||
| EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" | ||
| fi | ||
| fi | ||
|
|
||
| # create database | ||
| mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA | ||
| } | ||
|
|
||
| install_wp | ||
| install_test_suite | ||
| install_db |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,53 @@ | ||
| { | ||
| "name": "codeinwp/wp-maintenance-mode", | ||
| "description": "Adds a splash page to your site that lets visitors know your site is down for maintenance. Full access to the back- & front-end is optional.", | ||
| "type": "wordpress-plugin", | ||
| "version": "2.4.3", | ||
| "license": "GPL-2.0+", | ||
| "homepage": "https://themeisle.com", | ||
| "support": { | ||
| "source": "https://github.com/codeinwp/WP-Maintenance-Mode", | ||
| "forum": "https://wordpress.org/support/plugin/wp-maintenance-mode/", | ||
| "issues": "https://github.com/codeinwp/WP-Maintenance-Mode/issues" | ||
| }, | ||
| "authors": [ | ||
| { | ||
| "name": "Themeisle", | ||
| "homepage": "https://themeisle.com/" | ||
| } | ||
| ], | ||
| "require": { | ||
| "codeinwp/themeisle-sdk": "^3.2" | ||
| }, | ||
| "require-dev": { | ||
| "codeinwp/phpcs-ruleset": "dev-main", | ||
| "squizlabs/php_codesniffer": "^3.5", | ||
| "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", | ||
| "phpcompatibility/php-compatibility": "^9.3", | ||
| "phpcompatibility/phpcompatibility-wp": "^2.1", | ||
| "wp-coding-standards/wpcs": "*" | ||
| }, | ||
| "autoload": { | ||
| "files": [ | ||
| "vendor/codeinwp/themeisle-sdk/load.php" | ||
| ] | ||
| }, | ||
| "config": { | ||
| "optimize-autoloader": true, | ||
| "platform": { | ||
| "php": "5.6" | ||
| } | ||
| }, | ||
| "keywords": [ | ||
| "maintenance", | ||
| "WordPress", | ||
| "plugin" | ||
| ], | ||
| "scripts": { | ||
| "format": "./vendor/bin/phpcbf --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ", | ||
| "format-fix-exit": "./vendor/bin/phpcbf-fix-exit-0 --standard=phpcs.xml --report-summary --report-source -s --runtime-set testVersion 7.0- ", | ||
| "phpcs": "phpcs --standard=phpcs.xml -s --runtime-set testVersion 7.0-", | ||
| "lint": "composer run-script phpcs", | ||
| "phpcs-i": "phpcs -i" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,34 @@ | ||
| { | ||
| "name": "wp-maintenance-mode", | ||
| "version": "2.4.3", | ||
| "author": "Themeisle", | ||
| "homepage": "https://themeisle.com/", | ||
| "license": "GPL-3.0+", | ||
| "bugs": { | ||
| "url": "https://github.com/codeinwp/WP-Maintenance-Mode/issues" | ||
| }, | ||
| "scripts": { | ||
| "build": "grunt", | ||
| "dist": "bash ./bin/dist.sh", | ||
| "release": "npx semantic-release" | ||
| }, | ||
| "main": "Gruntfile.js", | ||
| "devDependencies": { | ||
| "@semantic-release/changelog": "^5.0.1", | ||
| "@semantic-release/exec": "^5.0.0", | ||
| "@semantic-release/git": "^9.0.0", | ||
| "autoprefixer": "^9.8.6", | ||
| "conventional-changelog-simple-preset": "^1.0.14", | ||
| "cssnano": "^4.1.11", | ||
| "grunt": "^1.4.0", | ||
| "grunt-contrib-jshint": "^2.1.0", | ||
| "grunt-contrib-uglify-es": "git://github.com/gruntjs/grunt-contrib-uglify.git#harmony", | ||
| "grunt-contrib-watch": "^1.1.0", | ||
| "grunt-postcss": "^0.9.0", | ||
| "grunt-version": "^3.0.0", | ||
| "grunt-wp-readme-to-markdown": "^2.1.0", | ||
| "replace-in-file": "^6.1.0", | ||
| "semantic-release": "^17.3.7", | ||
| "time-grunt": "^2.0.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <?xml version="1.0"?> | ||
| <ruleset name="Themeisle"> | ||
| <description>Themeisle rules for PHP_CodeSnifferr</description> | ||
|
|
||
| <file>./</file> | ||
|
|
||
| <arg value="ps"/> | ||
| <arg name="extensions" value="php"/> | ||
|
|
||
| <exclude-pattern type="relative">vendor</exclude-pattern> | ||
| <exclude-pattern type="relative">node_modules</exclude-pattern> | ||
| <exclude-pattern type="relative">**/build</exclude-pattern> | ||
| <exclude-pattern type="relative">tests</exclude-pattern> | ||
|
|
||
| <rule ref="WordPress-Core"> | ||
| <exclude name="WordPress.PHP.YodaConditions.NotYoda"/> | ||
| <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/> | ||
| <exclude name="WordPress.DB.PreparedSQL.NotPrepared"/> | ||
| <exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar"/> | ||
| <exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores"/> | ||
| <exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/> | ||
| <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/> | ||
| <exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"/> | ||
| <exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/> | ||
| <exclude name="Squiz.Commenting.FunctionComment.MissingParamName"/> | ||
| <exclude name="Squiz.Commenting.VariableComment.EmptyVar"/> | ||
| <exclude name="Generic.Commenting.DocComment.MissingShort"/> | ||
| <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/> | ||
| <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/> | ||
| <exclude name="WordPress.Files.FileName.InvalidClassFileName"/> | ||
| <exclude name="WordPress.PHP.StrictComparisons.LooseComparison"/> | ||
| <exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict"/> | ||
| <exclude name="WordPress.PHP.RestrictedPHPFunctions.date_date"/> | ||
| <exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/> | ||
| <exclude name="Generic.Files.LineEndings.InvalidEOLChar"/> | ||
| <exclude name="WordPress.DateTime.RestrictedFunctions.date_date"/> | ||
| </rule> | ||
|
|
||
| <rule ref="WordPress.WP.I18n"> | ||
| <properties> | ||
| <property name="text_domain" type="array"> | ||
| <element value="wp-maintenance-mode"/> | ||
| <element value="default"/> | ||
| </property> | ||
| </properties> | ||
| </rule> | ||
| <arg value="sp"/> | ||
| <arg name="basepath" value="./" /> | ||
| <arg name="parallel" value="20"/> | ||
| </ruleset> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <phpunit | ||
| bootstrap="tests/bootstrap.php" | ||
| backupGlobals="false" | ||
| colors="true" | ||
| convertErrorsToExceptions="true" | ||
| convertNoticesToExceptions="true" | ||
| convertWarningsToExceptions="true" | ||
| > | ||
| <php> | ||
| <const name="FS_METHOD" value="direct"/> | ||
| </php> | ||
| <testsuites> | ||
| <testsuite name="default"> | ||
| <directory phpVersion="5.4.0" phpVersionOperator=">=" suffix="-test.php">./tests/</directory> | ||
| <exclude>./tests/old/</exclude> | ||
| </testsuite> | ||
| </testsuites> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?php | ||
| /** | ||
| * PHPUnit bootstrap file | ||
| * | ||
| * @package Sample_Theme | ||
| */ | ||
|
|
||
| $_tests_dir = getenv( 'WP_TESTS_DIR' ); | ||
|
|
||
| error_log( var_export ( $_tests_dir, true) ); | ||
|
|
||
| if ( ! $_tests_dir ) { | ||
| $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; | ||
| } | ||
|
|
||
| if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { | ||
| echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; | ||
| exit( 1 ); | ||
| } | ||
|
|
||
| // Give access to tests_add_filter() function. | ||
| require_once $_tests_dir . '/includes/functions.php'; | ||
|
|
||
| /** | ||
| * Registers theme | ||
| */ | ||
| function _register_module() { | ||
| require_once dirname( dirname( __FILE__ ) ) . '/wp-maintenance-mode.php'; | ||
| } | ||
|
|
||
| tests_add_filter( 'muplugins_loaded', '_register_module' ); | ||
|
|
||
| // Start up the WP testing environment. | ||
| require $_tests_dir . '/includes/bootstrap.php'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
| /** | ||
| * Generic test. | ||
| */ | ||
|
|
||
| /** | ||
| * Test_Generic. | ||
| */ | ||
| class Test_Generic extends WP_UnitTestCase { | ||
| public function test_constants() { | ||
| $this->assertTrue( defined('WPMM_PATH') ); | ||
| $this->assertTrue( defined('WPMM_CLASSES_PATH') ); | ||
| $this->assertTrue( defined('WPMM_FUNCTIONS_PATH') ); | ||
| $this->assertTrue( defined('WPMM_LANGUAGES_PATH') ); | ||
| $this->assertTrue( defined('WPMM_VIEWS_PATH') ); | ||
| $this->assertTrue( defined('WPMM_CSS_PATH') ); | ||
| $this->assertTrue( defined('WPMM_URL') ); | ||
| $this->assertTrue( defined('WPMM_JS_URL') ); | ||
| $this->assertTrue( defined('WPMM_CSS_URL') ); | ||
| $this->assertTrue( defined('WPMM_IMAGES_URL') ); | ||
| $this->assertTrue( defined('WPMM_ASSETS_SUFFIX') && WPMM_ASSETS_SUFFIX === '.min' ); | ||
| } | ||
|
|
||
| public function test_wpmm_maybe_define_constant() { | ||
|
|
||
| wpmm_maybe_define_constant( 'SOMECONSTANT', 'exists' ); | ||
| wpmm_maybe_define_constant( 'SOMECONSTANT', 'again' ); | ||
| $this->assertTrue( defined('SOMECONSTANT') && SOMECONSTANT === 'exists' ); | ||
| } | ||
|
|
||
| public function test_class_loading() { | ||
| $this->assertTrue( class_exists('WP_Maintenance_Mode') ); | ||
| } | ||
|
|
||
| public function test_wpmm_get_banners() { | ||
| $banners = wpmm_get_banners(); | ||
| $this->assertNonEmptyMultidimensionalArray( $banners ); | ||
| } | ||
| } |