diff --git a/composer.json b/composer.json index c42156e8..2d5819fe 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "appsero/client": "^1.1" }, "require-dev": { - "wp-coding-standards/wpcs": "dev-master", + "wp-coding-standards/wpcs": "dev-main", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "tareq1988/wp-php-cs-fixer": "dev-master", "phpcompatibility/phpcompatibility-wp": "dev-master", diff --git a/composer.lock b/composer.lock index 2990f053..926ecee8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,24 +4,32 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4f860f207f776e3c01266527a69d109f", + "content-hash": "c785be905a18929bb59bebbb43948440", "packages": [ { "name": "appsero/client", - "version": "v1.2.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/Appsero/client.git", - "reference": "5c3fdc4945c8680bca6fb01eee1ec5dc4f22de87" + "reference": "43289d79f1d55de687f667b17a2834b986cc7b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Appsero/client/zipball/5c3fdc4945c8680bca6fb01eee1ec5dc4f22de87", - "reference": "5c3fdc4945c8680bca6fb01eee1ec5dc4f22de87", + "url": "https://api.github.com/repos/Appsero/client/zipball/43289d79f1d55de687f667b17a2834b986cc7b6e", + "reference": "43289d79f1d55de687f667b17a2834b986cc7b6e", "shasum": "" }, "require": { - "php": ">=5.3" + "php": ">=5.6" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "phpcompatibility/phpcompatibility-wp": "dev-master", + "phpunit/phpunit": "^8.5.31", + "squizlabs/php_codesniffer": "^3.7", + "tareq1988/wp-php-cs-fixer": "dev-master", + "wp-coding-standards/wpcs": "dev-develop" }, "type": "library", "autoload": { @@ -48,9 +56,9 @@ ], "support": { "issues": "https://github.com/Appsero/client/issues", - "source": "https://github.com/Appsero/client/tree/v1.2.0" + "source": "https://github.com/Appsero/client/tree/v1.4.0" }, - "time": "2020-09-10T09:10:28+00:00" + "time": "2024-01-08T11:38:14+00:00" }, { "name": "league/csv", @@ -255,28 +263,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -301,13 +309,29 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2021-02-15T10:24:51+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", @@ -315,12 +339,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "79966df2570451119bb6f44952044964f1c8c91b" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/79966df2570451119bb6f44952044964f1c8c91b", - "reference": "79966df2570451119bb6f44952044964f1c8c91b", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -328,10 +352,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "default-branch": true, @@ -356,26 +380,208 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-03-19T08:19:46+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.12", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-05-20T13:34:27+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.10.2", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -385,11 +591,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -404,34 +610,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-07-21T23:26:44+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -445,9 +675,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -485,7 +712,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -501,20 +728,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -522,9 +749,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -568,7 +792,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -584,20 +808,20 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.9", + "version": "v5.4.42", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "af52239a330fafd192c773795520dc2dd62b5657" + "reference": "0c17c56d8ea052fc33942251c75d0e28936e043d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657", - "reference": "af52239a330fafd192c773795520dc2dd62b5657", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0c17c56d8ea052fc33942251c75d0e28936e043d", + "reference": "0c17c56d8ea052fc33942251c75d0e28936e043d", "shasum": "" }, "require": { @@ -606,12 +830,12 @@ "symfony/polyfill-php80": "^1.16" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<4.4" }, "require-dev": { "ext-iconv": "*", "symfony/console": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", "symfony/process": "^4.4|^5.0|^6.0", "symfony/uid": "^5.1|^6.0", "twig/twig": "^2.13|^3.0.4" @@ -657,7 +881,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.9" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.42" }, "funding": [ { @@ -673,7 +897,7 @@ "type": "tidelift" } ], - "time": "2022-05-21T10:24:18+00:00" + "time": "2024-07-26T12:23:09+00:00" }, { "name": "tareq1988/wp-php-cs-fixer", @@ -681,12 +905,12 @@ "source": { "type": "git", "url": "https://github.com/tareq1988/wp-php-cs-fixer.git", - "reference": "56b9c1dd2b979a4ff7a25afa2e1c6b290a5ae876" + "reference": "465ea717d0894942bbba260051f0df955286e617" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tareq1988/wp-php-cs-fixer/zipball/56b9c1dd2b979a4ff7a25afa2e1c6b290a5ae876", - "reference": "56b9c1dd2b979a4ff7a25afa2e1c6b290a5ae876", + "url": "https://api.github.com/repos/tareq1988/wp-php-cs-fixer/zipball/465ea717d0894942bbba260051f0df955286e617", + "reference": "465ea717d0894942bbba260051f0df955286e617", "shasum": "" }, "default-branch": true, @@ -711,34 +935,42 @@ "issues": "https://github.com/tareq1988/wp-php-cs-fixer/issues", "source": "https://github.com/tareq1988/wp-php-cs-fixer/tree/master" }, - "time": "2020-09-21T09:47:38+00:00" + "time": "2023-06-19T06:26:04+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -755,6 +987,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -762,7 +995,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2024-03-25T16:39:00+00:00" } ], "aliases": [], diff --git a/includes/Admin/Admin.php b/includes/Admin/Admin.php index ff8e3f7f..9287753c 100644 --- a/includes/Admin/Admin.php +++ b/includes/Admin/Admin.php @@ -52,5 +52,4 @@ public function redirect_after_activation() { wp_safe_redirect( admin_url( 'admin.php?page=wemail' ) ); exit; } - } diff --git a/includes/Admin/Elementor/FormAction.php b/includes/Admin/Elementor/FormAction.php index e190a420..69953558 100644 --- a/includes/Admin/Elementor/FormAction.php +++ b/includes/Admin/Elementor/FormAction.php @@ -43,10 +43,10 @@ public function run( $record, $ajax_handler ) { return; } - $data = [ + $data = array( 'source' => 'elementor', 'list_id' => $settings['wemail_list'], - ]; + ); $field_maps = array_column( $settings['wemail_field_maps'], 'form_field_id', 'wemail_field' ); $raw_fields = $record->get( 'fields' ); @@ -76,31 +76,31 @@ public function run( $record, $ajax_handler ) { public function register_settings_section( $widget ) { $widget->start_controls_section( 'section_wemail', - [ + array( 'label' => $this->get_label(), - 'condition' => [ + 'condition' => array( 'submit_actions' => $this->get_name(), - ], - ] + ), + ) ); $widget->add_control( 'wemail_list', - [ + array( 'label' => __( 'weMail List ID', 'wemail' ), 'type' => Controls_Manager::TEXT, - ] + ) ); $repeater = new Repeater(); $repeater->add_control( 'wemail_field', - [ + array( 'label' => __( 'weMail Field', 'wemail' ), 'type' => Controls_Manager::SELECT, 'default' => 'email', - 'options' => [ + 'options' => array( 'address1' => __( 'Address 1', 'wemail' ), 'address2' => __( 'Address 2', 'wemail' ), 'city' => __( 'City', 'wemail' ), @@ -115,28 +115,28 @@ public function register_settings_section( $widget ) { 'state' => __( 'State', 'wemail' ), 'timezone' => __( 'Timezone', 'wemail' ), 'zip' => __( 'Zip', 'wemail' ), - ], + ), 'description' => __( 'Select column of subscriber of weMail', 'wemail' ), - ] + ) ); $repeater->add_control( - 'form_field_id', [ + 'form_field_id', array( 'label' => __( 'Form Field ID', 'wemail' ), 'type' => Controls_Manager::TEXT, 'default' => 'email', 'description' => __( 'Form Fields > {Form Field} > Advanced > ID', 'wemail' ), - ] + ) ); $widget->add_control( 'wemail_field_maps', - [ + array( 'label' => __( 'Map Fields with weMail', 'wemail' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => '{{{ wemail_field.split(\'_\').map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ") }}}', - ] + ) ); $widget->end_controls_section(); diff --git a/includes/Admin/FormPreview.php b/includes/Admin/FormPreview.php index e35143c1..964ecdfb 100644 --- a/includes/Admin/FormPreview.php +++ b/includes/Admin/FormPreview.php @@ -52,7 +52,7 @@ public function render_form_component() {
-
', $form['type'], $this->form_id ); ?> + ', $form['type'], $this->form_id ); ?> diff --git a/includes/Admin/GutenbergBlock.php b/includes/Admin/GutenbergBlock.php index 380a2c9f..f70d9fac 100644 --- a/includes/Admin/GutenbergBlock.php +++ b/includes/Admin/GutenbergBlock.php @@ -6,7 +6,8 @@ use WeDevs\WeMail\Traits\Singleton; class GutenbergBlock { - use Singleton, Hooker; + use Singleton; + use Hooker; public function boot() { $this->add_action( 'init', 'register' ); @@ -16,33 +17,33 @@ public function boot() { public function register() { $block_meta = require_once WEMAIL_PATH . '/assets/js/block/index.asset.php'; - wp_register_style( 'wemail-block-style', WEMAIL_ASSETS . '/css/gutenberg.css', [], WEMAIL_VERSION ); + wp_register_style( 'wemail-block-style', WEMAIL_ASSETS . '/css/gutenberg.css', array(), WEMAIL_VERSION ); wp_register_script( 'wemail-block-script', WEMAIL_ASSETS . '/js/block/index.js', $block_meta['dependencies'], $block_meta['version'] ); register_block_type( 'wemail/forms', - [ + array( 'editor_script' => 'wemail-block-script', 'editor_style' => 'wemail-block-style', - ] + ) ); } public function export_forms() { $forms = wemail()->form->get_forms( - [ - 'type' => [ 'modal', 'inline' ], - 'select' => [ 'id', 'name' ], - ] + array( + 'type' => array( 'modal', 'inline' ), + 'select' => array( 'id', 'name' ), + ) ); wp_localize_script( 'wemail-block-script', 'weMailData', - [ - 'forms' => $forms ? $forms : [], + array( + 'forms' => $forms ? $forms : array(), 'siteUrl' => get_site_url(), - ] + ) ); } } diff --git a/includes/Admin/Menu.php b/includes/Admin/Menu.php index e36efa99..8a1456c2 100644 --- a/includes/Admin/Menu.php +++ b/includes/Admin/Menu.php @@ -46,10 +46,10 @@ public function register_admin_menu() { */ $menu_position = apply_filters( 'wemail_main_menu_position', 56 ); - $wemail = add_menu_page( __( 'weMail', 'wemail' ), __( 'weMail', 'wemail' ), $capability, 'wemail', [ $this, 'admin_view' ], 'data:image/svg+xml;base64,' . base64_encode( '' ), $menu_position ); + $wemail = add_menu_page( __( 'weMail', 'wemail' ), __( 'weMail', 'wemail' ), $capability, 'wemail', array( $this, 'admin_view' ), 'data:image/svg+xml;base64,' . base64_encode( '' ), $menu_position ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited - $submenu['wemail'] = apply_filters( 'wemail_admin_submenu', [], $capability ); + $submenu['wemail'] = apply_filters( 'wemail_admin_submenu', array(), $capability ); $this->add_action( 'admin_print_styles-' . $wemail, 'enqueue_styles' ); $this->add_action( 'admin_print_scripts-' . $wemail, 'enqueue_scripts' ); diff --git a/includes/Admin/Notice.php b/includes/Admin/Notice.php index ea5cc9e5..94c192a5 100644 --- a/includes/Admin/Notice.php +++ b/includes/Admin/Notice.php @@ -21,12 +21,12 @@ public static function instance() { * Boot the notice */ private function boot() { - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); } public function enqueue_assets() { wp_register_style( 'wemail-admin-notice-style', WEMAIL_ASSETS . '/css/notice.css', false, filemtime( WEMAIL_PATH . '/assets/css/notice.css' ) ); - wp_register_script( 'wemail-admin-notice-script', WEMAIL_ASSETS . '/js/admin-notice.js', [ 'jquery' ], filemtime( WEMAIL_PATH . '/assets/js/admin-notice.js' ), true ); + wp_register_script( 'wemail-admin-notice-script', WEMAIL_ASSETS . '/js/admin-notice.js', array( 'jquery' ), filemtime( WEMAIL_PATH . '/assets/js/admin-notice.js' ), true ); wp_enqueue_style( 'wemail-admin-notice-style' ); wp_enqueue_script( 'wemail-admin-notice-script' ); @@ -72,9 +72,8 @@ public function connect_notice() { } } if ( ! get_user_meta( get_current_user_id(), 'wemail_api_key', true ) && (int) get_option( 'wemail_site_connection_notice' ) !== 1 && ! ( isset( $_GET['page'] ) && $_GET['page'] === 'wemail' ) ) { - add_action( 'admin_notices', [ $this, 'connect_notice_html' ] ); + add_action( 'admin_notices', array( $this, 'connect_notice_html' ) ); } } - } diff --git a/includes/Admin/ReviewNotice.php b/includes/Admin/ReviewNotice.php index 773d3bef..4e0ac7a0 100644 --- a/includes/Admin/ReviewNotice.php +++ b/includes/Admin/ReviewNotice.php @@ -17,12 +17,12 @@ class ReviewNotice { * Boot the notice */ private function boot() { - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); } public function enqueue_assets() { wp_enqueue_style( 'wemail-review-notice-style', WEMAIL_ASSETS . '/css/review-notice.css', false, WEMAIL_VERSION ); - wp_enqueue_script( 'wemail-review-notice-script', WEMAIL_ASSETS . '/js/admin-review-notice.js', [ 'jquery' ], WEMAIL_VERSION, true ); + wp_enqueue_script( 'wemail-review-notice-script', WEMAIL_ASSETS . '/js/admin-review-notice.js', array( 'jquery' ), WEMAIL_VERSION, true ); } /** @@ -30,7 +30,8 @@ public function enqueue_assets() { * * @return void */ - public function connect_review_notice_html() { ?> + public function connect_review_notice_html() { + ?>
@@ -113,7 +114,7 @@ public function connect_review_notice() { $this->campaign_count = $sent_campaigns; if ( $this->time_based_review || $sent_campaigns >= 3 ) { - add_action( 'admin_notices', [ $this, 'connect_review_notice_html' ] ); + add_action( 'admin_notices', array( $this, 'connect_review_notice_html' ) ); } } @@ -131,9 +132,9 @@ public function check_campaign() { } $response = wemail()->api->campaigns()->query( - [ - 'statuses' => [ 'completed' ], - ] + array( + 'statuses' => array( 'completed' ), + ) )->get(); if ( is_wp_error( $response ) || ! isset( $response['meta'] ) ) { @@ -156,7 +157,7 @@ public function handle_review_response() { if ( isset( $_POST['submit'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['review_nonce'] ) ), '_review_nonce' ) ) { wp_die( __( 'Security check', 'wemail' ) ); - }; + } if ( isset( $_POST['review_reposnse_yes'] ) ) { $this->review_response( 'yes' ); diff --git a/includes/Admin/Scripts.php b/includes/Admin/Scripts.php index ae3c5dce..7886b6c8 100644 --- a/includes/Admin/Scripts.php +++ b/includes/Admin/Scripts.php @@ -41,15 +41,15 @@ public function __construct() { * @return void */ public function enqueue_styles() { - wp_register_style( 'wemail-jquery-ui', wemail()->wemail_cdn . '/vendor/jquery-ui/jquery-ui.min.css', [], $this->version ); - wp_register_style( 'wemail-timepicker', wemail()->wemail_cdn . '/vendor/jquery-timepicker/jquery.timepicker.min.css', [], $this->version ); - wp_register_style( 'wemail-tiny-mce', site_url( '/wp-includes/css/editor.css' ), [], $this->version ); + wp_register_style( 'wemail-jquery-ui', wemail()->wemail_cdn . '/vendor/jquery-ui/jquery-ui.min.css', array(), $this->version ); + wp_register_style( 'wemail-timepicker', wemail()->wemail_cdn . '/vendor/jquery-timepicker/jquery.timepicker.min.css', array(), $this->version ); + wp_register_style( 'wemail-tiny-mce', site_url( '/wp-includes/css/editor.css' ), array(), $this->version ); - $dependencies = [ + $dependencies = array( 'wemail-jquery-ui', 'wemail-timepicker', 'wemail-tiny-mce', - ]; + ); wp_enqueue_style( 'wemail', wemail()->wemail_cdn . '/build/css/wemail.css', $dependencies, $this->version ); } @@ -64,17 +64,17 @@ public function enqueue_styles() { public function enqueue_scripts() { wp_enqueue_media(); - wp_register_script( 'wemail-tiny-mce', site_url( '/wp-includes/js/tinymce/tinymce.min.js' ), [], true ); - wp_register_script( 'wemail-tiny-mce-code', wemail()->wemail_cdn . '/vendor/tinymce/plugins/code/plugin.min.js', [ 'wemail-tiny-mce' ], $this->version, true ); - wp_register_script( 'wemail-tiny-mce-hr', wemail()->wemail_cdn . '/vendor/tinymce/plugins/hr/plugin.min.js', [ 'wemail-tiny-mce-code' ], $this->version, true ); + wp_register_script( 'wemail-tiny-mce', site_url( '/wp-includes/js/tinymce/tinymce.min.js' ), array(), true ); + wp_register_script( 'wemail-tiny-mce-code', wemail()->wemail_cdn . '/vendor/tinymce/plugins/code/plugin.min.js', array( 'wemail-tiny-mce' ), $this->version, true ); + wp_register_script( 'wemail-tiny-mce-hr', wemail()->wemail_cdn . '/vendor/tinymce/plugins/hr/plugin.min.js', array( 'wemail-tiny-mce-code' ), $this->version, true ); - wp_register_script( 'wemail-moment', wemail()->wemail_cdn . '/vendor/moment/moment.min.js', [], $this->version, true ); - wp_register_script( 'wemail-moment-timezone', wemail()->wemail_cdn . '/vendor/moment/moment-timezone-with-data-2012-2022.min.js', [ 'wemail-moment' ], $this->version, true ); + wp_register_script( 'wemail-moment', wemail()->wemail_cdn . '/vendor/moment/moment.min.js', array(), $this->version, true ); + wp_register_script( 'wemail-moment-timezone', wemail()->wemail_cdn . '/vendor/moment/moment-timezone-with-data-2012-2022.min.js', array( 'wemail-moment' ), $this->version, true ); - wp_register_script( 'wemail-timepicker', wemail()->wemail_cdn . '/vendor/jquery-timepicker/jquery.timepicker.min.js', [ 'jquery' ], $this->version, true ); - wp_register_script( 'wemail-popper-js', wemail()->wemail_cdn . '/vendor/popper.js/popper.min.js', [], $this->version, true ); + wp_register_script( 'wemail-timepicker', wemail()->wemail_cdn . '/vendor/jquery-timepicker/jquery.timepicker.min.js', array( 'jquery' ), $this->version, true ); + wp_register_script( 'wemail-popper-js', wemail()->wemail_cdn . '/vendor/popper.js/popper.min.js', array(), $this->version, true ); - $dependencies = [ + $dependencies = array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', @@ -87,18 +87,18 @@ public function enqueue_scripts() { 'wemail-timepicker', 'wemail-popper-js', 'wemail-bootstrap', - ]; + ); if ( ! is_wemail_hmr_enable() ) { - wp_register_script( 'wemail-bootstrap', wemail()->wemail_cdn . '/build/js/bootstrap.js', [ 'jquery', 'wemail-popper-js' ], $this->version, true ); + wp_register_script( 'wemail-bootstrap', wemail()->wemail_cdn . '/build/js/bootstrap.js', array( 'jquery', 'wemail-popper-js' ), $this->version, true ); wp_enqueue_script( 'wemail-vendor', wemail()->wemail_cdn . '/build/js/vendor.js', $dependencies, $this->version, true ); - wp_enqueue_script( 'wemail', wemail()->wemail_cdn . '/build/js/wemail.js', [ 'wemail-vendor' ], $this->version, true ); + wp_enqueue_script( 'wemail', wemail()->wemail_cdn . '/build/js/wemail.js', array( 'wemail-vendor' ), $this->version, true ); } else { $hmr_host = wemail()->hmr_host(); - wp_register_script( 'wemail-bootstrap', $hmr_host . '/src/vendor/bootstrap/js/bootstrap.js', [ 'jquery', 'wemail-popper-js' ], $this->version, true ); + wp_register_script( 'wemail-bootstrap', $hmr_host . '/src/vendor/bootstrap/js/bootstrap.js', array( 'jquery', 'wemail-popper-js' ), $this->version, true ); wp_enqueue_script( 'wemail-vendor', $hmr_host . '/src/js/vendor.js', $dependencies, $this->version, true ); - wp_enqueue_script( 'wemail', $hmr_host . '/src/js/wemail.js', [ 'wemail-vendor' ], $this->version, true ); + wp_enqueue_script( 'wemail', $hmr_host . '/src/js/wemail.js', array( 'wemail-vendor' ), $this->version, true ); } $user = wemail()->user; @@ -111,7 +111,7 @@ public function enqueue_scripts() { $current = wp_get_current_user(); $current_user = $current && $current->data ? $current->data : null; - $wemail = [ + $wemail = array( 'version' => wemail()->version, 'siteURL' => site_url( '/' ), 'homeURL' => home_url( '/' ), @@ -122,49 +122,49 @@ public function enqueue_scripts() { 'api' => wemail()->api->get_props(), 'cdn' => wemail()->wemail_cdn, 'app' => wemail()->wemail_app, - 'dateTime' => [ - 'server' => [ + 'dateTime' => array( + 'server' => array( 'timezone' => wemail_get_wp_timezone(), 'date' => current_time( 'Y-m-d' ), 'time' => current_time( 'H:i:s' ), 'dateFormat' => $date_format ? $date_format : 'Y-m-d', 'timeFormat' => $time_format ? $time_format : 'g:i a', 'startOfWeek' => get_option( 'start_of_week', 0 ), - ], + ), 'toMoment' => '', 'momentDateFormat' => '', 'momentTimeFormat' => '', - ], + ), - 'user' => [ + 'user' => array( 'hash' => $user->hash, 'role' => $user->role, 'permissions' => $user->permissions, - ], - 'currentUser' => $current_user ? [ + ), + 'currentUser' => $current_user ? array( 'name' => $current_user->display_name, 'email' => $current_user->user_email, - ] : null, + ) : null, // Vue related data 'customizerIframe' => WEMAIL_URL . '/views/customizer.html', 'locale_data' => $this->get_locale_data(), - 'hideAdminNoticesIn' => [ + 'hideAdminNoticesIn' => array( 'campaignEditDesign', - ], + ), 'activeIntegrations' => $this->active_integrations(), - 'integrations' => [ - 'woocommerce' => [ + 'integrations' => array( + 'woocommerce' => array( 'is_active' => Ecommerce::instance()->platform( 'woocommerce' )->is_active(), 'is_integrated' => Ecommerce::instance()->platform( 'woocommerce' )->is_integrated(), - ], - 'edd' => [ + ), + 'edd' => array( 'is_active' => Ecommerce::instance()->platform( 'edd' )->is_active(), 'is_integrated' => Ecommerce::instance()->platform( 'edd' )->is_integrated(), - ], - ], + ), + ), 'site_name' => get_bloginfo( 'name' ), - ]; + ); wp_localize_script( 'wemail-vendor', 'weMail', $wemail ); @@ -185,17 +185,17 @@ private function get_locale_data() { $translations = get_translations_for_domain( $domain ); - $locale = [ + $locale = array( 'domain' => $domain, - 'locale_data' => [ - $domain => [ - '' => [ + 'locale_data' => array( + $domain => array( + '' => array( 'domain' => $domain, 'lang' => is_admin() ? get_user_locale() : get_locale(), - ], - ], - ], - ]; + ), + ), + ), + ); if ( ! empty( $translations->headers['Plural-Forms'] ) ) { $locale['locale_data'][ $domain ]['']['plural_forms'] = $translations->headers['Plural-Forms']; @@ -216,9 +216,9 @@ private function get_locale_data() { * @return array */ private function active_integrations() { - return [ + return array( 'erp_crm' => is_erp_crm_active(), 'mailpoet' => class_exists( 'MailPoet\Listing\Handler' ) || class_exists( 'WYSIJA' ), - ]; + ); } } diff --git a/includes/Admin/Shortcode.php b/includes/Admin/Shortcode.php index b574f322..155c015c 100644 --- a/includes/Admin/Shortcode.php +++ b/includes/Admin/Shortcode.php @@ -61,10 +61,10 @@ public function enqueue_script( $plugin_array ) { */ public function print_tinymce_data() { $forms = wemail()->form->get_forms( - [ - 'type' => [ 'modal', 'inline' ], - 'select' => [ 'id', 'name' ], - ] + array( + 'type' => array( 'modal', 'inline' ), + 'select' => array( 'id', 'name' ), + ) ); $icon = wemail()->wemail_cdn . '/images/logo/wemail-alt.svg'; @@ -72,11 +72,10 @@ public function print_tinymce_data() { $this->root, 'api_key' => $this->get_api_key(), - ]; + ); } /** @@ -158,11 +159,11 @@ public function get_props() { * @return array */ private function args( $args ) { - $defaults = [ - 'headers' => [ + $defaults = array( + 'headers' => array( 'x-api-key' => $this->get_api_key(), - ], - ]; + ), + ); return wp_parse_args( $args, $defaults ); } @@ -194,7 +195,7 @@ public function query( $query ) { * * @return string */ - private function build_url( $url = '', $query = [] ) { + private function build_url( $url = '', $query = array() ) { if ( $url ) { $url = $this->root . $url; } elseif ( $this->url ) { @@ -210,7 +211,7 @@ private function build_url( $url = '', $query = [] ) { } $this->url = ''; - $this->query = []; + $this->query = array(); return $url; } @@ -226,7 +227,7 @@ private function build_url( $url = '', $query = [] ) { * * @return mixed */ - public function get( $url = '', $query = [], $args = [] ) { + public function get( $url = '', $query = array(), $args = array() ) { $args = $this->args( $args ); $args['timeout'] = 50; @@ -247,7 +248,7 @@ public function get( $url = '', $query = [], $args = [] ) { public function get_response( $url = '' ) { $url = $this->build_url( $url ); - $args = $this->args( [] ); + $args = $this->args( array() ); return wp_remote_get( $url, $args ); } @@ -261,7 +262,7 @@ public function get_response( $url = '' ) { * @return mixed * @since 1.0.0 */ - public function post( $data = [], $args = [] ) { + public function post( $data = array(), $args = array() ) { $args = $this->args( $args ); $args['timeout'] = 50; @@ -306,7 +307,7 @@ public function send_json( $json = true ) { * * @return mixed */ - public function put( $data, $args = [] ) { + public function put( $data, $args = array() ) { $data['_method'] = 'put'; return $this->post( $data, $args ); @@ -322,7 +323,7 @@ public function put( $data, $args = [] ) { * * @return mixed */ - public function delete( $data = [], $args = [] ) { + public function delete( $data = array(), $args = array() ) { $args = $this->args( $args ); $args['method'] = 'delete'; @@ -360,9 +361,9 @@ private function response( $response ) { ? $body['message'] : __( 'Something went wrong', 'wemail' ); - $error_data = [ + $error_data = array( 'status' => $response_code, - ]; + ); if ( isset( $body['errors'] ) && diff --git a/includes/Core/Auth/Auth.php b/includes/Core/Auth/Auth.php index 6f2937c4..0cf468a2 100644 --- a/includes/Core/Auth/Auth.php +++ b/includes/Core/Auth/Auth.php @@ -18,7 +18,7 @@ class Auth { */ public function site( $api = '' ) { $start_of_week = get_option( 'start_of_week', 1 ); - $week_days = [ 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ]; + $week_days = array( 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ); $user = wp_get_current_user(); @@ -38,7 +38,7 @@ public function site( $api = '' ) { set_transient( 'wemail_validate_me_key', $key, 5 * MINUTE_IN_SECONDS ); - $data = [ + $data = array( 'api_key' => $api, 'site_name' => get_bloginfo( 'name' ), 'site_email' => get_bloginfo( 'admin_email' ), @@ -54,7 +54,7 @@ public function site( $api = '' ) { 'admin_email' => $user->data->user_email, 'rest_url' => untrailingslashit( get_rest_url( null, '/wemail/v1/auth/validate-me' ) ), 'key' => $key, - ]; + ); $response = wemail()->api->auth()->sites()->post( $data ); @@ -65,7 +65,7 @@ public function site( $api = '' ) { if ( ! empty( $response['access_token'] ) ) { update_option( 'wemail_site_slug', $response['data']['slug'] ); - $available_roles = [ 'administrator', 'editor' ]; + $available_roles = array( 'administrator', 'editor' ); update_option( 'wemail_accessible_roles', $available_roles ); update_user_meta( $user->ID, 'wemail_api_key', $response['access_token'] ); @@ -73,25 +73,25 @@ public function site( $api = '' ) { wemail()->api->set_api_key( $response['access_token'] ); $wp_admins = get_users( - [ + array( 'role__in' => $available_roles, - 'exclude' => [ $user->ID ], - ] + 'exclude' => array( $user->ID ), + ) ); foreach ( $wp_admins as $wp_admin ) { $roles = array_values( $wp_admin->roles ); - $data = [ + $data = array( 'name' => $wp_admin->data->display_name, 'email' => $wp_admin->data->user_email, 'role' => in_array( 'administrator', $roles, true ) ? 'admin' : 'team', 'include' => 'role,permissions', - ]; + ); - $wp_admin_response = wemail()->api->auth()->users()->post( $data ); + $wp_admin_response = wemail()->api->teamUsers()->post( $data ); if ( ! empty( $wp_admin_response['access_token'] ) ) { - $user_meta = [ + $user_meta = array( 'deleted_at' => $wp_admin_response['data']['deleted_at'], 'email' => $wp_admin_response['data']['email'], 'hash' => $wp_admin_response['data']['hash'], @@ -99,7 +99,7 @@ public function site( $api = '' ) { 'permissions' => $wp_admin_response['data']['permissions'], 'role' => $wp_admin_response['data']['role'], 'roles' => $wp_admin_response['data']['roles'], - ]; + ); update_user_meta( $wp_admin->ID, 'wemail_api_key', $wp_admin_response['access_token'] ); update_user_meta( $wp_admin->ID, 'wemail_user_data', $user_meta ); @@ -119,7 +119,7 @@ public function site( $api = '' ) { } $message = __( 'Could not connect your site, please try again', 'wemail' ); - $data = []; + $data = array(); if ( ! empty( $response['message'] ) ) { $message = $response['message']; diff --git a/includes/Core/Automation/Menu.php b/includes/Core/Automation/Menu.php index 9dabb937..da469194 100644 --- a/includes/Core/Automation/Menu.php +++ b/includes/Core/Automation/Menu.php @@ -39,7 +39,7 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_campaign' ) ) { - $menu_items[] = [ __( 'Automations', 'wemail' ), $capability, 'admin.php?page=wemail#/automations' ]; + $menu_items[] = array( __( 'Automations', 'wemail' ), $capability, 'admin.php?page=wemail#/automations' ); } return $menu_items; diff --git a/includes/Core/Billing/Menu.php b/includes/Core/Billing/Menu.php index e4c53fce..b0c1b624 100644 --- a/includes/Core/Billing/Menu.php +++ b/includes/Core/Billing/Menu.php @@ -40,7 +40,7 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ __( 'Billing', 'wemail' ), $capability, 'admin.php?page=wemail#/billing' ]; + $menu_items[] = array( __( 'Billing', 'wemail' ), $capability, 'admin.php?page=wemail#/billing' ); } return $menu_items; diff --git a/includes/Core/Campaign/Campaign.php b/includes/Core/Campaign/Campaign.php index 9070a968..0f69d7ec 100644 --- a/includes/Core/Campaign/Campaign.php +++ b/includes/Core/Campaign/Campaign.php @@ -50,7 +50,7 @@ public function boot() { * * @return array */ - public function all( $query = [] ) { + public function all( $query = array() ) { return wemail()->api->campaigns()->query( $query )->get(); } @@ -62,11 +62,11 @@ public function all( $query = [] ) { * @return array * @since 1.0.0 */ - public function get( $id, $include = [] ) { + public function get( $id, $include = array() ) { $campaign = wemail()->api->campaigns( $id ); if ( ! empty( $include ) ) { - $campaign = $campaign->query( [ 'include' => implode( ',', $include ) ] ); + $campaign = $campaign->query( array( 'include' => implode( ',', $include ) ) ); } $campaign = $campaign->get(); @@ -82,5 +82,4 @@ public function get( $id, $include = [] ) { return $campaign; } - } diff --git a/includes/Core/Campaign/Editor.php b/includes/Core/Campaign/Editor.php index 6f374b07..ecc38f50 100644 --- a/includes/Core/Campaign/Editor.php +++ b/includes/Core/Campaign/Editor.php @@ -13,7 +13,7 @@ class Editor { * * @var string[] $default_content_types */ - protected $default_content_types = [ + protected $default_content_types = array( 'text', 'image', 'imageCaption', @@ -25,7 +25,7 @@ class Editor { 'countdown', 'wooProducts', 'giphy', - ]; + ); /** * Content type images directory @@ -57,24 +57,24 @@ public function __construct() { * @return array */ public function get_setup_data() { - return [ + return array( 'lists' => wemail()->lists->items(), 'segments' => wemail()->segment->items(), 'events' => wemail()->campaign->event->all(), - 'campaign' => [ + 'campaign' => array( 'name' => '', 'type' => 'standard', 'version' => WEMAIL_VERSION, - 'lists' => [], - 'segments' => [], - 'event' => [ + 'lists' => array(), + 'segments' => array(), + 'event' => array( 'action' => 'wemail_subscribed_to_list', 'value' => '', 'schedule_type' => 'immediately', 'schedule_offset' => 1, - ], - ], - ]; + ), + ), + ); } /** @@ -88,7 +88,7 @@ public function get_setup_data() { * @return array */ private function i18n() { - $i18n = [ + $i18n = array( 'createCampaign' => __( 'Create Campaign', 'wemail' ), 'editCampaign' => __( 'Edit Campaign', 'wemail' ), 'campaignName' => __( 'Campaign Name', 'wemail' ), @@ -145,7 +145,7 @@ private function i18n() { 'noListSelected' => __( 'No list selected', 'wemail' ), 'noSegmentSelected' => __( 'No segment selected', 'wemail' ), 'currentServerTimeIs' => __( 'Current server time is', 'wemail' ), - ]; + ); /** * I18n strings for email campaign editor pages @@ -187,10 +187,10 @@ public function get_customizer_data( $context ) { * @return array */ public function content_type_settings( $settings ) { - $additional_types = [ + $additional_types = array( 'wpPosts' => self::wp_posts(), 'rss' => self::rss(), - ]; + ); return array_merge( $settings, $additional_types ); } @@ -203,21 +203,21 @@ public function content_type_settings( $settings ) { * @return array */ public static function wp_posts() { - return [ + return array( 'type' => 'wpPosts', 'title' => __( 'WP Posts', 'wemail' ), 'image' => self::$image_dir . '/wp.svg', - 'default' => [ - 'containerStyle' => [ + 'default' => array( + 'containerStyle' => array( 'padding' => '25px', 'marginBottom' => '0px', 'backgroundColor' => '#ffffff', - ], - 'posts' => [], + ), + 'posts' => array(), 'layout' => 'list', 'post_per_row' => 2, - 'title' => [ - 'style' => [ + 'title' => array( + 'style' => array( 'fontSize' => '30px', 'color' => '#333333', 'textAlign' => 'left', @@ -225,11 +225,11 @@ public static function wp_posts() { 'textTransform' => 'none', 'lineHeight' => '50px', 'marginBottom' => '15px', - ], - ], - 'image' => [ + ), + ), + 'image' => array( 'display' => 'show', - 'style' => [ + 'style' => array( 'max-width' => '100%', 'float' => 'none', 'borderWidth' => '0px', @@ -241,27 +241,27 @@ public static function wp_posts() { 'marginRight' => '0px', 'marginBottom' => '10px', 'marginLeft' => '0px', - ], - 'containerStyle' => [ + ), + 'containerStyle' => array( 'textAlign' => 'left', - ], - ], - 'content' => [ + ), + ), + 'content' => array( 'display' => 'show', 'content_format' => 'excerpt', 'excerpt_length' => 55, - 'style' => [ + 'style' => array( 'fontSize' => '14px', 'color' => '#556271', 'textAlign' => 'left', 'lineHeight' => '20px', 'marginBottom' => '15px', - ], - ], - 'readMore' => [ + ), + ), + 'readMore' => array( 'display' => 'show', - 'style' => [ + 'style' => array( 'display' => 'inline-block', 'paddingTop' => '10px', 'paddingRight' => '15px', @@ -279,85 +279,85 @@ public static function wp_posts() { 'borderStyle' => 'solid', 'borderColor' => '#e5e5e5', 'marginBottom' => '30px', - ], + ), 'text' => __( 'Read More', 'wemail' ), - 'containerStyle' => [ + 'containerStyle' => array( 'textAlign' => 'left', - ], - ], - 'meta' => [ + ), + ), + 'meta' => array( 'display' => 'show', 'separator' => ' | ', - 'fields' => [ - 'author' => [ + 'fields' => array( + 'author' => array( 'text' => __( 'Author: ', 'wemail' ), 'display' => 'show', - ], - 'categories' => [ + ), + 'categories' => array( 'text' => __( 'Categories: ', 'wemail' ), 'display' => 'show', - ], - 'tags' => [ + ), + 'tags' => array( 'text' => __( 'Tags: ', 'wemail' ), 'display' => 'show', - ], - 'postDate' => [ + ), + 'postDate' => array( 'text' => __( 'Post Date: ', 'wemail' ), 'display' => 'show', - ], - ], - 'style' => [ + ), + ), + 'style' => array( 'fontSize' => '12px', 'color' => '#556271', 'textAlign' => 'left', 'lineHeight' => '20px', 'marginBottom' => '15px', 'fontStyle' => 'normal', - ], - ], - ], - ]; + ), + ), + ), + ); } public static function rss() { - return [ + return array( 'type' => 'rss', 'title' => __( 'Latest Posts', 'wemail' ), 'image' => self::$image_dir . '/wp.svg', 'noSettingsTab' => true, - 'default' => [ + 'default' => array( 'source' => 'wp', - 'payload' => [ + 'payload' => array( 'post_type' => 'post', 'tag_id' => null, 'category_id' => null, 'limit' => 5, - ], - 'containerStyle' => [ + ), + 'containerStyle' => array( 'padding' => '25px 25px 25px 25px', 'marginBottom' => '0px', 'background' => '#ffffff', - ], - 'image' => [ + ), + 'image' => array( 'display' => true, - 'style' => [ + 'style' => array( 'max-width' => '100%', 'border' => '0px solid #cccccc', 'borderRadius' => '0px', 'padding' => '0px 0px 0px 0px', 'background' => '#ffffff', 'margin' => '0px 0px 0px 0px', - ], - 'containerStyle' => [ + ), + 'containerStyle' => array( 'textAlign' => 'left', 'display' => 'block', - ], - 'hyperlink' => [ + ), + 'hyperlink' => array( 'enable' => false, - ], - ], - 'title' => [ - 'style' => [ + ), + ), + 'title' => array( + 'style' => array( 'padding' => '0px 0px 0px 0px', 'margin' => '15px 0px 10px 0px', 'fontSize' => '25px', @@ -365,26 +365,26 @@ public static function rss() { 'textAlign' => 'left', 'fontWeight' => '600', 'textTransform' => 'none', - ], - ], - 'content' => [ + ), + ), + 'content' => array( 'display' => true, 'content_format' => 'excerpt', - 'style' => [ + 'style' => array( 'fontSize' => '14px', 'color' => '#556271', 'textAlign' => 'left', 'lineHeight' => '20px', 'margin' => '5px 0px 5px 0px', - ], - ], - 'readMore' => [ + ), + ), + 'readMore' => array( 'display' => true, 'text' => 'Read More', - 'containerStyle' => [ + 'containerStyle' => array( 'textAlign' => 'left', - ], - 'style' => [ + ), + 'style' => array( 'padding' => '8px 15px 8px 15px', 'fontSize' => '14px', 'fontWeight' => '400', @@ -396,46 +396,46 @@ public static function rss() { 'border' => '0px solid #e5e5e5', 'margin' => '5px 0px 25px 0px', 'display' => 'inline-block', - ], - ], - 'meta' => [ + ), + ), + 'meta' => array( 'display' => true, 'separator' => ' | ', - 'fields' => [ - 'author' => [ + 'fields' => array( + 'author' => array( 'display' => true, 'text' => __( 'Author: ', 'wemail' ), - ], - 'categories' => [ + ), + 'categories' => array( 'display' => true, 'text' => __( 'Categories: ', 'wemail' ), - ], - 'tags' => [ + ), + 'tags' => array( 'display' => true, 'text' => __( 'Tags: ', 'wemail' ), - ], - 'postDate' => [ + ), + 'postDate' => array( 'display' => true, 'text' => __( 'Post Date: ', 'wemail' ), - ], - ], - 'style' => [ + ), + ), + 'style' => array( 'margin' => '10px 0px 15px 0px', 'fontSize' => '14px', 'display' => 'inline-block', - ], - ], - 'divider' => [ + ), + ), + 'divider' => array( 'display' => true, - 'style' => [ + 'style' => array( 'borderBottom' => '1px dashed #ddd', 'width' => '100%', 'marginLeft' => 'auto', 'marginRight' => 'auto', 'marginBottom' => '25px', - ], - ], - ], - ]; + ), + ), + ), + ); } } diff --git a/includes/Core/Campaign/Event.php b/includes/Core/Campaign/Event.php index 80a9c153..36462b78 100644 --- a/includes/Core/Campaign/Event.php +++ b/includes/Core/Campaign/Event.php @@ -9,19 +9,18 @@ public function __construct() { public function all() { return apply_filters( 'wemail_campaign_events', - [ - [ + array( + array( 'action' => 'wemail_subscribed_to_list', 'actionTitle' => __( 'when someone subscribes to the list', 'wemail' ), 'options' => wemail()->lists->items(), - ], - [ + ), + array( 'action' => 'wemail_matches_segment', 'actionTitle' => __( 'when a subscriber added to the segment', 'wemail' ), 'options' => wemail()->segment->all(), - ], - ] + ), + ) ); } - } diff --git a/includes/Core/Campaign/Menu.php b/includes/Core/Campaign/Menu.php index 9b827a98..aad77a5a 100644 --- a/includes/Core/Campaign/Menu.php +++ b/includes/Core/Campaign/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_campaign' ) ) { - $menu_items[] = [ __( 'Campaigns', 'wemail' ), $capability, 'admin.php?page=wemail#/campaigns' ]; + $menu_items[] = array( __( 'Campaigns', 'wemail' ), $capability, 'admin.php?page=wemail#/campaigns' ); } return $menu_items; } - } diff --git a/includes/Core/Customizer/ContentTypes.php b/includes/Core/Customizer/ContentTypes.php index 6fad4dcc..1676cdb4 100644 --- a/includes/Core/Customizer/ContentTypes.php +++ b/includes/Core/Customizer/ContentTypes.php @@ -25,7 +25,7 @@ class ContentTypes { public static function get_content_type_settings( $context ) { self::$image_dir = wemail()->wemail_cdn . '/images/content-types'; - $settings = [ + $settings = array( 'text' => self::text(), 'image' => self::image(), 'imageCaption' => self::image_caption(), @@ -37,7 +37,7 @@ public static function get_content_type_settings( $context ) { 'countdown' => self::countdown(), 'wooProducts' => self::woo_commerce_product(), 'giphy' => self::giphy(), - ]; + ); /** * Filter for weMail customizer content type settings @@ -59,12 +59,12 @@ public static function get_content_type_settings( $context ) { * @return array */ public static function text() { - return [ + return array( 'type' => 'text', 'title' => __( 'Text', 'wemail' ), 'image' => self::$image_dir . '/text.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => '#ffffff', 'color' => '', 'paddingTop' => '15px', @@ -75,16 +75,16 @@ public static function text() { 'borderStyle' => 'solid', 'borderColor' => '#e5e5e5', 'marginBottom' => '0px', - ], - 'twoColumns' => true, - 'texts' => [ + ), + 'twoColumns' => false, + 'texts' => array( sprintf( '

%s

', __( 'This is a text block. You can use it to add text to your template.', 'wemail' ) ), sprintf( '

%s

', __( 'This is a text block 2. You can use it to add text to your template.', 'wemail' ) ), - ], + ), 'columnSplit' => '1-1', // 1-1, 1-2, 2-1 'valign' => 'top', - ], - ]; + ), + ); } /** @@ -95,12 +95,12 @@ public static function text() { * @return array */ public static function image() { - return [ + return array( 'type' => 'image', 'title' => __( 'Image', 'wemail' ), 'image' => self::$image_dir . '/image.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => '#ffffff', 'paddingTop' => '15px', 'paddingBottom' => '15px', @@ -111,17 +111,17 @@ public static function image() { 'borderColor' => '#e5e5e5', 'marginBottom' => '0px', 'textAlign' => 'center', - ], - 'images' => [ - [ + ), + 'images' => array( + array( 'alt' => '', 'src' => wemail()->wemail_cdn . '/images/placeholder-image-full.png', 'link' => '', 'openAttrEditor' => '', - ], - ], - ], - ]; + ), + ), + ), + ); } /** @@ -132,12 +132,12 @@ public static function image() { * @return array */ public static function image_caption() { - return [ + return array( 'type' => 'imageCaption', 'title' => __( 'Image Caption', 'wemail' ), 'image' => self::$image_dir . '/image-caption.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => '#ffffff', 'color' => '', 'padding' => '15px', @@ -145,37 +145,37 @@ public static function image_caption() { 'borderColor' => '#e5e5e5', 'marginBottom' => '0px', 'textAlign' => 'center', - 'text' => [ + 'text' => array( 'paddingTop' => '0px', 'paddintRight' => '0px', 'paddintBottom' => '0px', 'paddintLeft' => '0px', - ], - ], - 'captions' => [ - [ + ), + ), + 'captions' => array( + array( 'text' => sprintf( '

%s

', __( 'This is a text block. You can use it to add text to your template.', 'wemail' ) ), - 'image' => [ + 'image' => array( 'alt' => '', 'src' => wemail()->wemail_cdn . '/images/placeholder-image-full.png', 'link' => '', 'openAttrEditor' => '', - ], - ], - [ + ), + ), + array( 'text' => sprintf( '

%s

', __( 'This is a text block. You can use it to add text to your template.', 'wemail' ) ), - 'image' => [ + 'image' => array( 'alt' => '', 'src' => wemail()->wemail_cdn . '/images/placeholder-image-full.png', 'link' => '', 'openAttrEditor' => '', - ], - ], - ], + ), + ), + ), 'twoCaptions' => false, 'capPosition' => 'bottom', - ], - ]; + ), + ); } /** @@ -190,24 +190,24 @@ public static function social_follow() { $company = wemail()->api->settings()->company()->get(); $facebook = 'https://facebook.com'; - $twitter = 'https://twitter.com'; + $x = 'https://x.com'; $website = 'https://example.com'; if ( ! empty( $settings['data'] ) ) { $facebook = $settings['data']['facebook']; - $twitter = $settings['data']['twitter']; + $x = $settings['data']['twitter']; } if ( ! empty( $company['data'] ) ) { $website = $company['data']['website']; } - return [ + return array( 'type' => 'socialFollow', 'title' => __( 'Social Follow', 'wemail' ), 'image' => self::$image_dir . '/social-follow.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => '#ffffff', 'color' => '', 'padding' => '15px', @@ -218,31 +218,31 @@ public static function social_follow() { 'textTransform' => 'none', 'textAlign' => 'center', 'marginBottom' => '0px', - ], + ), 'iconStyle' => 'solid-color', 'iconMargin' => '15px', 'display' => 'both', // icon/text/both 'layout' => 'horizontal', // vertical/horizontal 'size' => 'default', // default/large - 'icons' => [ - [ + 'icons' => array( + array( 'site' => 'facebook', 'link' => $facebook, 'text' => 'Facebook', - ], - [ - 'site' => 'twitter', - 'link' => $twitter, - 'text' => 'Twitter', - ], - [ + ), + array( + 'site' => 'X', + 'link' => $x, + 'text' => 'X', + ), + array( 'site' => 'website', 'link' => $website, 'text' => 'Website', - ], - ], - ], - ]; + ), + ), + ), + ); } /** @@ -253,14 +253,14 @@ public static function social_follow() { * @return array */ public static function button() { - return [ + return array( 'type' => 'button', 'title' => __( 'Button', 'wemail' ), 'image' => self::$image_dir . '/button.svg', - 'default' => [ - 'buttons' => [ - [ - 'style' => [ + 'default' => array( + 'buttons' => array( + array( + 'style' => array( 'display' => 'inline-block', 'paddingTop' => '18px', 'paddingRight' => '65px', @@ -279,20 +279,20 @@ public static function button() { 'borderWidth' => '0px', 'borderStyle' => 'solid', 'borderColor' => '#e5e5e5', - ], + ), 'text' => __( 'Button Text', 'wemail' ), 'href' => site_url( '/' ), 'title' => '', - ], - ], - 'containerStyle' => [ + ), + ), + 'containerStyle' => array( 'textAlign' => 'center', 'backgroundColor' => '#ffffff', 'padding' => '18px', 'marginBottom' => '0px', - ], - ], - ]; + ), + ), + ); } /** @@ -303,75 +303,75 @@ public static function button() { * @return array */ public static function divider() { - return [ + return array( 'type' => 'divider', 'title' => __( 'Divider', 'wemail' ), 'image' => self::$image_dir . '/divider.svg', - 'default' => [ + 'default' => array( 'dividerType' => 'line', - 'containerStyle' => [ + 'containerStyle' => array( 'padding' => '15px', 'backgroundColor' => '#ffffff', 'marginBottom' => '0px', - ], - 'style' => [ + ), + 'style' => array( 'width' => '100%', 'borderTopWidth' => '2px', 'borderTopStyle' => 'dashed', 'borderTopColor' => '#e5e5e5', 'margin' => '0 auto', - ], - 'image' => [ + ), + 'image' => array( 'image' => wemail()->wemail_cdn . '/images/dividers/brush-stroke-lite.png', - 'style' => [ + 'style' => array( 'height' => '7px', 'width' => '100%', - ], - ], - ], + ), + ), + ), 'noStyleTab' => true, - ]; + ); } public static function video() { - return [ + return array( 'type' => 'video', 'title' => __( 'Video', 'wemail' ), 'image' => self::$image_dir . '/video.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => 'transparent', 'padding' => '15px', 'borderWidth' => '0px', 'borderStyle' => 'solid', 'borderColor' => '#e5e5e5', 'textAlign' => 'center', - ], - 'textStyle' => [ + ), + 'textStyle' => array( 'backgroundColor' => '#333333', 'fontSize' => '14px', 'color' => '#ffffff', 'textAlign' => 'center', 'padding' => '15px', - ], - 'video' => [ + ), + 'video' => array( 'link' => '', 'image' => '', 'alt' => '', - ], + ), 'text' => sprintf( '

%s

', __( 'This is a text block. You can use it to add text to your template.', 'wemail' ) ), 'capPosition' => 'bottom', - ], - ]; + ), + ); } public static function footer() { - return [ + return array( 'type' => 'footer', 'title' => __( 'Footer', 'wemail' ), 'image' => self::$image_dir . '/footer.svg', - 'default' => [ - 'style' => [ + 'default' => array( + 'style' => array( 'backgroundColor' => '#ffffff', 'color' => '', 'paddingTop' => '15px', @@ -382,16 +382,16 @@ public static function footer() { 'borderStyle' => 'solid', 'borderColor' => '#e5e5e5', 'marginBottom' => '0px', - ], + ), 'twoColumns' => false, - 'texts' => [ + 'texts' => array( '

This email was sent to [subscriber:email] because you have opted in to receive specific updates on our website.

If you would prefer not to receive any email from us in the future, please [links:unsubscribe text="click here to unsubscribe"].

Our mailing address
[company:name]
[company:address]

Copyright © [date:year] [company:name], All rights reserved.

', sprintf( '

%s

', __( 'This is a text block. You can use it to add text to your template.', 'wemail' ) ), - ], + ), 'columnSplit' => '1-1', 'valign' => 'top', - ], - ]; + ), + ); } /** @@ -402,41 +402,41 @@ public static function footer() { public static function countdown() { $api_url = parse_url( wemail()->wemail_api ); - return [ + return array( 'type' => 'countdown', 'title' => __( 'Countdown', 'wemail' ), 'image' => self::$image_dir . '/countdown.svg', - 'default' => [ - 'containerStyle' => [ + 'default' => array( + 'containerStyle' => array( 'textAlign' => 'center', 'backgroundColor' => '#ffffff', 'padding' => '18px', 'marginBottom' => '0px', - ], - 'label' => [ + ), + 'label' => array( 'days' => 'Days', 'hours' => 'Hours', 'minutes' => 'Minutes', 'seconds' => 'Seconds', - ], - 'query' => [ + ), + 'query' => array( 'date' => '', 'time' => '', 'weight' => 'regular', 'timezone' => '', - ], + ), 'isLabelShow' => false, - 'fontWeights' => [ + 'fontWeights' => array( 'light' => __( 'Light', 'wemail' ), 'regular' => __( 'Regular', 'wemail' ), 'semibold' => __( 'Semibold', 'wemail' ), 'bold' => __( 'Bold', 'wemail' ), - ], + ), 'imageBasePath' => $api_url['scheme'] . '://' . $api_url['host'], 'timezones' => timezone_identifiers_list(), - ], + ), 'noStyleTab' => true, - ]; + ); } /** @@ -445,43 +445,43 @@ public static function countdown() { * @return array */ public static function woo_commerce_product() { - return [ + return array( 'type' => 'wooProducts', 'title' => __( 'Woo Products', 'wemail' ), 'image' => self::$image_dir . '/woo-commerce-product.svg', - 'default' => [ - 'products' => [], - 'rowStyle' => [ - 'options' => [ - [ + 'default' => array( + 'products' => array(), + 'rowStyle' => array( + 'options' => array( + array( 'title' => __( 'Grid', 'wemail' ), 'value' => 'grid', - ], - [ + ), + array( 'title' => __( 'List', 'wemail' ), 'value' => 'list', - ], - ], + ), + ), 'value' => 'list', - ], - 'containerStyle' => [ + ), + 'containerStyle' => array( 'textAlign' => 'left', 'backgroundColor' => '#ffffff', 'padding' => '18px', 'marginBottom' => '0px', 'color' => '#2c3e50', - ], - 'list' => [ + ), + 'list' => array( 'imageWidth' => '40%', - ], - 'grid' => [ + ), + 'grid' => array( 'products' => 2, - ], - 'content' => [ + ), + 'content' => array( 'valign' => 'top', - ], - 'product' => [ - 'image' => [ + ), + 'product' => array( + 'image' => array( 'padding' => '0px', 'borderColor' => '#0073aa', 'borderWidth' => '0px', @@ -490,43 +490,43 @@ public static function woo_commerce_product() { 'backgroundColor' => '#fff', 'marginBottom' => '12px', 'maxWidth' => '100%', - ], + ), 'borderSpacingTopBottom' => '20', 'borderSpacingLeftRight' => '20', - 'star' => [ + 'star' => array( 'isShow' => 'on', 'color' => '#fbd233', 'size' => '18px', 'marginBottom' => '3px', - ], - 'description' => [ + ), + 'description' => array( 'show' => 'on', 'mode' => 'description', - 'style' => [ + 'style' => array( 'color' => '#4F5055', 'fontSize' => '14px', 'marginBottom' => '8px', 'textTransform' => 'initial', - ], - ], - 'title' => [ - 'style' => [ + ), + ), + 'title' => array( + 'style' => array( 'fontSize' => '20px', 'color' => '#4F5055', 'textTransform' => 'initial', 'marginBottom' => '5px', - ], - ], - 'price' => [ - 'style' => [ + ), + ), + 'price' => array( + 'style' => array( 'color' => '#4F5055', 'fontSize' => '14px', 'marginBottom' => '0px', - ], - ], - 'button' => [ + ), + ), + 'button' => array( 'text' => __( 'Read More', 'wemail' ), - 'style' => [ + 'style' => array( 'color' => '#fff', 'backgroundColor' => '#1E73BE', 'fontSize' => '14px', @@ -541,11 +541,11 @@ public static function woo_commerce_product() { 'display' => 'inline-block', 'textTransform' => 'initial', 'marginBottom' => '5px', - ], - ], - ], - ], - ]; + ), + ), + ), + ), + ); } /** @@ -554,14 +554,14 @@ public static function woo_commerce_product() { * @return array */ public static function giphy() { - return [ + return array( 'type' => 'giphy', 'title' => __( 'Giphy', 'wemail' ), 'image' => self::$image_dir . '/giphy.svg', - 'default' => [ - 'image' => (object) [], + 'default' => array( + 'image' => (object) array(), 'size' => 'fixed_height_small', - 'style' => [ + 'style' => array( 'borderStyle' => 'solid', 'borderWidth' => '0px', 'borderColor' => '#eee', @@ -571,14 +571,14 @@ public static function giphy() { 'paddingRight' => '5px', 'backgroundColor' => '#fff', 'maxWidth' => '100%', - ], - 'containerStyle' => [ + ), + 'containerStyle' => array( 'textAlign' => 'center', 'backgroundColor' => '#ffffff', 'marginBottom' => '0px', - ], - ], + ), + ), 'noSettingsTab' => true, - ]; + ); } } diff --git a/includes/Core/Customizer/Customizer.php b/includes/Core/Customizer/Customizer.php index a6934adc..e4e63e88 100644 --- a/includes/Core/Customizer/Customizer.php +++ b/includes/Core/Customizer/Customizer.php @@ -28,7 +28,7 @@ class Customizer { * * @var array */ - public $content_types = []; + public $content_types = array(); /** * Get all the data required for a customizer @@ -65,18 +65,18 @@ public function get( $context, $content_types ) { * $social_network_title = wemail()->settings->social_networks->title(); */ - return [ + return array( 'siteURL' => site_url( '/' ), 'cdn' => wemail()->wemail_cdn, - 'contentTypes' => [ + 'contentTypes' => array( 'types' => $this->content_types, 'settings' => $this->get_content_type_settings(), - ], + ), 'shortcodes' => wemail()->shortcode->get(), 'shortcodeImg' => wemail()->wemail_cdn . '/images/shortcode.png', 'placeholderImage' => wemail()->wemail_cdn . '/images/placeholder-image.png', 'dividers' => $this->dividers(), - ]; + ); } /** @@ -105,58 +105,58 @@ function ( $content_type ) { * @return array */ public function dividers() { - return [ + return array( 'baseURL' => wemail()->wemail_cdn . '/images/dividers/', - 'images' => [ - [ + 'images' => array( + array( 'name' => 'brush-stroke-lite.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'brush-stroke-orange.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'dotted-line.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'handwritten-swirl-black.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'handwritten-swirl-cayan.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'mail-ribbon.png', 'height' => '3px', - ], - [ + ), + array( 'name' => 'ornamental-1.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'ornamental-2.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'ornamental-3.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'shadow-1.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'shadow-2.png', 'height' => '24px', - ], - [ + ), + array( 'name' => 'star.png', 'height' => '24px', - ], - ], - ]; + ), + ), + ); } } diff --git a/includes/Core/Ecommerce/Ecommerce.php b/includes/Core/Ecommerce/Ecommerce.php index e09b88c0..247e4475 100644 --- a/includes/Core/Ecommerce/Ecommerce.php +++ b/includes/Core/Ecommerce/Ecommerce.php @@ -10,10 +10,10 @@ class Ecommerce { use Singleton; - protected $platforms = [ + protected $platforms = array( 'woocommerce' => WooCommerce::class, 'edd' => EDD::class, - ]; + ); /** * @param $platform diff --git a/includes/Core/Ecommerce/Platforms/EDD.php b/includes/Core/Ecommerce/Platforms/EDD.php index b9adcc95..52bfa251 100644 --- a/includes/Core/Ecommerce/Platforms/EDD.php +++ b/includes/Core/Ecommerce/Platforms/EDD.php @@ -22,10 +22,10 @@ class EDD extends AbstractPlatform { /** * @var null|array */ - protected $orders = [ - 'trash' => [], - 'restore' => [], - ]; + protected $orders = array( + 'trash' => array(), + 'restore' => array(), + ); /** * Currency name @@ -52,12 +52,12 @@ public function currency_symbol() { * * @return array */ - public function products( array $args = [] ) { + public function products( array $args = array() ) { $args = wp_parse_args( - $args, [ + $args, array( 'page' => 1, 'limit' => 50, - ] + ) ); $query = new WP_Query( @@ -68,12 +68,12 @@ public function products( array $args = [] ) { ) ); - return [ + return array( 'data' => ProductResource::collection( $query->get_posts() ), 'total' => $query->found_posts, 'current_page' => intval( $args['page'] ), 'total_page' => $query->max_num_pages, - ]; + ); } /** @@ -83,40 +83,40 @@ public function products( array $args = [] ) { * * @return array */ - public function orders( array $args = [] ) { + public function orders( array $args = array() ) { if ( $this->is_version_v3() ) { return $this->orders_v3( $args ); } $args = wp_parse_args( $args, - [ + array( 'posts_per_page' => isset( $args['limit'] ) ? intval( $args['limit'] ) : 50, 'paged' => isset( $args['page'] ) ? intval( $args['page'] ) : 1, 'post_type' => 'edd_payment', - 'post_status' => [ 'publish', 'pending' ], - ] + 'post_status' => array( 'publish', 'pending' ), + ) ); if ( isset( $args['after_updated'] ) ) { - $args['date_query'] = [ - [ + $args['date_query'] = array( + array( 'column' => 'post_modified_gmt', 'after' => gmdate( 'Y-m-d H:i:s', $args['after_updated'] ), - ], - ]; + ), + ); } $payments = new WP_Query( $args ); $data = OrderResource::collection( $payments->get_posts() ); - return [ + return array( 'data' => $data, 'total' => $payments->found_posts, 'current_page' => intval( $args['paged'] ), 'total_page' => $payments->max_num_pages, - ]; + ); } /** @@ -126,14 +126,14 @@ public function orders( array $args = [] ) { * * @return array */ - public function orders_v3( array $args = [] ) { + public function orders_v3( array $args = array() ) { $args = wp_parse_args( - $args, [ + $args, array( 'number' => isset( $args['limit'] ) ? intval( $args['limit'] ) : 50, 'page' => isset( $args['page'] ) ? intval( $args['page'] ) : 1, - 'type' => [ 'sale', 'refund' ], + 'type' => array( 'sale', 'refund' ), 'orderby' => 'date_modified', - ] + ) ); if ( isset( $args['limit'] ) ) { @@ -141,24 +141,24 @@ public function orders_v3( array $args = [] ) { } if ( isset( $args['after_updated'] ) ) { - $args['date_query'] = [ - [ + $args['date_query'] = array( + array( 'after' => gmdate( 'Y-m-d H:i:s', (int) $args['after_updated'] ), 'column' => 'date_modified', 'inclusive' => true, - ], - ]; + ), + ); unset( $args['after_updated'] ); } $data = edd_get_payments( $args ); - return [ + return array( 'data' => OrderResourceV3::collection( $data ), 'current_page' => intval( $args['page'] ), 'total_page' => empty( $data ) ? intval( $args['page'] ) : 'next', - ]; + ); } /** @@ -168,17 +168,17 @@ public function orders_v3( array $args = [] ) { * * @return array */ - public function categories( array $args = [] ) { + public function categories( array $args = array() ) { $terms = get_terms( - [ + array( 'taxonomy' => 'download_category', 'hide_empty' => false, - ] + ) ); - return [ + return array( 'data' => CategoryResource::collection( $terms ), - ]; + ); } /** @@ -187,16 +187,16 @@ public function categories( array $args = [] ) { * @return void */ public function register_hooks() { - add_action( 'post_updated', [ $this, 'handle_product' ], 10, 2 ); + add_action( 'post_updated', array( $this, 'handle_product' ), 10, 2 ); if ( $this->is_version_v3() ) { - add_action( 'edd_refund_order', [ $this, 'handle_refund' ], 10, 2 ); - add_action( 'edd_update_payment_status', [ $this, 'sync_order_v3' ], 10, 3 ); - add_action( 'edd_complete_purchase', [ $this, 'completed_order_v3' ], 10, 2 ); + add_action( 'edd_refund_order', array( $this, 'handle_refund' ), 10, 2 ); + add_action( 'edd_update_payment_status', array( $this, 'sync_order_v3' ), 10, 3 ); + add_action( 'edd_complete_purchase', array( $this, 'completed_order_v3' ), 10, 2 ); } else { - add_action( 'after_delete_post', [ $this, 'delete_item' ], 10, 2 ); - add_action( 'edd_complete_purchase', [ $this, 'handle_order' ], 10, 2 ); - add_action( 'edd_update_payment_status', [ $this, 'handle_order' ] ); + add_action( 'after_delete_post', array( $this, 'delete_item' ), 10, 2 ); + add_action( 'edd_complete_purchase', array( $this, 'handle_order' ), 10, 2 ); + add_action( 'edd_update_payment_status', array( $this, 'handle_order' ) ); } } @@ -274,7 +274,7 @@ public function completed_order_v3( $order_id, EDD_Payment $payment ) { */ public function sync_order_v3( $payment_id, $new_status, $old_status ) { if ( ! $this->registered_shutdown ) { - add_action( 'shutdown', [ $this, 'on_shutdown' ] ); + add_action( 'shutdown', array( $this, 'on_shutdown' ) ); $this->registered_shutdown = true; } @@ -351,9 +351,9 @@ public function delete_item( $post_id, WP_Post $post ) { ->products( $post_id ) ->send_json() ->post( - [ + array( '_method' => 'delete', - ] + ) ); } @@ -363,9 +363,9 @@ public function delete_item( $post_id, WP_Post $post ) { ->orders( $post_id ) ->send_json() ->post( - [ + array( '_method' => 'delete', - ] + ) ); } } @@ -483,6 +483,6 @@ protected function delete_version_3_payment( $payment_id ) { $module->orders( $payment->transaction_id ); } - $module->post( [ '_method' => 'delete' ] ); + $module->post( array( '_method' => 'delete' ) ); } } diff --git a/includes/Core/Ecommerce/Platforms/PlatformInterface.php b/includes/Core/Ecommerce/Platforms/PlatformInterface.php index a4c2a6b8..2ed79b44 100644 --- a/includes/Core/Ecommerce/Platforms/PlatformInterface.php +++ b/includes/Core/Ecommerce/Platforms/PlatformInterface.php @@ -9,11 +9,11 @@ public function currency(); public function currency_symbol(); - public function products( array $args = []); + public function products( array $args = array() ); - public function orders( array $args = [] ); + public function orders( array $args = array() ); - public function categories( array $args = [] ); + public function categories( array $args = array() ); public function register_hooks(); diff --git a/includes/Core/Ecommerce/Platforms/WooCommerce.php b/includes/Core/Ecommerce/Platforms/WooCommerce.php index 24cf5b81..e57b00b6 100644 --- a/includes/Core/Ecommerce/Platforms/WooCommerce.php +++ b/includes/Core/Ecommerce/Platforms/WooCommerce.php @@ -38,26 +38,26 @@ public function currency_symbol() { * * @return array */ - public function products( array $args = [] ) { + public function products( array $args = array() ) { $args = wp_parse_args( $args, - [ + array( 'limit' => isset( $args['limit'] ) ? intval( $args['limit'] ) : 50, 'page' => isset( $args['page'] ) ? intval( $args['page'] ) : 1, 'status' => isset( $args['status'] ) ? $args['status'] : null, 'paginate' => true, - 'type' => array_unique( array_merge( [ 'variation' ], array_keys( wc_get_product_types() ) ) ), - ] + 'type' => array_unique( array_merge( array( 'variation' ), array_keys( wc_get_product_types() ) ) ), + ) ); $products = wc_get_products( $args ); - return [ + return array( 'data' => ProductResource::collection( $products->products ), 'total' => $products->total, 'current_page' => intval( $args['page'] ), 'total_page' => $products->max_num_pages, - ]; + ); } /** @@ -67,16 +67,16 @@ public function products( array $args = [] ) { * * @return array */ - public function orders( array $args = [] ) { + public function orders( array $args = array() ) { $args = wp_parse_args( $args, - [ + array( 'limit' => isset( $args['limit'] ) ? intval( $args['limit'] ) : 50, 'page' => isset( $args['page'] ) ? intval( $args['page'] ) : 1, 'paginate' => true, - 'status' => [ 'completed', 'refunded', 'on-hold', 'processing', 'cancelled', 'failed' ], - 'type' => [ 'shop_order', 'shop_order_refund' ], - ] + 'status' => array( 'completed', 'refunded', 'on-hold', 'processing', 'cancelled', 'failed' ), + 'type' => array( 'shop_order', 'shop_order_refund' ), + ) ); if ( isset( $args['after_updated'] ) ) { @@ -86,27 +86,27 @@ public function orders( array $args = [] ) { $data = wc_get_orders( $args ); - return [ + return array( 'data' => OrderResource::collection( $data->orders ), 'total' => $data->total, 'current_page' => intval( $args['page'] ), 'total_page' => $data->max_num_pages, - ]; + ); } /** * Register post update hooks */ public function register_hooks() { - add_action( 'woocommerce_order_status_changed', [ $this, 'handle_order' ], 10, 4 ); - add_action( 'woocommerce_order_refunded', [ $this, 'create_order_refund' ], 10, 2 ); - add_action( 'woocommerce_refund_deleted', [ $this, 'delete_order_refund' ], 10, 2 ); - add_action( 'after_delete_post', [ $this, 'delete' ], 10, 2 ); - add_action( 'woocommerce_update_product', [ $this, 'handle_update_product' ], 10, 2 ); - add_action( 'woocommerce_new_product', [ $this, 'handle_product' ], 10, 2 ); - add_action( 'woocommerce_new_product_variation', [ $this, 'handle_product_variation' ] ); - add_action( 'woocommerce_update_product_variation', [ $this, 'handle_product_variation' ] ); - add_action( 'woocommerce_delete_product_variation', [ $this, 'delete_product_variation' ] ); + add_action( 'woocommerce_order_status_changed', array( $this, 'handle_order' ), 10, 4 ); + add_action( 'woocommerce_order_refunded', array( $this, 'create_order_refund' ), 10, 2 ); + add_action( 'woocommerce_refund_deleted', array( $this, 'delete_order_refund' ), 10, 2 ); + add_action( 'after_delete_post', array( $this, 'delete' ), 10, 2 ); + add_action( 'woocommerce_update_product', array( $this, 'handle_update_product' ), 10, 2 ); + add_action( 'woocommerce_new_product', array( $this, 'handle_product' ), 10, 2 ); + add_action( 'woocommerce_new_product_variation', array( $this, 'handle_product_variation' ) ); + add_action( 'woocommerce_update_product_variation', array( $this, 'handle_product_variation' ) ); + add_action( 'woocommerce_delete_product_variation', array( $this, 'delete_product_variation' ) ); } /** @@ -161,7 +161,7 @@ public function handle_update_product( $id, $product ) { $this->handle_product( $id, $product ); $variations = $product->get_children(); - $variants = []; + $variants = array(); if ( $product->is_type( 'variable' ) && ! empty( $variations ) ) { foreach ( $variations as $variation ) { @@ -233,9 +233,9 @@ public function delete_order_refund( $refund_id, $order_id ) { ->orders( $order_id ) ->refunds( $refund_id ) ->post( - [ + array( '_method' => 'delete', - ] + ) ); } @@ -260,9 +260,9 @@ public function delete( $post_id, WP_Post $post ) { ->ecommerce() ->products( $post_id ) ->post( - [ + array( '_method' => 'delete', - ] + ) ); } @@ -272,9 +272,9 @@ public function delete( $post_id, WP_Post $post ) { ->ecommerce() ->orders( $post_id ) ->post( - [ + array( '_method' => 'delete', - ] + ) ); } } @@ -284,9 +284,9 @@ public function delete_product_variation( $variation_id ) { ->ecommerce() ->products( $variation_id ) ->post( - [ + array( '_method' => 'delete', - ] + ) ); } @@ -316,17 +316,17 @@ public function get_name() { * * @return array */ - public function categories( array $args = [] ) { + public function categories( array $args = array() ) { $terms = get_terms( - [ + array( 'taxonomy' => 'product_cat', 'hide_empty' => false, - ] + ) ); - return [ + return array( 'data' => CategoryResource::collection( $terms ), - ]; + ); } /** diff --git a/includes/Core/Ecommerce/Settings.php b/includes/Core/Ecommerce/Settings.php index 80091788..051e246c 100644 --- a/includes/Core/Ecommerce/Settings.php +++ b/includes/Core/Ecommerce/Settings.php @@ -27,7 +27,7 @@ class Settings { */ public function get() { if ( is_null( $this->settings ) ) { - $this->settings = get_option( $this->option_name, [] ); + $this->settings = get_option( $this->option_name, array() ); } return $this->settings; diff --git a/includes/Core/Form/Form.php b/includes/Core/Form/Form.php index a3af8b93..8621c806 100644 --- a/includes/Core/Form/Form.php +++ b/includes/Core/Form/Form.php @@ -61,7 +61,7 @@ public function items() { $forms = wemail()->api->forms()->items()->get(); if ( is_wp_error( $forms ) ) { - return []; + return array(); } elseif ( ! empty( $forms['data'] ) ) { return $forms['data']; } @@ -93,7 +93,7 @@ public function submit( $id, $data ) { * @return array */ public function integrations() { - return [ + return array( 'contact_form_7' => __( 'Contact Form 7', 'wemail' ), 'gravity_forms' => __( 'Gravity Forms', 'wemail' ), 'wpforms' => __( 'WPForms', 'wemail' ), @@ -109,11 +109,11 @@ public function integrations() { 'forminator_forms' => __( 'Forminator Forms', 'wemail' ), 'everest_forms' => __( 'Everest Forms', 'wemail' ), 'elementor_forms' => __( 'Elementor Forms', 'wemail' ), - ]; + ); } public function increment_visitor_count( $form_id ) { - $form = wemail()->api->forms( $form_id )->visitors()->put( [] ); + $form = wemail()->api->forms( $form_id )->visitors()->put( array() ); return $form; } @@ -128,9 +128,9 @@ public function increment_visitor_count( $form_id ) { public function create( $data ) { global $wpdb; - $data = $this->fillable_check( $data, [ 'id', 'name', 'template', 'settings', 'type' ] ); + $data = $this->fillable_check( $data, array( 'id', 'name', 'template', 'settings', 'type' ) ); - $data = array_merge( $data, [ 'plugin_version' => wemail()->version ] ); + $data = array_merge( $data, array( 'plugin_version' => wemail()->version ) ); $this->to_json_string( $data ); @@ -152,10 +152,10 @@ public function update( $data, $id ) { $data = $this->fillable_check( $data, - [ 'name', 'template', 'settings', 'type', 'status', 'deleted_at' ] + array( 'name', 'template', 'settings', 'type', 'status', 'deleted_at' ) ); - $data = array_merge( $data, [ 'plugin_version' => wemail()->version ] ); + $data = array_merge( $data, array( 'plugin_version' => wemail()->version ) ); $this->to_json_string( $data ); @@ -195,7 +195,7 @@ public function delete( $ids, $soft_delete = false ) { $ids = (array) $ids; if ( $soft_delete ) { - return $this->update( [ 'deleted_at' => current_time( 'mysql' ) ], $ids ); + return $this->update( array( 'deleted_at' => current_time( 'mysql' ) ), $ids ); } $ids_string = $this->in_sql( $ids ); @@ -211,14 +211,14 @@ public function delete( $ids, $soft_delete = false ) { * * @return array|array[] */ - public function get_forms( $args = [] ) { + public function get_forms( $args = array() ) { global $wpdb; $args = array_merge( - [ - 'type' => [ 'floating-bar', 'floating-box', 'modal' ], - 'select' => [ '*' ], - ], + array( + 'type' => array( 'floating-bar', 'floating-box', 'modal' ), + 'select' => array( '*' ), + ), $args ); @@ -226,7 +226,7 @@ public function get_forms( $args = [] ) { $forms = $wpdb->get_results( "SELECT {$this->in_sql( $args['select'], false )} FROM {$this->get_table()} WHERE `type` IN ({$this->in_sql( $args['type'] )}) AND `status` = 1 AND `deleted_at` IS NULL", ARRAY_A ); if ( is_null( $forms ) ) { - return []; + return array(); } foreach ( $forms as $index => $form ) { @@ -246,11 +246,11 @@ public function sync() { global $wpdb; $forms = $this->all( - [ + array( 'per_page' => -1, 'with_trashed' => 1, 'fields' => 'id,name,template,settings,plugin_version,type,status,deleted_at', - ] + ) ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared @@ -308,7 +308,7 @@ function ( $form ) use ( $new_ids ) { * @param $data * @param string[] $columns */ - protected function to_json_string( &$data, $columns = [ 'template', 'settings' ] ) { + protected function to_json_string( &$data, $columns = array( 'template', 'settings' ) ) { foreach ( $columns as $column ) { if ( isset( $data[ $column ] ) ) { $data[ $column ] = wp_json_encode( $data[ $column ] ); @@ -335,7 +335,7 @@ protected function get_table() { * * @return array */ - protected function fillable_check( $data, $columns = [] ) { + protected function fillable_check( $data, $columns = array() ) { return array_filter( $data, function ( $value, $key ) use ( $columns ) { diff --git a/includes/Core/Form/Integrations/AbstractIntegration.php b/includes/Core/Form/Integrations/AbstractIntegration.php index f1f499c4..2a34de16 100644 --- a/includes/Core/Form/Integrations/AbstractIntegration.php +++ b/includes/Core/Form/Integrations/AbstractIntegration.php @@ -51,7 +51,7 @@ public function inactivity_message() { 'integration_is_not_active', /* translators: %s: search term */ sprintf( __( '%s plugin is not active', 'wemail' ), $this->title ), - [ 'status' => 422 ] + array( 'status' => 422 ) ); } @@ -87,10 +87,10 @@ public function cast_form_id( $form_id ) { * @return array|\WP_Error */ public function save( $data ) { - $data = ! empty( $data ) ? $data : []; + $data = ! empty( $data ) ? $data : array(); - $settings = []; - $form_ids = []; + $settings = array(); + $form_ids = array(); foreach ( $data as $form ) { if ( ! isset( $form['id'] ) || empty( $form['map'] ) ) { @@ -103,12 +103,12 @@ public function save( $data ) { $form_id = $this->slug === 'elementor_forms' ? $form['id'] : $this->cast_form_id( $form['id'] ); - $settings[] = [ + $settings[] = array( 'id' => $form_id, 'list_id' => $form['list_id'], 'overwrite' => $form['overwrite'], 'map' => $form['map'], - ]; + ); $form_ids[] = $form_id; } @@ -123,5 +123,4 @@ public function save( $data ) { return $response; } - } diff --git a/includes/Core/Form/Integrations/CalderaForms.php b/includes/Core/Form/Integrations/CalderaForms.php index 88004429..b1018a6c 100644 --- a/includes/Core/Form/Integrations/CalderaForms.php +++ b/includes/Core/Form/Integrations/CalderaForms.php @@ -62,24 +62,24 @@ public function cast_form_id( $form_id ) { * @return array */ public function forms() { - $forms = []; + $forms = array(); $caldera_forms = \Caldera_Forms_Forms::get_forms( true ); foreach ( $caldera_forms as $form_id => $caldera_form ) { $form_details = \Caldera_Forms_Forms::get_form( $caldera_form['ID'] ); - $form = [ + $form = array( 'id' => $this->cast_form_id( $caldera_form['ID'] ), 'title' => $caldera_form['name'], - 'fields' => [], - ]; + 'fields' => array(), + ); foreach ( $form_details['fields'] as $caldera_form_field_id => $caldera_form_field ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $caldera_form_field_id, 'label' => $caldera_form_field['label'], - ]; + ); } $forms[] = $form; @@ -105,15 +105,15 @@ public function submit( $form, $referrer, $process_id, $entryid ) { $form_id = $form['ID']; - $settings = get_option( 'wemail_form_integration_caldera_forms', [] ); + $settings = get_option( 'wemail_form_integration_caldera_forms', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, - ]; + ); $posted_data = $processed_data[ $form_id ]; @@ -126,5 +126,4 @@ public function submit( $form, $referrer, $process_id, $entryid ) { wemail()->api->forms()->integrations( 'caldera-forms' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Integrations/ContactForm7.php b/includes/Core/Form/Integrations/ContactForm7.php index be157075..3015c2be 100644 --- a/includes/Core/Form/Integrations/ContactForm7.php +++ b/includes/Core/Form/Integrations/ContactForm7.php @@ -49,12 +49,12 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); - $args = [ + $args = array( 'post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1, - ]; + ); $cf7_query = new WP_Query( $args ); @@ -68,17 +68,17 @@ public function forms() { $cf7 = \WPCF7_ContactForm::get_instance( $post->ID ); - $form = [ + $form = array( 'id' => $post->ID, 'title' => $post->post_title, - 'fields' => [], - ]; + 'fields' => array(), + ); foreach ( $cf7->collect_mail_tags() as $tag ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $tag, 'label' => "[{$tag}]", - ]; + ); } $forms[] = $form; @@ -105,7 +105,7 @@ public function submit( $wpcf7, $result ) { $form_id = $wpcf7->id(); - $settings = get_option( 'wemail_form_integration_contact_form_7', [] ); + $settings = get_option( 'wemail_form_integration_contact_form_7', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; @@ -115,9 +115,9 @@ public function submit( $wpcf7, $result ) { $submission = \WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); - $data = [ + $data = array( 'id' => $form_id, - ]; + ); foreach ( $form_tags as $form_tag ) { $tag = $form_tag->name; @@ -132,5 +132,4 @@ public function submit( $wpcf7, $result ) { wemail()->api->forms()->integrations( 'contact-form-7' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Integrations/ElementorForms.php b/includes/Core/Form/Integrations/ElementorForms.php index 46b2e526..c77aa292 100644 --- a/includes/Core/Form/Integrations/ElementorForms.php +++ b/includes/Core/Form/Integrations/ElementorForms.php @@ -50,7 +50,7 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $args = array( 'post_type' => 'any', @@ -74,11 +74,11 @@ public function forms() { foreach ( $item->elements as $element ) { foreach ( $element->elements as $final_element ) { if ( isset( $final_element->{'widgetType'} ) && $final_element->{'widgetType'} === 'form' ) { - $forms[] = [ + $forms[] = array( 'id' => $final_element->id, 'title' => $this->getTitle( $final_element->id, $final_element->settings->form_name ), 'fields' => $this->get_fields( $final_element->settings->form_fields ), - ]; + ); } } } @@ -86,7 +86,7 @@ public function forms() { } } return array_filter( - $forms, function( $form ) { + $forms, function ( $form ) { return ! empty( $form['fields'] ); } ); @@ -106,13 +106,13 @@ public function getTitle( $id, $name ) { * @return mixed */ public function get_fields( $form_fields ) { - $fields = []; + $fields = array(); foreach ( $form_fields as $field ) { - $fields[] = [ + $fields[] = array( 'id' => $field->custom_id, 'label' => isset( $field->field_label ) ? $field->field_label : $field->custom_id . ' (Set label)', - ]; + ); } return $fields; @@ -126,27 +126,26 @@ public function get_fields( $form_fields ) { */ public function submit( $record, $handler ) { $raw_fields = $record->get( 'fields' ); - $fields = []; + $fields = array(); $form_id = $record->get( 'form_settings' )['id']; foreach ( $raw_fields as $id => $field ) { $fields[ $id ] = $field['value']; } - $settings = get_option( 'wemail_form_integration_elementor_forms', [] ); + $settings = get_option( 'wemail_form_integration_elementor_forms', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; } - $entities = [ + $entities = array( 'id' => $form_id, 'data' => $fields, - ]; + ); if ( ! empty( $entities['data'] ) ) { wemail_set_owner_api_key(); wemail()->api->forms()->integrations( 'elementor_forms' )->submit()->post( $entities ); } } - } diff --git a/includes/Core/Form/Integrations/EverestForms.php b/includes/Core/Form/Integrations/EverestForms.php index 22bf79c7..d5f0d54d 100644 --- a/includes/Core/Form/Integrations/EverestForms.php +++ b/includes/Core/Form/Integrations/EverestForms.php @@ -49,27 +49,27 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $query = new WP_Query( - [ + array( 'post_type' => 'everest_form', 'post_per_page' => -1, - ] + ) ); while ( $query->have_posts() ) { $query->the_post(); global $post; - $forms[] = [ + $forms[] = array( 'id' => absint( $post->ID ), 'title' => $post->post_title, 'fields' => $this->get_fields( $post ), - ]; + ); } return array_filter( - $forms, function( $form ) { + $forms, function ( $form ) { return ! empty( $form['fields'] ); } ); @@ -80,7 +80,7 @@ public function forms() { * @return mixed */ public function get_fields( $post ) { - $fields = []; + $fields = array(); $content = json_decode( $post->post_content ); @@ -90,10 +90,10 @@ public function get_fields( $post ) { $get_columns = get_object_vars( $content->form_fields ); foreach ( $get_columns as $get_column ) { - $fields[] = [ + $fields[] = array( 'id' => $get_column->id, 'label' => $get_column->label, - ]; + ); } return $fields; @@ -108,21 +108,20 @@ public function get_fields( $post ) { public function submit( $data, $entry ) { $this->data = $entry['form_fields']; - $settings = get_option( 'wemail_form_integration_everest_forms', [] ); + $settings = get_option( 'wemail_form_integration_everest_forms', array() ); if ( ! in_array( (int) $entry['id'], $settings, true ) ) { return; } - $entities = [ + $entities = array( 'id' => $entry['id'], 'data' => $this->data, - ]; + ); if ( ! empty( $entities['data'] ) ) { wemail_set_owner_api_key(); wemail()->api->forms()->integrations( 'everest_forms' )->submit()->post( $entities ); } } - } diff --git a/includes/Core/Form/Integrations/FluentForms.php b/includes/Core/Form/Integrations/FluentForms.php index 17893eec..d1330854 100644 --- a/includes/Core/Form/Integrations/FluentForms.php +++ b/includes/Core/Form/Integrations/FluentForms.php @@ -40,11 +40,11 @@ public function forms() { return array_map( function ( $form ) { - return [ + return array( 'id' => absint( $form->id ), 'title' => $form->title, 'fields' => $this->transform_form_fields( json_decode( $form->form_fields, true ) ), - ]; + ); }, $forms ); @@ -58,7 +58,7 @@ function ( $form ) { * @return array */ protected function transform_form_fields( $fields ) { - $data = []; + $data = array(); foreach ( $fields['fields'] as $field ) { if ( $field['element'] === 'container' ) { @@ -93,15 +93,15 @@ protected function transform_form_fields( $fields ) { * @param $data */ public function submit( $data ) { - $settings = get_option( 'wemail_form_integration_fluent_forms', [] ); + $settings = get_option( 'wemail_form_integration_fluent_forms', array() ); if ( ! in_array( intval( $data['form_id'] ), $settings, true ) ) { return; } - $submission = [ + $submission = array( 'id' => $data['form_id'], - ]; + ); $submission['data'] = $this->get_submissions( json_decode( $data['response'], true ) ); @@ -130,7 +130,7 @@ protected function has_sub_fields( $field ) { * @return array */ protected function get_sub_fields( $field ) { - $data = []; + $data = array(); foreach ( $field['fields'] as $sub_field ) { if ( ! array_key_exists( 'name', $sub_field['attributes'] ) ) { @@ -151,7 +151,7 @@ protected function get_sub_fields( $field ) { * @return string */ protected function get_label( $label ) { - return ucwords( str_replace( [ '-', '_' ], [ ' ', ' ' ], $label ) ); + return ucwords( str_replace( array( '-', '_' ), array( ' ', ' ' ), $label ) ); } /** @@ -163,13 +163,13 @@ protected function get_label( $label ) { * @return array */ protected function get_submissions( $response ) { - foreach ( [ '__fluent_form_embded_post_id', '_fluentform_1_fluentformnonce', '_wp_http_referer' ] as $field ) { + foreach ( array( '__fluent_form_embded_post_id', '_fluentform_1_fluentformnonce', '_wp_http_referer' ) as $field ) { if ( array_key_exists( $field, $response ) ) { unset( $response[ $field ] ); } } - $data = []; + $data = array(); foreach ( $response as $field => $value ) { if ( is_array( $value ) ) { @@ -188,10 +188,10 @@ protected function get_submissions( $response ) { * @return array */ public function getData( $name, array $data ) { - $data[] = [ + $data[] = array( 'id' => $name, 'label' => $this->get_label( $name ), - ]; + ); return $data; } } diff --git a/includes/Core/Form/Integrations/FormidableForms.php b/includes/Core/Form/Integrations/FormidableForms.php index 3b109721..480dfb1d 100644 --- a/includes/Core/Form/Integrations/FormidableForms.php +++ b/includes/Core/Form/Integrations/FormidableForms.php @@ -33,19 +33,19 @@ public function boot() { * @return array */ public function forms() { - $forms = FrmDb::get_results( 'frm_forms', [], 'id,name' ); + $forms = FrmDb::get_results( 'frm_forms', array(), 'id,name' ); if ( ! is_array( $forms ) ) { - return []; + return array(); } return array_map( function ( $form ) { - return [ + return array( 'id' => absint( $form->id ), 'title' => $form->name, 'fields' => $this->get_form_fields( $form->id ), - ]; + ); }, $forms ); @@ -61,21 +61,21 @@ function ( $form ) { protected function get_form_fields( $form_id ) { $fields = FrmDb::get_results( 'frm_fields', - [ + array( 'form_id' => $form_id, - ], 'id,name' + ), 'id,name' ); if ( ! is_array( $fields ) ) { - return []; + return array(); } return array_map( function ( $field ) { - return [ + return array( 'id' => $field->id, 'label' => $field->name, - ]; + ); }, $fields ); } @@ -86,17 +86,17 @@ function ( $field ) { * @param $data */ public function submit( $data ) { - $forms = get_option( 'wemail_form_integration_formidable_forms', [] ); + $forms = get_option( 'wemail_form_integration_formidable_forms', array() ); $form_id = absint( $data['form']->id ); if ( ! in_array( $form_id, $forms, true ) ) { return; } - $form_data = [ + $form_data = array( 'id' => $form_id, 'data' => $this->get_entity_data( $data['entry_id'] ), - ]; + ); if ( ! empty( $form_data['data'] ) ) { wemail_set_owner_api_key(); @@ -114,14 +114,14 @@ public function submit( $data ) { protected function get_entity_data( $entity_id ) { $entities = FrmDb::get_results( 'frm_item_metas', - [ + array( 'item_id' => $entity_id, - ], + ), 'field_id,meta_value' ); if ( ! is_array( $entities ) ) { - return []; + return array(); } return array_column( $entities, 'meta_value', 'field_id' ); diff --git a/includes/Core/Form/Integrations/ForminatorForms.php b/includes/Core/Form/Integrations/ForminatorForms.php index f00d81f7..bd7b0923 100644 --- a/includes/Core/Form/Integrations/ForminatorForms.php +++ b/includes/Core/Form/Integrations/ForminatorForms.php @@ -27,12 +27,12 @@ public function boot() { * @inheritdoc */ public function forms() { - $forms = []; + $forms = array(); $query = new WP_Query( - [ + array( 'post_type' => 'forminator_forms', 'post_count' => -1, - ] + ) ); if ( ! $query->have_posts() ) { @@ -41,11 +41,11 @@ public function forms() { while ( $query->have_posts() ) { $query->the_post(); - $forms[] = [ + $forms[] = array( 'id' => get_the_ID(), 'title' => get_the_title(), 'fields' => $this->get_form_fields( get_the_ID() ), - ]; + ); } return $forms; @@ -60,20 +60,20 @@ public function forms() { protected function get_form_fields( $form_id ) { $form_meta = get_post_meta( $form_id, 'forminator_form_meta', true ); if ( ! $form_meta ) { - return []; + return array(); } - $fields = []; + $fields = array(); foreach ( $form_meta['fields'] as $field ) { if ( ! isset( $field['field_label'] ) ) { continue; } - $fields[] = [ + $fields[] = array( 'id' => $field['id'], 'label' => $field['field_label'], - ]; + ); } return $fields; } @@ -86,17 +86,17 @@ protected function get_form_fields( $form_id ) { * @param $form_data */ public function submit( $entry, $form_id, $form_data ) { - $forms = get_option( 'wemail_form_integration_forminator_forms', [] ); + $forms = get_option( 'wemail_form_integration_forminator_forms', array() ); $form_id = absint( $form_id ); if ( ! in_array( $form_id, $forms, true ) || empty( $form_data ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, 'data' => array_column( $form_data, 'value', 'name' ), - ]; + ); wemail_set_owner_api_key(); wemail()->api->forms()->integrations( 'forminator-forms' )->submit()->post( $data ); diff --git a/includes/Core/Form/Integrations/GravityForms.php b/includes/Core/Form/Integrations/GravityForms.php index 764b866f..d51c7a7a 100644 --- a/includes/Core/Form/Integrations/GravityForms.php +++ b/includes/Core/Form/Integrations/GravityForms.php @@ -48,17 +48,17 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $gf_forms = \GFFormsModel::get_forms( true ); foreach ( $gf_forms as $gf_form ) { $form_id = $this->cast_form_id( $gf_form->id ); - $form = [ + $form = array( 'id' => $form_id, 'title' => $gf_form->title, - 'fields' => [], - ]; + 'fields' => array(), + ); $form_meta = \GFFormsModel::get_form_meta( $form_id ); @@ -66,17 +66,17 @@ public function forms() { $field = \GF_Fields::create( $field ); if ( empty( $field['inputs'] ) ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $field->id, 'label' => $field->label, - ]; + ); } else { foreach ( $field['inputs'] as $i => $group_field ) { if ( empty( $group_field['isHidden'] ) ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $group_field['id'], 'label' => $group_field['label'], - ]; + ); } } } @@ -101,15 +101,15 @@ public function forms() { public function submit( $lead, $form ) { $form_id = $lead['form_id']; - $settings = get_option( 'wemail_form_integration_gravity_forms', [] ); + $settings = get_option( 'wemail_form_integration_gravity_forms', array() ); if ( ! in_array( (int) $form_id, $settings, true ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, - ]; + ); foreach ( $form['fields'] as $field ) { $field = \GF_Fields::create( $field ); @@ -130,5 +130,4 @@ public function submit( $lead, $form ) { wemail()->api->forms()->integrations( 'gravity-forms' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Integrations/HappyForms.php b/includes/Core/Form/Integrations/HappyForms.php index 67b24d13..be73b9ee 100644 --- a/includes/Core/Form/Integrations/HappyForms.php +++ b/includes/Core/Form/Integrations/HappyForms.php @@ -28,7 +28,7 @@ class HappyForms extends AbstractIntegration { * * @var array $data */ - public $data = []; + public $data = array(); /** * Checking plugin is active or not @@ -43,24 +43,24 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $query = new WP_Query( - [ + array( 'post_type' => 'happyform', 'posts_per_page' => -1, - ] + ) ); while ( $query->have_posts() ) { $query->the_post(); global $post; - $forms[] = [ + $forms[] = array( 'id' => absint( $post->ID ), 'title' => $post->post_title, 'fields' => $this->get_fields( $post->ID ), - ]; + ); } return $forms; @@ -74,7 +74,7 @@ public function forms() { * @return array */ protected function get_fields( $post_id ) { - $fields = []; + $fields = array(); $data = get_post_meta( $post_id ); @@ -101,10 +101,10 @@ protected function get_fields( $post_id ) { * @return array */ protected function get_field( $field ) { - return [ + return array( 'id' => $field['id'], 'label' => $field['label'], - ]; + ); } /** @@ -115,7 +115,7 @@ protected function get_field( $field ) { * @return array */ protected function get_columns( $layouts ) { - $columns = []; + $columns = array(); foreach ( $layouts as $layout ) { $columns = array_merge( $columns, unserialize( $layout ) ); @@ -132,7 +132,7 @@ protected function get_columns( $layouts ) { public function submit( $data ) { $this->data = $data; - add_action( 'happyforms_form_submit_after', [ $this, 'subscribe' ] ); + add_action( 'happyforms_form_submit_after', array( $this, 'subscribe' ) ); } /** @@ -141,16 +141,16 @@ public function submit( $data ) { * @param $form */ public function subscribe( $form ) { - $form_ids = get_option( 'wemail_form_integration_happy_forms', [] ); + $form_ids = get_option( 'wemail_form_integration_happy_forms', array() ); if ( ! in_array( $form['ID'], $form_ids, true ) ) { return; } - $data = [ + $data = array( 'id' => $form['ID'], 'data' => $this->data, - ]; + ); if ( ! empty( $data['data'] ) ) { wemail_set_owner_api_key(); diff --git a/includes/Core/Form/Integrations/Hooks.php b/includes/Core/Form/Integrations/Hooks.php index 5a01234f..797c3a4b 100644 --- a/includes/Core/Form/Integrations/Hooks.php +++ b/includes/Core/Form/Integrations/Hooks.php @@ -12,19 +12,19 @@ class Hooks { * @return void */ public function __construct() { - add_action( 'wpcf7_submit', [ ContactForm7::instance(), 'submit' ], 999, 2 ); - add_action( 'gform_after_submission', [ GravityForms::instance(), 'submit' ], 999, 2 ); - add_action( 'wpforms_process_complete', [ Wpforms::instance(), 'submit' ], 999, 4 ); - add_action( 'caldera_forms_submit_complete', [ CalderaForms::instance(), 'submit' ], 999, 4 ); - add_action( 'weforms_entry_submission', [ Weforms::instance(), 'submit' ], 999, 4 ); - add_action( 'nf_save_sub', [ NinjaForms::instance(), 'submit' ], 999, 1 ); - add_action( 'fluentform_before_insert_submission', [ FluentForms::instance(), 'submit' ], 999, 1 ); - add_action( 'happyforms_submission_success', [ HappyForms::instance(), 'submit' ], 999, 1 ); - add_action( 'frm_after_entry_processed', [ FormidableForms::instance(), 'submit' ], 999, 1 ); - add_action( 'wp_ajax_sgpb_process_after_submission', [ PopupBuilder::instance(), 'submit' ], 999, 1 ); - add_action( 'pum_sub_form_success', [ PopupMaker::instance(), 'submit' ], 999, 1 ); - add_action( 'forminator_custom_form_submit_before_set_fields', [ ForminatorForms::instance(), 'submit' ], 999, 3 ); - add_action( 'everest_forms_process', [ EverestForms::instance(), 'submit' ], 999, 3 ); - add_action( 'elementor_pro/forms/new_record', [ ElementorForms::instance(), 'submit' ], 999, 3 ); + add_action( 'wpcf7_submit', array( ContactForm7::instance(), 'submit' ), 999, 2 ); + add_action( 'gform_after_submission', array( GravityForms::instance(), 'submit' ), 999, 2 ); + add_action( 'wpforms_process_complete', array( Wpforms::instance(), 'submit' ), 999, 4 ); + add_action( 'caldera_forms_submit_complete', array( CalderaForms::instance(), 'submit' ), 999, 4 ); + add_action( 'weforms_entry_submission', array( Weforms::instance(), 'submit' ), 999, 4 ); + add_action( 'nf_save_sub', array( NinjaForms::instance(), 'submit' ), 999, 1 ); + add_action( 'fluentform_before_insert_submission', array( FluentForms::instance(), 'submit' ), 999, 1 ); + add_action( 'happyforms_submission_success', array( HappyForms::instance(), 'submit' ), 999, 1 ); + add_action( 'frm_after_entry_processed', array( FormidableForms::instance(), 'submit' ), 999, 1 ); + add_action( 'wp_ajax_sgpb_process_after_submission', array( PopupBuilder::instance(), 'submit' ), 999, 1 ); + add_action( 'pum_sub_form_success', array( PopupMaker::instance(), 'submit' ), 999, 1 ); + add_action( 'forminator_custom_form_submit_before_set_fields', array( ForminatorForms::instance(), 'submit' ), 999, 3 ); + add_action( 'everest_forms_process', array( EverestForms::instance(), 'submit' ), 999, 3 ); + add_action( 'elementor_pro/forms/new_record', array( ElementorForms::instance(), 'submit' ), 999, 3 ); } } diff --git a/includes/Core/Form/Integrations/NinjaForms.php b/includes/Core/Form/Integrations/NinjaForms.php index 258388d5..08f6a26f 100644 --- a/includes/Core/Form/Integrations/NinjaForms.php +++ b/includes/Core/Form/Integrations/NinjaForms.php @@ -52,7 +52,7 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $nf = Ninja_Forms(); $nf_forms = $nf->form()->get_forms(); @@ -62,20 +62,20 @@ public function forms() { $form_settings = $nform->get_settings(); $fields = $nf->form( $form_id )->get_fields(); - $form = [ + $form = array( 'id' => $form_id, 'title' => $form_settings['title'], - 'fields' => [], - ]; + 'fields' => array(), + ); foreach ( $fields as $field ) { $field_id = $field->get_id(); $field_settings = $field->get_settings(); - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $field_id, 'label' => $field_settings['label'], - ]; + ); } $forms[] = $form; @@ -98,15 +98,15 @@ public function submit( $sub_id ) { $form_id = $this->cast_form_id( $submission->get_form_id() ); - $settings = get_option( 'wemail_form_integration_ninja_forms', [] ); + $settings = get_option( 'wemail_form_integration_ninja_forms', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, - ]; + ); $field_values = $submission->get_field_values(); @@ -125,5 +125,4 @@ public function submit( $sub_id ) { wemail()->api->forms()->integrations( 'ninja-forms' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Integrations/PopupBuilder.php b/includes/Core/Form/Integrations/PopupBuilder.php index eba892a8..8bdb14d0 100644 --- a/includes/Core/Form/Integrations/PopupBuilder.php +++ b/includes/Core/Form/Integrations/PopupBuilder.php @@ -47,7 +47,7 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $subscription_popup = new SubscriptionPopup(); $subscription_popups = $subscription_popup->getAllSubscriptions(); @@ -57,11 +57,11 @@ public function forms() { } foreach ( $subscription_popups as $popup ) { - $forms[] = [ + $forms[] = array( 'id' => $popup->getId(), 'title' => $popup->getTitle() ? $popup->getTitle() : 'no title', 'fields' => $this->get_fields( $popup ), - ]; + ); } return $forms; @@ -77,12 +77,12 @@ public function forms() { protected function get_fields( $popup ) { $subs_fields = $popup->getOptionValue( 'sgpb-subs-fields' ); if ( empty( $subs_fields ) ) { - return []; + return array(); } - $fields = []; + $fields = array(); foreach ( $subs_fields as $key => $field ) { - if ( ! in_array( $field['attrs']['type'], [ 'text', 'email' ], true ) ) { + if ( ! in_array( $field['attrs']['type'], array( 'text', 'email' ), true ) ) { continue; } @@ -90,10 +90,10 @@ protected function get_fields( $popup ) { continue; } - $fields[] = [ + $fields[] = array( 'id' => $key, 'label' => $field['attrs']['placeholder'], - ]; + ); } return $fields; @@ -107,7 +107,7 @@ protected function get_fields( $popup ) { * @since 1.0.0 */ public function submit( $data ) { - $forms = get_option( 'wemail_form_integration_popup_builder', [] ); + $forms = get_option( 'wemail_form_integration_popup_builder', array() ); check_ajax_referer( SG_AJAX_NONCE, 'nonce' ); $sgpb_ajax = new Ajax(); @@ -121,16 +121,16 @@ public function submit( $data ) { $submission_data = $sgpb_ajax->getValueFromPost( 'formData' ); parse_str( $submission_data, $form_data ); - $user_data = [ + $user_data = array( 'email' => sanitize_email( $form_data['sgpb-subs-email'] ), 'first-name' => sanitize_text_field( $form_data['sgpb-subs-first-name'] ), 'last-name' => sanitize_text_field( $form_data['sgpb-subs-last-name'] ), - ]; + ); - $form_data = [ + $form_data = array( 'id' => $popup_post_id, 'data' => $user_data, - ]; + ); if ( ! empty( $form_data['data'] ) ) { wemail_set_owner_api_key(); diff --git a/includes/Core/Form/Integrations/PopupMaker.php b/includes/Core/Form/Integrations/PopupMaker.php index 12f9e952..d06ff070 100644 --- a/includes/Core/Form/Integrations/PopupMaker.php +++ b/includes/Core/Form/Integrations/PopupMaker.php @@ -47,7 +47,7 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $popups = pum_get_all_popups(); foreach ( $popups as $popup ) { @@ -56,11 +56,11 @@ public function forms() { continue; } - $forms[] = [ + $forms[] = array( 'id' => $popup->ID, 'title' => $popup->post_title ? $popup->post_title : 'no title', 'fields' => $fields, - ]; + ); } return $forms; @@ -80,7 +80,7 @@ private function get_fields( $content ) { return false; } - $fields = []; + $fields = array(); foreach ( $data as $item ) { $item = explode( '=', $item ); if ( ! isset( $item[0] ) ) { @@ -99,25 +99,25 @@ private function get_fields( $content ) { private function field_data( $data ) { switch ( $data ) { case 'label_fname': - return [ + return array( 'id' => 'first-name', 'label' => 'First Name', - ]; + ); case 'label_lname': - return [ + return array( 'id' => 'last-name', 'label' => 'Last Name', - ]; + ); case 'label_name': - return [ + return array( 'id' => 'name', 'label' => 'Name', - ]; + ); case 'label_email': - return [ + return array( 'id' => 'email', 'label' => 'Email', - ]; + ); default: return null; } @@ -135,22 +135,21 @@ public function submit( $values ) { return; } - $user_data = [ + $user_data = array( 'email' => isset( $values['email'] ) ? $values['email'] : '', 'name' => isset( $values['name'] ) ? $values['name'] : '', 'first-name' => isset( $values['fname'] ) ? $values['fname'] : '', 'last-name' => isset( $values['lname'] ) ? $values['lname'] : '', - ]; + ); - $form_data = [ + $form_data = array( 'id' => $values['popup_id'], 'data' => $user_data, - ]; + ); if ( ! empty( $form_data['data'] ) ) { wemail_set_owner_api_key(); wemail()->api->forms()->integrations( 'popup-maker' )->submit()->post( $form_data ); } } - } diff --git a/includes/Core/Form/Integrations/Rest.php b/includes/Core/Form/Integrations/Rest.php index 36f7fc02..0a0b6a41 100644 --- a/includes/Core/Form/Integrations/Rest.php +++ b/includes/Core/Form/Integrations/Rest.php @@ -24,7 +24,7 @@ class Rest extends RestController { * * @var array */ - private $integrations = []; + private $integrations = array(); /** * Magic method to create integration instances on demand @@ -68,12 +68,12 @@ public function register_routes() { * Get all integrations with status */ public function integrations( $request ) { - $integrations = []; + $integrations = array(); foreach ( wemail()->form->integrations() as $key => $integration ) { - $integrations[] = [ + $integrations[] = array( 'slug' => $key, 'is_active' => $this->$key->is_active, - ]; + ); } return $integrations; diff --git a/includes/Core/Form/Integrations/Weforms.php b/includes/Core/Form/Integrations/Weforms.php index 2090e9f2..ce6d2630 100644 --- a/includes/Core/Form/Integrations/Weforms.php +++ b/includes/Core/Form/Integrations/Weforms.php @@ -49,7 +49,7 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $weforms_forms = weforms()->form->all(); $weforms_forms = $weforms_forms['forms']; @@ -57,19 +57,19 @@ public function forms() { foreach ( $weforms_forms as $weforms_form ) { $form_id = $this->cast_form_id( $weforms_form->id ); - $form = [ + $form = array( 'id' => $form_id, 'title' => $weforms_form->name, - 'fields' => [], - ]; + 'fields' => array(), + ); $weforms_form_fields = $weforms_form->get_fields(); foreach ( $weforms_form_fields as $weforms_form_fields ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $weforms_form_fields['id'], 'label' => $weforms_form_fields['label'], - ]; + ); } $forms[] = $form; @@ -93,15 +93,15 @@ public function forms() { public function submit( $entry_id, $form_id, $page_id, $form_settings ) { $form_id = $this->cast_form_id( $form_id ); - $settings = get_option( 'wemail_form_integration_weforms', [] ); + $settings = get_option( 'wemail_form_integration_weforms', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, - ]; + ); $weforms_form = weforms()->form->get( $form_id ); @@ -119,5 +119,4 @@ public function submit( $entry_id, $form_id, $page_id, $form_settings ) { wemail()->api->forms()->integrations( 'weforms' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Integrations/Wpforms.php b/includes/Core/Form/Integrations/Wpforms.php index 7d4b7fde..42317c94 100644 --- a/includes/Core/Form/Integrations/Wpforms.php +++ b/includes/Core/Form/Integrations/Wpforms.php @@ -50,25 +50,25 @@ public function boot() { * @return array */ public function forms() { - $forms = []; + $forms = array(); $wpforms = wpforms()->form->get(); if ( ! empty( $wpforms ) ) { foreach ( $wpforms as $wpform ) { - $form = [ + $form = array( 'id' => $wpform->ID, 'title' => $wpform->post_title, - 'fields' => [], - ]; + 'fields' => array(), + ); $wpform_fields = wpforms_get_form_fields( $wpform ); foreach ( $wpform_fields as $wpform_field ) { - $form['fields'][] = [ + $form['fields'][] = array( 'id' => $wpform_field['id'], 'label' => $wpform_field['label'], - ]; + ); } $forms[] = $form; @@ -93,15 +93,15 @@ public function forms() { public function submit( $fields, $entry, $form_data, $entry_id ) { $form_id = $this->cast_form_id( $form_data['id'] ); - $settings = get_option( 'wemail_form_integration_wpforms', [] ); + $settings = get_option( 'wemail_form_integration_wpforms', array() ); if ( ! in_array( $form_id, $settings, true ) ) { return; } - $data = [ + $data = array( 'id' => $form_id, - ]; + ); foreach ( $fields as $field ) { $data['data'][ $field['id'] ] = $field['value']; @@ -112,5 +112,4 @@ public function submit( $fields, $entry, $form_data, $entry_id ) { wemail()->api->forms()->integrations( 'wpforms' )->submit()->post( $data ); } } - } diff --git a/includes/Core/Form/Menu.php b/includes/Core/Form/Menu.php index 87acbaa3..b9ec8b70 100644 --- a/includes/Core/Form/Menu.php +++ b/includes/Core/Form/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_form' ) ) { - $menu_items[] = [ __( 'Forms', 'wemail' ), $capability, 'admin.php?page=wemail#/forms' ]; + $menu_items[] = array( __( 'Forms', 'wemail' ), $capability, 'admin.php?page=wemail#/forms' ); } return $menu_items; } - } diff --git a/includes/Core/Help/Menu.php b/includes/Core/Help/Menu.php index 5f26dadc..d95a698e 100644 --- a/includes/Core/Help/Menu.php +++ b/includes/Core/Help/Menu.php @@ -40,7 +40,7 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ __( 'Help', 'wemail' ), $capability, 'admin.php?page=wemail#/help' ]; + $menu_items[] = array( __( 'Help', 'wemail' ), $capability, 'admin.php?page=wemail#/help' ); } return $menu_items; diff --git a/includes/Core/Help/Services/PingService.php b/includes/Core/Help/Services/PingService.php index e4849fb7..9fff5545 100644 --- a/includes/Core/Help/Services/PingService.php +++ b/includes/Core/Help/Services/PingService.php @@ -18,9 +18,9 @@ public function request_send( $request, $callback_url ) { if ( ! $api_key ) { return wp_send_json_error( - [ + array( 'message' => 'User ID not found', - ] + ) ); } @@ -33,32 +33,32 @@ public function request_send( $request, $callback_url ) { $response = wp_remote_post( $wemail_api . '/help/tools/ping', - [ + array( 'method' => 'POST', - 'headers' => [ + 'headers' => array( 'x-api-key' => $api_key, - ], - 'body' => [ + ), + 'body' => array( 'wemail_test_input' => $request['wemail_test_input'], 'callback_url' => $callback_url, - ], - ] + ), + ) ); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); return wp_send_json_error( - [ + array( 'message' => 'Something went wrong: ' . $error_message, - ] + ) ); } else { $body = wp_remote_retrieve_body( $response ); $code = wp_remote_retrieve_response_code( $response ); $result = array_merge( - [ + array( 'message' => 'Server responded with ' . $code . ' code.', - ], + ), json_decode( $body, true ) ); @@ -75,9 +75,9 @@ public function request_send( $request, $callback_url ) { * @return array */ public function request_receive( $request ) { - return [ + return array( 'wemail_test_input' => $request['wemail_test_input'] ? $request['wemail_test_input'] : null, 'received_headers' => $request['received_headers'] ? $request['received_headers'] : null, - ]; + ); } } diff --git a/includes/Core/Help/Services/PluginsInfo.php b/includes/Core/Help/Services/PluginsInfo.php index df887727..a480a15b 100644 --- a/includes/Core/Help/Services/PluginsInfo.php +++ b/includes/Core/Help/Services/PluginsInfo.php @@ -15,12 +15,12 @@ public function plugins() { } $plugins = get_plugins(); - $active_plugins_keys = get_option( 'active_plugins', [] ); - $active_plugins = []; + $active_plugins_keys = get_option( 'active_plugins', array() ); + $active_plugins = array(); foreach ( $plugins as $k => $v ) { // Take care of formatting the data how we want it. - $formatted = []; + $formatted = array(); $formatted['name'] = strip_tags( $v['Name'] ); if ( isset( $v['Version'] ) ) { @@ -52,9 +52,9 @@ public function plugins() { } } - return [ + return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins, - ]; + ); } } diff --git a/includes/Core/Help/Services/SystemService.php b/includes/Core/Help/Services/SystemService.php index d6a19ebc..1375c0b7 100644 --- a/includes/Core/Help/Services/SystemService.php +++ b/includes/Core/Help/Services/SystemService.php @@ -17,7 +17,7 @@ public function __construct() { * @return array */ public function get_server_info() { - $server_data = []; + $server_data = array(); if ( function_exists( 'phpversion' ) ) { $server_data['php_version'] = phpversion(); diff --git a/includes/Core/Help/Services/WordpressInfo.php b/includes/Core/Help/Services/WordpressInfo.php index 625c4a20..6671bb93 100644 --- a/includes/Core/Help/Services/WordpressInfo.php +++ b/includes/Core/Help/Services/WordpressInfo.php @@ -17,7 +17,7 @@ public function __construct() { * @return array */ public function get_wp_info() { - $wp_data = []; + $wp_data = array(); $wp_data['site_url'] = esc_url( home_url() ); $wp_data['memory_limit'] = WP_MEMORY_LIMIT; @@ -87,7 +87,7 @@ public function get_user_ip_address() { * @return array */ public function get_user_counts() { - $user_count = []; + $user_count = array(); $user_count_data = count_users(); $user_count['total'] = $user_count_data['total_users']; @@ -101,13 +101,13 @@ public function get_user_counts() { public function name( $as_array = false ) { $users = get_users( - [ + array( 'role' => 'administrator', 'orderby' => 'ID', 'order' => 'ASC', 'number' => 1, 'paged' => 1, - ] + ) ); $admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0] : false; @@ -120,10 +120,10 @@ public function name( $as_array = false ) { } if ( $as_array ) { - return [ + return array( 'first_name' => $first_name, 'last_name' => $last_name, - ]; + ); } return $first_name . ' ' . $last_name; @@ -152,25 +152,25 @@ public function post_types() { $post_types = $wpdb->get_results( "SELECT post_type AS 'type', count(1) AS 'count' FROM {$wpdb->posts} GROUP BY post_type ORDER BY count DESC;", ARRAY_A ); - return is_array( $post_types ) ? $post_types : []; + return is_array( $post_types ) ? $post_types : array(); } public function time_info() { global $wpdb; - $data = [ - [ + $data = array( + array( 'label' => 'WP Local Time', 'value' => $this::get_timezone(), - ], - [ + ), + array( 'label' => 'DB Time ', 'value' => $wpdb->get_var( 'SELECT utc_timestamp()' ), - ], - [ + ), + array( 'label' => 'PHP Time', 'value' => gmdate( 'Y-m-d H:i:s' ), - ], - ]; + ), + ); return $data; } diff --git a/includes/Core/Help/SystemInfo.php b/includes/Core/Help/SystemInfo.php index c2046567..e294886c 100644 --- a/includes/Core/Help/SystemInfo.php +++ b/includes/Core/Help/SystemInfo.php @@ -23,7 +23,7 @@ public function __construct() { public function allInfo() { $name = $this->wp->name( true ); - return [ + return array( 'admin_email' => get_option( 'admin_email' ), 'first_name' => $name['first_name'], 'last_name' => $name['last_name'], @@ -35,6 +35,6 @@ public function allInfo() { 'server' => $this->system->get_server_info(), 'post_types' => $this->wp->post_types(), 'time_info' => $this->wp->time_info(), - ]; + ); } } diff --git a/includes/Core/Import/Import.php b/includes/Core/Import/Import.php index c33689a0..624ae780 100644 --- a/includes/Core/Import/Import.php +++ b/includes/Core/Import/Import.php @@ -7,5 +7,4 @@ class Import { use Singleton; - } diff --git a/includes/Core/Import/Menu.php b/includes/Core/Import/Menu.php index f82a812c..7491347e 100644 --- a/includes/Core/Import/Menu.php +++ b/includes/Core/Import/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ __( 'Import', 'wemail' ), $capability, 'admin.php?page=wemail#/import' ]; + $menu_items[] = array( __( 'Import', 'wemail' ), $capability, 'admin.php?page=wemail#/import' ); } return $menu_items; } - } diff --git a/includes/Core/Integrations/Menu.php b/includes/Core/Integrations/Menu.php index fb38fc2e..001b9159 100644 --- a/includes/Core/Integrations/Menu.php +++ b/includes/Core/Integrations/Menu.php @@ -40,7 +40,7 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ __( 'Integrations', 'wemail' ), $capability, 'admin.php?page=wemail#/integrations' ]; + $menu_items[] = array( __( 'Integrations', 'wemail' ), $capability, 'admin.php?page=wemail#/integrations' ); } return $menu_items; diff --git a/includes/Core/Lists/Lists.php b/includes/Core/Lists/Lists.php index 2da013f0..c59a3f27 100644 --- a/includes/Core/Lists/Lists.php +++ b/includes/Core/Lists/Lists.php @@ -17,7 +17,7 @@ class Lists { * * @return array */ - public function all( $query = [] ) { + public function all( $query = array() ) { return wemail()->api->lists()->query( $query )->get(); } diff --git a/includes/Core/Lists/Menu.php b/includes/Core/Lists/Menu.php index c887221a..1e73d6ca 100644 --- a/includes/Core/Lists/Menu.php +++ b/includes/Core/Lists/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_list' ) ) { - $menu_items[] = [ __( 'Lists', 'wemail' ), $capability, 'admin.php?page=wemail#/lists' ]; + $menu_items[] = array( __( 'Lists', 'wemail' ), $capability, 'admin.php?page=wemail#/lists' ); } return $menu_items; } - } diff --git a/includes/Core/Mail/MailerHelper.php b/includes/Core/Mail/MailerHelper.php index 6a5b826d..94250c04 100644 --- a/includes/Core/Mail/MailerHelper.php +++ b/includes/Core/Mail/MailerHelper.php @@ -43,7 +43,7 @@ public function formatAttachments( $attachments ) { global $wpdb; if ( empty( $attachments ) ) { - return []; + return array(); } $attachments = array_map( diff --git a/includes/Core/Mail/WeMailMailer54.php b/includes/Core/Mail/WeMailMailer54.php index 49a88801..7eca9301 100644 --- a/includes/Core/Mail/WeMailMailer54.php +++ b/includes/Core/Mail/WeMailMailer54.php @@ -16,7 +16,7 @@ public function send() { $response = $this->attemptToSend(); if ( is_wp_error( $response ) ) { - throw new \phpmailerException( $response->get_error_message() ); + throw new \phpmailerException( esc_html( $response->get_error_message() ) ); } if ( isset( $response['success'] ) && ! wemail_validate_boolean( $response['success'] ) ) { diff --git a/includes/Core/Mail/WeMailMailer55.php b/includes/Core/Mail/WeMailMailer55.php index acd4a925..78240dde 100644 --- a/includes/Core/Mail/WeMailMailer55.php +++ b/includes/Core/Mail/WeMailMailer55.php @@ -17,7 +17,7 @@ public function send() { $response = $this->attemptToSend(); if ( is_wp_error( $response ) ) { - throw new PHPMailerException( $response->get_error_message() ); + throw new PHPMailerException( esc_html( $response->get_error_message() ) ); } if ( isset( $response['success'] ) && ! wemail_validate_boolean( $response['success'] ) ) { diff --git a/includes/Core/Overview/Menu.php b/includes/Core/Overview/Menu.php index c642bf06..67d5e588 100644 --- a/includes/Core/Overview/Menu.php +++ b/includes/Core/Overview/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_dashboard' ) ) { - $menu_items[] = [ __( 'Overview', 'wemail' ), $capability, 'admin.php?page=wemail#/' ]; + $menu_items[] = array( __( 'Overview', 'wemail' ), $capability, 'admin.php?page=wemail#/' ); } return $menu_items; } - } diff --git a/includes/Core/Overview/Overview.php b/includes/Core/Overview/Overview.php index 7c0465c0..2ef12021 100644 --- a/includes/Core/Overview/Overview.php +++ b/includes/Core/Overview/Overview.php @@ -7,5 +7,4 @@ class Overview { use Singleton; - } diff --git a/includes/Core/Segment/Segment.php b/includes/Core/Segment/Segment.php index 1bf378a7..a888396a 100644 --- a/includes/Core/Segment/Segment.php +++ b/includes/Core/Segment/Segment.php @@ -9,7 +9,7 @@ class Segment { use Singleton; public function conditions() { - $conditions = [ + $conditions = array( 'IS' => __( 'is', 'wemail' ), 'ISNOT' => __( 'is not', 'wemail' ), 'CONT' => __( 'contains', 'wemail' ), @@ -31,7 +31,7 @@ public function conditions() { 'BEFORE' => __( 'Before', 'wemail' ), 'IN' => __( 'in', 'wemail' ), 'NIN' => __( 'not in', 'wemail' ), - ]; + ); return apply_filters( 'wemail_segment_conditions', $conditions ); } @@ -46,5 +46,4 @@ public function items() { public function get( $id ) { return wemail()->api->segments( $id )->get(); } - } diff --git a/includes/Core/Settings/Menu.php b/includes/Core/Settings/Menu.php index 04e01b51..0b326029 100644 --- a/includes/Core/Settings/Menu.php +++ b/includes/Core/Settings/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ __( 'Settings', 'wemail' ), $capability, 'admin.php?page=wemail#/settings' ]; + $menu_items[] = array( __( 'Settings', 'wemail' ), $capability, 'admin.php?page=wemail#/settings' ); } return $menu_items; } - } diff --git a/includes/Core/Settings/Settings.php b/includes/Core/Settings/Settings.php index 1d2a9d8b..bcf8852d 100644 --- a/includes/Core/Settings/Settings.php +++ b/includes/Core/Settings/Settings.php @@ -7,7 +7,8 @@ class Settings { - use Core, Stringy; + use Core; + use Stringy; /** * Get site settings @@ -25,5 +26,4 @@ public function get( $name ) { return $this->data( $settings ); } - } diff --git a/includes/Core/Shortcode/Shortcode.php b/includes/Core/Shortcode/Shortcode.php index 6d76cffe..b79dc513 100644 --- a/includes/Core/Shortcode/Shortcode.php +++ b/includes/Core/Shortcode/Shortcode.php @@ -9,106 +9,106 @@ class Shortcode { use Singleton; public function get( $type = '' ) { - $shortcodes = []; + $shortcodes = array(); - $shortcodes['subscriber'] = [ + $shortcodes['subscriber'] = array( 'title' => __( 'Subscriber', 'wemail' ), - 'codes' => [ - 'first_name' => [ + 'codes' => array( + 'first_name' => array( 'title' => __( 'First Name', 'wemail' ), 'default' => 'reader', - ], - 'last_name' => [ + ), + 'last_name' => array( 'title' => __( 'Last Name', 'wemail' ), 'default' => 'reader', - ], - 'email' => [ + ), + 'email' => array( 'title' => __( 'Email', 'wemail' ), 'placeholder' => 'recipient@example.com', - ], - 'date_of_birth' => [ + ), + 'date_of_birth' => array( 'title' => __( 'Date of Birth', 'wemail' ), 'placeholder' => 'MM/DD/YYYY', - ], - 'source' => [ + ), + 'source' => array( 'title' => __( 'Source', 'wemail' ), 'placeholder' => '', - ], - 'phone' => [ + ), + 'phone' => array( 'title' => __( 'Phone', 'wemail' ), 'placeholder' => '8801000000000', - ], - 'mobile' => [ + ), + 'mobile' => array( 'title' => __( 'Mobile', 'wemail' ), 'placeholder' => '8801000000000', - ], - 'address' => [ + ), + 'address' => array( 'title' => __( 'Address', 'wemail' ), - ], - ], - ]; + ), + ), + ); - $shortcodes['date'] = [ + $shortcodes['date'] = array( 'title' => __( 'Date', 'wemail' ), - 'codes' => [ - 'current_date' => [ + 'codes' => array( + 'current_date' => array( 'title' => __( 'Current date', 'wemail' ), - ], - 'current_day_full_name' => [ + ), + 'current_day_full_name' => array( 'title' => __( 'Full name of current day', 'wemail' ), - ], - 'current_day_short_name' => [ + ), + 'current_day_short_name' => array( 'title' => __( 'Short name of current day', 'wemail' ), - ], - 'current_month_number' => [ + ), + 'current_month_number' => array( 'title' => __( 'Current Month number', 'wemail' ), - ], - 'current_month_full_name' => [ + ), + 'current_month_full_name' => array( 'title' => __( 'Full name of current month', 'wemail' ), - ], - 'current_month_short_name' => [ + ), + 'current_month_short_name' => array( 'title' => __( 'Short name of current month', 'wemail' ), - ], - 'year' => [ + ), + 'year' => array( 'title' => __( 'Year', 'wemail' ), - ], - ], - ]; + ), + ), + ); - $shortcodes['company'] = [ + $shortcodes['company'] = array( 'title' => __( 'Company', 'wemail' ), - 'codes' => [ - 'name' => [ + 'codes' => array( + 'name' => array( 'title' => __( 'Name', 'wemail' ), - ], - 'address' => [ + ), + 'address' => array( 'title' => __( 'Mailing Address', 'wemail' ), - ], - 'phone' => [ + ), + 'phone' => array( 'title' => __( 'Phone', 'wemail' ), - ], - 'mobile' => [ + ), + 'mobile' => array( 'title' => __( 'Mobile', 'wemail' ), - ], - 'website' => [ + ), + 'website' => array( 'title' => __( 'Website', 'wemail' ), - ], - ], - ]; + ), + ), + ); - $shortcodes['links'] = [ + $shortcodes['links'] = array( 'title' => __( 'Links', 'wemail' ), - 'codes' => [ - 'unsubscribe' => [ + 'codes' => array( + 'unsubscribe' => array( 'title' => __( 'Unsubscribe Link', 'wemail' ), 'text' => __( 'Unsubscribe', 'wemail' ), - ], - 'archive' => [ + ), + 'archive' => array( 'title' => __( 'Email Archive Link', 'wemail' ), 'text' => __( 'View this email in your browser', 'wemail' ), - ], - ], - ]; + ), + ), + ); if ( ! empty( $type ) && ! empty( $shortcodes[ $type ] ) ) { return $shortcodes[ $type ]; @@ -116,5 +116,4 @@ public function get( $type = '' ) { return $shortcodes; } - } diff --git a/includes/Core/Subscriber/Subscriber.php b/includes/Core/Subscriber/Subscriber.php index 2bbb2fa4..82a227f4 100644 --- a/includes/Core/Subscriber/Subscriber.php +++ b/includes/Core/Subscriber/Subscriber.php @@ -17,7 +17,7 @@ class Subscriber { * * @return array */ - public function all( $args = [] ) { + public function all( $args = array() ) { $subscribers = wemail()->api->subscribers()->query( $args )->get(); if ( ! is_wp_error( $subscribers ) ) { @@ -97,7 +97,7 @@ public function update( $id, $data ) { * @return int|null */ public function delete( $id, $permanent = false ) { - $args = []; + $args = array(); if ( $permanent ) { $args['permanent'] = true; @@ -123,13 +123,12 @@ public function delete( $id, $permanent = false ) { * @return array|null */ public function subscribe_to_lists( $id, $list_ids ) { - $data = [ + $data = array( 'lists' => $list_ids, - ]; + ); $subscriber = wemail()->api->subscribers( $id )->subscribe_to_lists()->put( $data ); return $this->data( $subscriber ); } - } diff --git a/includes/Core/SuppressionLists/Menu.php b/includes/Core/SuppressionLists/Menu.php index 2df120c7..a358dbf6 100644 --- a/includes/Core/SuppressionLists/Menu.php +++ b/includes/Core/SuppressionLists/Menu.php @@ -40,10 +40,9 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'view_list' ) ) { - $menu_items[] = [ __( 'Suppressions', 'wemail' ), $capability, 'admin.php?page=wemail#/suppression-lists' ]; + $menu_items[] = array( __( 'Suppressions', 'wemail' ), $capability, 'admin.php?page=wemail#/suppression-lists' ); } return $menu_items; } - } diff --git a/includes/Core/Sync/AffiliateWp/AffiliateWp.php b/includes/Core/Sync/AffiliateWp/AffiliateWp.php index 4ec4ca15..ebbda8e7 100644 --- a/includes/Core/Sync/AffiliateWp/AffiliateWp.php +++ b/includes/Core/Sync/AffiliateWp/AffiliateWp.php @@ -72,7 +72,7 @@ public function affwp_wemail_add_user_to_list( $affiliate_id, $status = true ) { } $post_data = $_POST; // phpcs:ignore - $payload = []; + $payload = array(); if ( $post_data['status'] === 'active' ) { if ( isset( $post_data['affwp_user_name'] ) ) { $name = explode( ' ', sanitize_text_field( $post_data['affwp_user_name'] ) ); @@ -83,19 +83,19 @@ public function affwp_wemail_add_user_to_list( $affiliate_id, $status = true ) { $affiliate = affiliate_wp()->affiliates->get_by( 'affiliate_id', $affiliate_id ); $user_id = $affiliate->user_id; - $payload = [ + $payload = array( 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'wp_user_id' => $user_id, - ]; + ); } elseif ( isset( $post_data['email'] ) ) { - $payload = [ + $payload = array( 'first_name' => $post_data['first_name'] ? $post_data['first_name'] : '', 'last_name' => $post_data['last_name'] ? $post_data['last_name'] : '', 'email' => $post_data['email'], 'wp_user_id' => $post_data['wp_user_id'] ? $post_data['wp_user_id'] : '', - ]; + ); } else { $payload = $this->getPayloadForSpecificAffiliateID( $affiliate_id ); } @@ -125,12 +125,12 @@ public function getPayloadForSpecificAffiliateID( $affiliate_id ) { $last_name = isset( $name[1] ) ? $name[1] : ''; $email = $user->user_email; - $payload = [ + $payload = array( 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'wp_user_id' => $user->ID, - ]; + ); return $payload; } } diff --git a/includes/Core/Sync/Ecommerce/EDD/Orders.php b/includes/Core/Sync/Ecommerce/EDD/Orders.php index 6740016f..38cb2c05 100644 --- a/includes/Core/Sync/Ecommerce/EDD/Orders.php +++ b/includes/Core/Sync/Ecommerce/EDD/Orders.php @@ -63,10 +63,10 @@ public function wemail_edd_update_payment_status( $payment_id, $new_status ) { return; } - $param = [ + $param = array( 'order_id' => $payment_id, 'status' => $new_status, - ]; + ); $this->order_request->statusUpdated( $param, $this->source ); } diff --git a/includes/Core/Sync/Ecommerce/EDD/Products.php b/includes/Core/Sync/Ecommerce/EDD/Products.php index 9423713c..e2da6e45 100644 --- a/includes/Core/Sync/Ecommerce/EDD/Products.php +++ b/includes/Core/Sync/Ecommerce/EDD/Products.php @@ -49,7 +49,7 @@ public function wemail_edd_wp_update_post( $post_id ) { $is_new = $download->post_date === $download->post_modified; - $product = [ + $product = array( 'id' => $download->ID, 'name' => $download->post_title, 'slug' => $download->post_name, @@ -60,7 +60,7 @@ public function wemail_edd_wp_update_post( $post_id ) { 'rating' => '', 'permalink' => get_permalink( $download->ID ), 'categories' => $this->get_download_categories( $download->ID ), - ]; + ); if ( $is_new ) { $this->product_request->store( $product, $this->source ); @@ -75,14 +75,14 @@ public function wemail_edd_wp_update_post( $post_id ) { * @return array */ public function get_download_categories( $download_id ) { - $terms = wp_get_post_terms( $download_id, 'download_category', [ 'fields' => 'all' ] ); + $terms = wp_get_post_terms( $download_id, 'download_category', array( 'fields' => 'all' ) ); - $categories = []; + $categories = array(); foreach ( $terms as $term ) { - $categories[] = [ + $categories[] = array( 'id' => $term->term_id, 'name' => $term->name, - ]; + ); } return $categories; @@ -93,11 +93,11 @@ public function get_download_images( $post_id ) { $src = wp_get_attachment_image_url( $attachment_id, 'thumbnail' ); - return [ + return array( 'id' => (int) $attachment_id, 'src' => $src, 'title' => get_the_title( $attachment_id ), 'alt' => get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ), - ]; + ); } } diff --git a/includes/Core/Sync/Ecommerce/WooCommerce/Orders.php b/includes/Core/Sync/Ecommerce/WooCommerce/Orders.php index e081bffd..751dbb3f 100644 --- a/includes/Core/Sync/Ecommerce/WooCommerce/Orders.php +++ b/includes/Core/Sync/Ecommerce/WooCommerce/Orders.php @@ -62,10 +62,10 @@ public function wemail_wc_order_status_updated( $order_id, $old_status, $new_sta return; } - $param = [ + $param = array( 'order_id' => $order_id, 'status' => $new_status, - ]; + ); $this->order_request->statusUpdated( $param, $this->source ); } } diff --git a/includes/Core/Sync/Ecommerce/WooCommerce/Products.php b/includes/Core/Sync/Ecommerce/WooCommerce/Products.php index acaf2bd3..977869c5 100644 --- a/includes/Core/Sync/Ecommerce/WooCommerce/Products.php +++ b/includes/Core/Sync/Ecommerce/WooCommerce/Products.php @@ -57,7 +57,7 @@ public function wemail_wc_product_updated( $post_id, $post, $update ) { $is_new = $post->post_date === $post->post_modified; if ( $is_new ) { - $new_arr = [ + $new_arr = array( 'id' => $product->get_id(), 'name' => $product->get_name(), 'slug' => $product->get_slug(), @@ -68,10 +68,10 @@ public function wemail_wc_product_updated( $post_id, $post, $update ) { 'rating' => $product->get_average_rating(), 'permalink' => get_permalink( $product->get_id() ), 'categories' => $wc_products->get_product_categories( $product->get_id() ), - ]; + ); $this->product_request->store( $new_arr, $this->source ); } else { - $update_arr = [ + $update_arr = array( 'id' => $product->get_id(), 'name' => $product->get_name(), 'slug' => $product->get_slug(), @@ -82,7 +82,7 @@ public function wemail_wc_product_updated( $post_id, $post, $update ) { 'rating' => $product->get_average_rating(), 'permalink' => get_permalink( $product->get_id() ), 'categories' => $wc_products->get_product_categories( $product->get_id() ), - ]; + ); $this->product_request->update( $update_arr, $this->source ); } } diff --git a/includes/Core/Sync/Subscriber/Erp/Erp.php b/includes/Core/Sync/Subscriber/Erp/Erp.php index 5d675967..211f49ed 100644 --- a/includes/Core/Sync/Subscriber/Erp/Erp.php +++ b/includes/Core/Sync/Subscriber/Erp/Erp.php @@ -22,13 +22,13 @@ class Erp { */ public function settings() { if ( ! isset( $this->settings['sync'] ) ) { - $defaults = [ + $defaults = array( 'sync' => false, 'import_crm_groups' => false, 'default_list' => null, - ]; + ); - $settings = get_option( 'wemail_sync_subscriber_erp_contacts', [] ); + $settings = get_option( 'wemail_sync_subscriber_erp_contacts', array() ); if ( ! empty( $settings ) ) { if ( ! empty( $data['sync'] ) ) { @@ -75,7 +75,7 @@ public function is_active() { * @return void * @since 1.0.0 */ - public function create( $contacts = [] ) { + public function create( $contacts = array() ) { if ( ! $this->is_active() ) { return; } @@ -89,10 +89,10 @@ public function create( $contacts = [] ) { wemail_set_owner_api_key( false ); wemail()->api->sync()->subscribers()->erp()->subscribed()->post( - [ + array( 'list_id' => $this->settings['default_list'], 'contacts' => $contacts, - ] + ) ); } @@ -114,10 +114,10 @@ public function update( $contacts ) { wemail_set_owner_api_key( false ); wemail()->api->sync()->subscribers()->erp()->subscribed()->post( - [ + array( 'list_id' => $this->settings['default_list'], 'contacts' => $contacts, - ] + ) ); } @@ -140,21 +140,21 @@ public function delete( $contacts ) { return; } - $emails = []; + $emails = array(); foreach ( $contacts as $contact ) { $emails[] = $contact->email; } wemail()->api->sync()->subscribers()->erp()->unsubscribed()->post( - [ + array( 'list_id' => $this->settings['default_list'], 'emails' => $emails, - ] + ) ); } - public function sync_group( $contact_ids = [] ) { + public function sync_group( $contact_ids = array() ) { if ( ! $this->is_active() ) { return; } @@ -166,10 +166,10 @@ public function sync_group( $contact_ids = [] ) { wemail_set_owner_api_key( false ); wemail()->api->sync()->subscribers()->erp()->sync_group()->post( - [ + array( 'list_id' => $this->settings['default_list'], 'contact_ids' => $contact_ids, - ] + ) ); } @@ -186,7 +186,7 @@ function ( $contact ) { return array_merge( wemail_array_only( $contact, - [ + array( 'first_name', 'last_name', 'email', @@ -196,9 +196,9 @@ function ( $contact ) { 'state', 'country', 'date_of_birth', - ] + ) ), - [ 'source' => 'erp' ] + array( 'source' => 'erp' ) ); }, $contacts diff --git a/includes/Core/Sync/Subscriber/Erp/Hooks.php b/includes/Core/Sync/Subscriber/Erp/Hooks.php index f9a301cd..737de42f 100644 --- a/includes/Core/Sync/Subscriber/Erp/Hooks.php +++ b/includes/Core/Sync/Subscriber/Erp/Hooks.php @@ -12,7 +12,7 @@ class Hooks { * @since 1.0.6 * @var array */ - private $created_contacts = []; + private $created_contacts = array(); /** * Holds the updated contact ids @@ -21,7 +21,7 @@ class Hooks { * * @var array */ - private $updated_contacts = []; + private $updated_contacts = array(); /** * Holds the deleting contacts @@ -30,7 +30,7 @@ class Hooks { * * @var array */ - private $deleting_contacts = []; + private $deleting_contacts = array(); /** * Holds the deleted contacts @@ -39,14 +39,14 @@ class Hooks { * * @var array */ - private $deleted_contacts = []; + private $deleted_contacts = array(); /** * Holds the restored contact ids * * @var array */ - private $restored_contacts = []; + private $restored_contacts = array(); /** * Class constructor @@ -110,7 +110,7 @@ public function update_subscriber_on_shutdown( $people_id, $args, $type ) { * @since 1.0.0 */ public function update_subscriber_group_on_shutdown( $subscriber ) { - if ( ! has_action( 'shutdown', [ $this, 'create' ] ) && ! has_action( 'shutdown', [ $this, 'update' ] ) ) { + if ( ! has_action( 'shutdown', array( $this, 'create' ) ) && ! has_action( 'shutdown', array( $this, 'update' ) ) ) { $this->updated_contacts[] = $subscriber->user_id; $this->add_shutdown_action( 'sync_group' ); @@ -210,7 +210,7 @@ public function delete() { * @since 1.0.0 */ private function add_shutdown_action( $name ) { - if ( ! has_action( 'shutdown', [ $this, $name ] ) ) { + if ( ! has_action( 'shutdown', array( $this, $name ) ) ) { $this->add_action( 'shutdown', $name ); } } diff --git a/includes/Core/Sync/Subscriber/Subscriber.php b/includes/Core/Sync/Subscriber/Subscriber.php index c8ce7f7c..a9251a1a 100644 --- a/includes/Core/Sync/Subscriber/Subscriber.php +++ b/includes/Core/Sync/Subscriber/Subscriber.php @@ -7,10 +7,10 @@ class Subscriber { use Stringy; - private $container = [ + private $container = array( 'wp' => null, 'erp' => null, - ]; + ); public function __get( $prop ) { if ( array_key_exists( $prop, $this->container ) ) { @@ -24,5 +24,4 @@ public function __get( $prop ) { return $this->container[ $prop ]; } } - } diff --git a/includes/Core/Sync/Subscriber/Wp/Hooks.php b/includes/Core/Sync/Subscriber/Wp/Hooks.php index 4455358e..4104b23e 100644 --- a/includes/Core/Sync/Subscriber/Wp/Hooks.php +++ b/includes/Core/Sync/Subscriber/Wp/Hooks.php @@ -15,7 +15,7 @@ class Hooks { * * @var array */ - private $created_users = []; + private $created_users = array(); /** * Holds the updated user ids @@ -24,7 +24,7 @@ class Hooks { * * @var array */ - private $updated_users = []; + private $updated_users = array(); /** * Holds the deleted user ids @@ -33,7 +33,7 @@ class Hooks { * * @var array */ - private $deleted_users = []; + private $deleted_users = array(); /** * Class constructor @@ -131,7 +131,7 @@ public function delete() { * @return void */ private function add_shutdown_action( $name ) { - if ( ! has_action( 'shutdown', [ $this, $name ] ) ) { + if ( ! has_action( 'shutdown', array( $this, $name ) ) ) { $this->add_action( 'shutdown', $name ); } } diff --git a/includes/Core/Sync/Subscriber/Wp/Wp.php b/includes/Core/Sync/Subscriber/Wp/Wp.php index 71b4d8ad..d29565ac 100644 --- a/includes/Core/Sync/Subscriber/Wp/Wp.php +++ b/includes/Core/Sync/Subscriber/Wp/Wp.php @@ -22,12 +22,12 @@ class Wp { */ public function settings() { if ( ! isset( $this->settings['auto_sync'] ) ) { - $defaults = [ + $defaults = array( 'auto_sync' => false, - 'user_roles' => [], - ]; + 'user_roles' => array(), + ); - $settings = get_option( 'wemail_sync_subscriber_wp', [] ); + $settings = get_option( 'wemail_sync_subscriber_wp', array() ); $this->settings = wp_parse_args( $settings, $defaults ); } @@ -59,7 +59,7 @@ public function is_active() { * * @return void */ - public function create( $user_ids = [] ) { + public function create( $user_ids = array() ) { if ( ! $this->is_active() ) { return; } @@ -78,7 +78,7 @@ public function create( $user_ids = [] ) { } $users = array_map( - function( $user ) { + function ( $user ) { return array( 'full_name' => $user->data->display_name, 'email' => $user->data->user_email, @@ -94,9 +94,9 @@ function( $user ) { */ wemail_set_owner_api_key( false ); - $post_data = [ + $post_data = array( 'users' => $users, - ]; + ); wemail()->api->sync()->subscribers()->wp()->subscribe()->post( $post_data ); } @@ -122,16 +122,16 @@ public function update( $user_ids ) { wemail_set_owner_api_key( false ); $users = array_map( - function( $user ) { - return [ + function ( $user ) { + return array( 'email' => $user->data->user_email, 'full_name' => $user->data->display_name, - ]; + ); }, $users ); - wemail()->api->sync()->subscribers()->wp()->update()->post( [ 'users' => $users ] ); + wemail()->api->sync()->subscribers()->wp()->update()->post( array( 'users' => $users ) ); } /** @@ -143,13 +143,13 @@ function( $user ) { */ public function delete( $users ) { wemail_set_owner_api_key( false ); - $emails = []; + $emails = array(); foreach ( $users as $user ) { $emails[] = $user->data->user_email; } - wemail()->api->sync()->subscribers()->wp()->unsubscribe()->post( [ 'emails' => $emails ] ); + wemail()->api->sync()->subscribers()->wp()->unsubscribe()->post( array( 'emails' => $emails ) ); } /** @@ -160,7 +160,7 @@ public function delete( $users ) { * @since 1.0.0 */ private function filter_syncable_users( $user_ids ) { - $syncables = []; + $syncables = array(); if ( $this->is_active() && ! empty( $this->settings['user_roles'] ) && is_array( $this->settings['user_roles'] ) ) { foreach ( $user_ids as $user_id ) { @@ -187,5 +187,4 @@ private function filter_syncable_users( $user_ids ) { return $syncables; } - } diff --git a/includes/Core/Sync/Sync.php b/includes/Core/Sync/Sync.php index d7837c12..4acc5502 100644 --- a/includes/Core/Sync/Sync.php +++ b/includes/Core/Sync/Sync.php @@ -7,11 +7,12 @@ class Sync { - use Singleton, Stringy; + use Singleton; + use Stringy; - private $container = [ + private $container = array( 'subscriber' => null, - ]; + ); public function __get( $prop ) { if ( array_key_exists( $prop, $this->container ) ) { diff --git a/includes/Core/User/Integrations/WpUser.php b/includes/Core/User/Integrations/WpUser.php index 633a88ff..acf31c2f 100644 --- a/includes/Core/User/Integrations/WpUser.php +++ b/includes/Core/User/Integrations/WpUser.php @@ -9,9 +9,9 @@ class WpUser { * since 1.0.0 */ public function __construct() { - add_action( 'user_register', [ $this, 'wemail_registration_save' ], 10, 1 ); - add_action( 'profile_update', [ $this, 'wemail_user_profile_updated' ], 10, 2 ); - add_action( 'delete_user', [ $this, 'wemail_user_deleted' ] ); + add_action( 'user_register', array( $this, 'wemail_registration_save' ), 10, 1 ); + add_action( 'profile_update', array( $this, 'wemail_user_profile_updated' ), 10, 2 ); + add_action( 'delete_user', array( $this, 'wemail_user_deleted' ) ); } /** @@ -53,11 +53,11 @@ public function wemail_user_profile_updated( $user_id, $old_user_data ) { return; } - $data = [ + $data = array( 'name' => $user->data->display_name, 'email' => $user->data->user_email, 'token' => $access_token, - ]; + ); $response = wemail()->api->set_api_key( $access_token )->auth()->users()->profile()->update()->post( $data ); @@ -86,9 +86,9 @@ public function wemail_user_deleted( $user_id ) { return; } - $data = [ + $data = array( 'email' => $user->data->user_email, - ]; + ); $response = wemail()->api->set_api_key( $access_token )->auth()->users()->destroy()->post( $data ); @@ -130,7 +130,7 @@ protected function is_team( $roles ) { return false; } - $roles = array_intersect( $roles, get_option( 'wemail_accessible_roles', [ 'administrator', 'editor' ] ) ); + $roles = array_intersect( $roles, get_option( 'wemail_accessible_roles', array( 'administrator', 'editor' ) ) ); return ! empty( $roles ); } @@ -158,12 +158,12 @@ protected function check_role( $roles, $role ) { * @param string $role */ protected function create_wemail_user( $user, $role ) { - $response = wemail()->api->auth()->users()->post( - [ + $response = wemail()->api->teamUsers()->post( + array( 'name' => $user->data->display_name, 'email' => $user->data->user_email, 'role' => $role, - ] + ) ); if ( is_wp_error( $response ) ) { @@ -187,7 +187,7 @@ protected function create_wemail_user( $user, $role ) { */ protected function update_user_permission( $access_token, $user_id ) { $api_key = apply_filters( 'wemail_api_key', $access_token ); - $user_data = wemail()->api->set_api_key( $api_key )->auth()->users()->me()->query( [ 'include' => 'role,permissions' ] )->get(); + $user_data = wemail()->api->set_api_key( $api_key )->auth()->users()->me()->query( array( 'include' => 'role,permissions' ) )->get(); if ( is_wp_error( $user_data ) ) { return; diff --git a/includes/Core/User/User.php b/includes/Core/User/User.php index a2a6ee2f..40d7c4ca 100644 --- a/includes/Core/User/User.php +++ b/includes/Core/User/User.php @@ -51,7 +51,7 @@ class User { * * @var array */ - public $permissions = []; + public $permissions = array(); /** * API resource query for URL to build @@ -74,7 +74,7 @@ public function boot() { if ( $api_key ) { $user_data = get_user_meta( $user_id, 'wemail_user_data', true ); if ( ! $user_data ) { - $user_data = wemail()->api->auth()->users()->me()->query( [ 'include' => 'role,permissions' ] )->get(); + $user_data = wemail()->api->auth()->users()->me()->query( array( 'include' => 'role,permissions' ) )->get(); if ( ! empty( $user_data['data'] ) ) { $user_data = $user_data['data']; @@ -108,5 +108,4 @@ public function can( $permission ) { return false; } - } diff --git a/includes/Core/Users/Menu.php b/includes/Core/Users/Menu.php index ef233018..c88442e2 100644 --- a/includes/Core/Users/Menu.php +++ b/includes/Core/Users/Menu.php @@ -40,11 +40,11 @@ public function __construct() { */ public function register_submenu( $menu_items, $capability ) { if ( wemail()->user->can( 'manage_settings' ) ) { - $menu_items[] = [ + $menu_items[] = array( __( 'Teams', 'wemail' ), $capability, 'admin.php?page=wemail#/teams', - ]; + ); } return $menu_items; diff --git a/includes/FrontEnd/FormOptIn.php b/includes/FrontEnd/FormOptIn.php index e997526f..fb72cd2b 100644 --- a/includes/FrontEnd/FormOptIn.php +++ b/includes/FrontEnd/FormOptIn.php @@ -20,7 +20,7 @@ public function __construct() { $this->settings = get_option( 'wemail_general', - [ + array( 'registration_enabled' => false, 'registration_label' => '', 'registration_list_id' => '', @@ -32,7 +32,7 @@ public function __construct() { 'comment_list_id' => '', 'form_in_blogs' => false, 'subscription_form_id' => '', - ] + ) ); $this->registration_hooks(); @@ -123,10 +123,10 @@ public function subscribe_checkbox_field_multisite() { * @return mixed */ public function add_subscribe_field_woocommerce_billing_form( $fields ) { - $fields['wemail_form_opt_in'] = [ + $fields['wemail_form_opt_in'] = array( 'type' => 'checkbox', 'label' => $this->settings['woocommerce_label'], - ]; + ); return $fields; } @@ -140,10 +140,10 @@ public function save_subscriber_from_registration( $user_id ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( isset( $_POST['wemail_form_opt_in'] ) ) { wemail()->subscriber->createOrUpdate( - [ + array( 'email' => filter_input( INPUT_POST, 'user_email', FILTER_VALIDATE_EMAIL ), 'list_id' => $this->settings['registration_list_id'], - ] + ) ); } } @@ -156,10 +156,10 @@ public function save_subscriber_from_registration( $user_id ) { public function save_subscriber_from_comment( $comment_id ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( isset( $_POST['wemail_form_opt_in'] ) ) { - $data = [ + $data = array( 'list_id' => $this->settings['comment_list_id'], 'email' => get_comment_author_email( $comment_id ), - ]; + ); $name = explode( ' ', get_comment_author( $comment_id ), 2 ); @@ -184,7 +184,7 @@ public function save_subscriber_from_woocommerce_billing( $order_id ) { $order = wc_get_order( $order_id ); wemail()->subscriber->createOrUpdate( - [ + array( 'first_name' => $order->get_billing_first_name(), 'last_name' => $order->get_billing_last_name(), 'email' => $order->get_billing_email(), @@ -196,7 +196,7 @@ public function save_subscriber_from_woocommerce_billing( $order_id ) { 'country' => $order->get_billing_country(), 'zip' => $order->get_billing_postcode(), 'list_id' => $this->settings['woocommerce_list_id'], - ] + ) ); } } diff --git a/includes/FrontEnd/Scripts.php b/includes/FrontEnd/Scripts.php index a910382c..f8683357 100644 --- a/includes/FrontEnd/Scripts.php +++ b/includes/FrontEnd/Scripts.php @@ -18,24 +18,23 @@ public function scripts() { public function enqueue_scripts() { if ( ! is_wemail_hmr_enable() ) { - wp_register_script( 'wemail-frontend-vendor', wemail()->wemail_cdn . '/build/js/frontend-vendor.js', [ 'jquery' ], WEMAIL_VERSION, true ); - wp_register_script( 'wemail-frontend', wemail()->wemail_cdn . '/build/js/frontend.js', [ 'wemail-frontend-vendor' ], WEMAIL_VERSION, true ); + wp_register_script( 'wemail-frontend-vendor', wemail()->wemail_cdn . '/build/js/frontend-vendor.js', array( 'jquery' ), WEMAIL_VERSION, true ); + wp_register_script( 'wemail-frontend', wemail()->wemail_cdn . '/build/js/frontend.js', array( 'wemail-frontend-vendor' ), WEMAIL_VERSION, true ); } else { $hmr_host = wemail()->hmr_host(); - wp_register_script( 'wemail-frontend-vendor', $hmr_host . '/src/js/frontend/frontend-vendor.js', [ 'jquery' ], WEMAIL_VERSION, true ); - wp_register_script( 'wemail-frontend', $hmr_host . '/src/js/frontend/frontend.js', [ 'wemail-frontend-vendor' ], WEMAIL_VERSION, true ); + wp_register_script( 'wemail-frontend-vendor', $hmr_host . '/src/js/frontend/frontend-vendor.js', array( 'jquery' ), WEMAIL_VERSION, true ); + wp_register_script( 'wemail-frontend', $hmr_host . '/src/js/frontend/frontend.js', array( 'wemail-frontend-vendor' ), WEMAIL_VERSION, true ); } - $wemail = [ + $wemail = array( 'restURL' => untrailingslashit( get_rest_url( null, '/wemail/v1' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'cdn' => wemail()->wemail_cdn, - ]; + ); wp_localize_script( 'wemail-frontend-vendor', 'weMail', $wemail ); WeMail::register_module_scripts(); } - } diff --git a/includes/FrontEnd/Shortcodes.php b/includes/FrontEnd/Shortcodes.php index c0935b94..a5fdbe5d 100644 --- a/includes/FrontEnd/Shortcodes.php +++ b/includes/FrontEnd/Shortcodes.php @@ -12,7 +12,7 @@ class Shortcodes { * @return void */ public function __construct() { - add_shortcode( 'wemail_form', [ $this, 'form' ] ); + add_shortcode( 'wemail_form', array( $this, 'form' ) ); } /** @@ -33,6 +33,4 @@ public function form( $attrs ) { return wemail_form( $id ); } - } - diff --git a/includes/FrontEnd/Widget.php b/includes/FrontEnd/Widget.php index 9ab13484..f9bd0ab9 100644 --- a/includes/FrontEnd/Widget.php +++ b/includes/FrontEnd/Widget.php @@ -7,21 +7,21 @@ class Widget extends WP_Widget { public function __construct() { - $args = [ + $args = array( 'classname' => 'wemail-form-widget', 'description' => __( 'weMail Form Widget', 'wemail' ), - ]; + ); parent::__construct( 'wemail-form-widget', __( 'weMail Form', 'wemail' ), $args ); } public function form( $instance ) { - $forms = wemail()->form->get_forms( [ 'type' => [ 'inline', 'modal' ] ] ); + $forms = wemail()->form->get_forms( array( 'type' => array( 'inline', 'modal' ) ) ); - $defaults = [ + $defaults = array( 'title' => __( 'Subscribe to our newsletter', 'wemail' ), 'form' => '', - ]; + ); $instance = wp_parse_args( $instance, $defaults ); @@ -63,5 +63,4 @@ public function widget( $args, $instance ) { echo $args['after_widget']; } - } diff --git a/includes/Hooks.php b/includes/Hooks.php index d97da3cc..3ec0578b 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -22,5 +22,4 @@ public function __construct() { new SyncAffiliateWp(); new RevenueTrack(); } - } diff --git a/includes/Install.php b/includes/Install.php index 0cb19834..36038893 100644 --- a/includes/Install.php +++ b/includes/Install.php @@ -27,14 +27,14 @@ public static function install() { wp_remote_post( $wemail_api . '/site/update-activation-status', - [ - 'headers' => [ + array( + 'headers' => array( 'x-api-key' => $api_key, - ], - 'body' => [ + ), + 'body' => array( 'deactivated' => false, - ], - ] + ), + ) ); // set the redirection to setup wizard diff --git a/includes/Privacy/Privacy.php b/includes/Privacy/Privacy.php index ed21dfec..1e69d46a 100644 --- a/includes/Privacy/Privacy.php +++ b/includes/Privacy/Privacy.php @@ -20,7 +20,7 @@ class Privacy { * * @var array */ - protected $exporters = []; + protected $exporters = array(); /** * List of eraser @@ -29,7 +29,7 @@ class Privacy { * * @var array */ - protected $eraser = []; + protected $eraser = array(); /** * Class constructor @@ -52,9 +52,9 @@ public function __construct() { * @return void */ protected function init() { - add_action( 'admin_init', [ $this, 'add_privacy_message' ] ); - add_filter( 'wp_privacy_personal_data_exporters', [ $this, 'register_exporters' ] ); - add_filter( 'wp_privacy_personal_data_erasers', [ $this, 'register_eraser' ] ); + add_action( 'admin_init', array( $this, 'add_privacy_message' ) ); + add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ) ); + add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_eraser' ) ); } /** @@ -94,11 +94,11 @@ public function add_privacy_message() { * * @return array */ - public function register_exporters( $exporters = [] ) { - $exporters['wemail-subscriber-data'] = [ + public function register_exporters( $exporters = array() ) { + $exporters['wemail-subscriber-data'] = array( 'exporter_friendly_name' => __( 'weMail Subscriber Data', 'wemail' ), - 'callback' => [ $this, 'export_subscriber_data' ], - ]; + 'callback' => array( $this, 'export_subscriber_data' ), + ); return $exporters; } @@ -114,25 +114,25 @@ public function register_exporters( $exporters = [] ) { * @return array */ public function export_subscriber_data( $email_address, $page ) { - $data_to_export = []; + $data_to_export = array(); wemail_set_owner_api_key(); $subscriber = wemail()->subscriber->get( $email_address ); if ( $subscriber ) { - $data_to_export[] = [ + $data_to_export[] = array( 'group_id' => 'wemail_subscriber', 'group_label' => __( 'weMail Subscriber Data', 'wemail' ), 'group_description' => __( 'The weMail subscriber data.', 'wemail' ), 'item_id' => 'wemail-subscriber', 'data' => $this->get_subscriber_data( $subscriber ), - ]; + ); } - return [ + return array( 'data' => $data_to_export, 'done' => true, - ]; + ); } /** @@ -144,11 +144,11 @@ public function export_subscriber_data( $email_address, $page ) { * * @return array */ - public function register_eraser( $erasers = [] ) { - $erasers['wemail-subscriber-data'] = [ + public function register_eraser( $erasers = array() ) { + $erasers['wemail-subscriber-data'] = array( 'eraser_friendly_name' => __( 'weMail Subscriber Data', 'wemail' ), - 'callback' => [ $this, 'erase_subscriber_data' ], - ]; + 'callback' => array( $this, 'erase_subscriber_data' ), + ); return $erasers; } @@ -164,12 +164,12 @@ public function register_eraser( $erasers = [] ) { * @return array */ public function erase_subscriber_data( $email_address, $page ) { - $response = [ + $response = array( 'items_removed' => false, 'items_retained' => false, - 'messages' => [], + 'messages' => array(), 'done' => true, - ]; + ); wemail_set_owner_api_key(); $subscriber = wemail()->subscriber->get( $email_address ); @@ -198,25 +198,24 @@ public function erase_subscriber_data( $email_address, $page ) { * @return array */ protected function get_subscriber_data( $subscriber ) { - $subscriber_data = []; + $subscriber_data = array(); $meta_fields = wemail()->api->subscribers()->meta()->get(); $meta_fields = $meta_fields['data']; - $ignore_fields = [ 'email' ]; + $ignore_fields = array( 'email' ); foreach ( $meta_fields as $meta_field ) { $meta_name = $meta_field['name']; if ( isset( $subscriber[ $meta_name ] ) && ! in_array( $meta_name, $ignore_fields, true ) ) { - $subscriber_data[] = [ + $subscriber_data[] = array( 'name' => $meta_field['title'], 'value' => $subscriber[ $meta_name ], - ]; + ); } } return $subscriber_data; } - } diff --git a/includes/Rest/Affiliate/Integrations.php b/includes/Rest/Affiliate/Integrations.php index f8d32218..c7e95a8d 100644 --- a/includes/Rest/Affiliate/Integrations.php +++ b/includes/Rest/Affiliate/Integrations.php @@ -29,12 +29,12 @@ public function getAffiliateWpSettings() { $enabled = get_option( 'wemail_affiliatewp_enabled', false ); $rest_url = rest_url( '', 'json' ); return rest_ensure_response( - [ - 'data' => [ + array( + 'data' => array( 'enabled' => $enabled, 'rest_url' => $rest_url, - ], - ] + ), + ) ); } @@ -46,11 +46,11 @@ public function postAffiliateWpSettings( $request ) { $checked = $request->get_param( 'checked' ); update_option( 'wemail_affiliatewp_enabled', $checked ); return rest_ensure_response( - [ - 'data' => [ + array( + 'data' => array( 'checked' => $checked, - ], - ] + ), + ) ); } } diff --git a/includes/Rest/Auth.php b/includes/Rest/Auth.php index f4497deb..512b0e30 100644 --- a/includes/Rest/Auth.php +++ b/includes/Rest/Auth.php @@ -42,7 +42,7 @@ public function site( $request ) { return $authenticate; } - return $this->respond( [ 'success' => true ], self::HTTP_CREATED ); + return $this->respond( array( 'success' => true ), self::HTTP_CREATED ); } /** @@ -78,5 +78,4 @@ public function permission_for_validate_me( $request ) { public function validate_me( $request ) { return $this->respond(); } - } diff --git a/includes/Rest/Countries.php b/includes/Rest/Countries.php index 40566248..0bc5834a 100644 --- a/includes/Rest/Countries.php +++ b/includes/Rest/Countries.php @@ -19,13 +19,13 @@ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, - [ - [ + array( + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'countries' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'countries' ), + ), + ) ); } @@ -35,12 +35,11 @@ public function permission( $request ) { public function countries() { $response = rest_ensure_response( - [ + array( 'data' => wemail_get_countries(), - ] + ) ); return $response; } - } diff --git a/includes/Rest/Csv.php b/includes/Rest/Csv.php index 4d09158d..c2578127 100644 --- a/includes/Rest/Csv.php +++ b/includes/Rest/Csv.php @@ -21,55 +21,55 @@ public function register_routes() { register_rest_route( $this->namespace, $this->rest_base, - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'CSV file attachment id', 'wemail' ), 'type' => 'integer', - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'csv_file_info' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'csv_file_info' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/meta-fields', - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'CSV file attachment id', 'wemail' ), 'type' => 'integer', - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'meta_fields' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'meta_fields' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/subscribers', - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'CSV file attachment id', 'wemail' ), 'type' => 'integer', - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'subscribers' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'subscribers' ), + ), + ) ); } @@ -78,11 +78,11 @@ public function permission( $request ) { if ( ! empty( $api_key ) ) { $query = new WP_User_Query( - [ + array( 'fields' => 'ID', 'meta_key' => 'wemail_api_key', 'meta_value' => $api_key, - ] + ) ); if ( $query->get_total() ) { @@ -111,9 +111,9 @@ public function csv_file_info( $request ) { $query = $reader->query(); - $data = [ + $data = array( 'total' => iterator_count( $query ) - 1, - ]; + ); return new WP_REST_Response( $data, 200 ); } @@ -127,9 +127,9 @@ public function meta_fields( $request ) { $meta_fields = $reader->fetchOne(); - $data = [ + $data = array( 'fields' => $meta_fields, - ]; + ); return new WP_REST_Response( $data, 200 ); } @@ -153,11 +153,10 @@ public function subscribers( $request ) { ->setLimit( $limit ) ->fetchAssoc( $meta_fields ); - $data = [ + $data = array( 'subscribers' => $subscribers, - ]; + ); return new WP_REST_Response( $data, 200 ); } - } diff --git a/includes/Rest/Customizer.php b/includes/Rest/Customizer.php index 8dafe55a..b44f6aa0 100644 --- a/includes/Rest/Customizer.php +++ b/includes/Rest/Customizer.php @@ -19,20 +19,20 @@ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, - [ - 'args' => [ - 'context' => [ + array( + 'args' => array( + 'context' => array( 'description' => __( 'Customizer context like campaign, wp, woocommerce etc', 'wemail' ), 'type' => 'string', 'required' => true, - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'data' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'data' ), + ), + ) ); } @@ -42,9 +42,9 @@ public function permission( $request ) { public function data( $request ) { return rest_ensure_response( - [ + array( 'data' => wemail()->campaign->editor->get_customizer_data( $request['context'] ), - ] + ) ); } } diff --git a/includes/Rest/ERP.php b/includes/Rest/ERP.php index 75b82a61..fec1ede2 100644 --- a/includes/Rest/ERP.php +++ b/includes/Rest/ERP.php @@ -45,24 +45,24 @@ public function contact_groups( $request ) { return $is_erp_crm_active; } - $args = [ + $args = array( 'number' => -1, 'orderby' => 'created_at', 'order' => 'asc', - ]; + ); $items = erp_crm_get_contact_groups( $args ); - $groups = []; + $groups = array(); foreach ( $items as $item ) { - $groups[] = [ + $groups[] = array( 'id' => $item->id, 'name' => $item->name, - ]; + ); } - return rest_ensure_response( [ 'data' => $groups ] ); + return rest_ensure_response( array( 'data' => $groups ) ); } /** @@ -97,7 +97,10 @@ public function contacts( $request ) { $query = $db->table( 'erp_peoples as people' ) ->select( 'people.*' ) - ->leftJoin( "{$prefix}erp_people_type_relations as rel", function ( $join ) { $join->on( 'people.id', '=', 'rel.people_id' ); } ) + ->leftJoin( + "{$prefix}erp_people_type_relations as rel", function ( $join ) { + $join->on( 'people.id', '=', 'rel.people_id' ); } + ) ->where( 'rel.people_types_id', $type_id ) ->whereNull( 'rel.deleted_at' ); @@ -113,7 +116,7 @@ public function contacts( $request ) { $contacts = $query->orderBy( 'people.id', 'asc' )->get(); - $subscriptions = []; + $subscriptions = array(); if ( $contacts->count() ) { $contact_ids = $contacts->pluck( 'id' ); @@ -130,7 +133,7 @@ function ( $contact ) use ( $subscriptions ) { if ( isset( $subscriptions[ $contact->id ] ) ) { $contact->groups = $subscriptions[ $contact->id ]; } else { - $contact->groups = []; + $contact->groups = array(); } return $contact; @@ -139,9 +142,9 @@ function ( $contact ) use ( $subscriptions ) { } return rest_ensure_response( - [ + array( 'data' => $contacts, - ] + ) ); } diff --git a/includes/Rest/Ecommerce/Ecommerce.php b/includes/Rest/Ecommerce/Ecommerce.php index 2587db39..43d59d28 100644 --- a/includes/Rest/Ecommerce/Ecommerce.php +++ b/includes/Rest/Ecommerce/Ecommerce.php @@ -36,11 +36,11 @@ public function settings( $request ) { $platform = wemail()->ecommerce->platform( $platform ); $body = array_merge( - $body, [ + $body, array( 'currency' => $platform->currency(), 'currency_symbol' => $platform->currency_symbol(), 'platform' => $platform->get_name(), - ] + ) ); // Update settings to wp options Settings::instance()->update( $body ); @@ -74,9 +74,9 @@ public function resource( $request ) { if ( ! $platform->is_active() ) { return new \WP_REST_Response( - [ + array( 'message' => sprintf( '%s plugin is not active', $platform->get_name() ), - ], 422 + ), 422 ); } @@ -95,9 +95,9 @@ public function disconnect() { Settings::instance()->delete(); $response = wemail()->api->ecommerce()->disconnect()->post( - [ + array( '_method' => 'delete', - ] + ) ); if ( is_wp_error( $response ) ) { diff --git a/includes/Rest/Forms.php b/includes/Rest/Forms.php index 567464ab..c2e46a2d 100644 --- a/includes/Rest/Forms.php +++ b/includes/Rest/Forms.php @@ -20,104 +20,104 @@ public function register_routes() { register_rest_route( $this->namespace, $this->rest_base, - [ - [ + array( + array( 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'store' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'store' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base, - [ - [ + array( + array( 'methods' => WP_REST_Server::DELETABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'destroy' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'destroy' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/restore', - [ - [ + array( + array( 'methods' => WP_REST_Server::EDITABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'restore' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'restore' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/sync', - [ - [ + array( + array( 'methods' => WP_REST_Server::EDITABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'sync' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'sync' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/(?P[\w-]+)/update', - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'Form ID', 'wemail' ), 'type' => 'string', 'required' => true, - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::EDITABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'update' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'update' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/(?P[\w-]+)', - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'Form ID', 'wemail' ), 'type' => 'string', - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'submit' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'submit' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/(?P[\w-]+)/visitors', - [ - 'args' => [ - 'id' => [ + array( + 'args' => array( + 'id' => array( 'description' => __( 'Form ID', 'wemail' ), 'type' => 'string', - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::EDITABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'increment_visitor' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'increment_visitor' ), + ), + ) ); } @@ -139,11 +139,11 @@ public function submit( $request ) { return new WP_Error( 'invalid_form_data', __( 'Invalid form data', 'wemail' ), - [ 'status' => 422 ] + array( 'status' => 422 ) ); } - $submitted_data = []; + $submitted_data = array(); foreach ( $data as $form_input ) { $field_id = str_replace( 'wemail_form_field_', '', $form_input['name'] ); @@ -190,7 +190,7 @@ public function store( $request ) { wemail()->form->create( $data ); - return new WP_REST_Response( [ 'success' => true ], 201 ); + return new WP_REST_Response( array( 'success' => true ), 201 ); } /** @@ -209,7 +209,7 @@ public function update( $request ) { wemail()->form->update( $data, $id ); - return new WP_REST_Response( [ 'success' => true ] ); + return new WP_REST_Response( array( 'success' => true ) ); } /** @@ -225,7 +225,7 @@ public function destroy( $request ) { wemail()->form->delete( $ids, wemail_validate_boolean( $soft_delete ) ); - return new WP_REST_Response( [ 'success' => true ] ); + return new WP_REST_Response( array( 'success' => true ) ); } /** @@ -238,9 +238,9 @@ public function destroy( $request ) { public function restore( $request ) { $ids = $request->get_param( 'ids' ); - wemail()->form->update( [ 'deleted_at' => null ], $ids ); + wemail()->form->update( array( 'deleted_at' => null ), $ids ); - return new WP_REST_Response( [ 'success' => true ] ); + return new WP_REST_Response( array( 'success' => true ) ); } /** @@ -253,6 +253,6 @@ public function restore( $request ) { public function sync( $request ) { wemail()->form->sync(); - return new WP_REST_Response( [ 'success' => true ] ); + return new WP_REST_Response( array( 'success' => true ) ); } } diff --git a/includes/Rest/Help/Help.php b/includes/Rest/Help/Help.php index ef027f44..19844078 100644 --- a/includes/Rest/Help/Help.php +++ b/includes/Rest/Help/Help.php @@ -16,49 +16,49 @@ public function register_routes() { register_rest_route( $this->namespace, $this->rest_base . '/system-info', - [ - [ + array( + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'can_view_wemail' ], - 'callback' => [ $this, 'index' ], - ], - ] + 'permission_callback' => array( $this, 'can_view_wemail' ), + 'callback' => array( $this, 'index' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/tools/ping/send', - [ - [ + array( + array( 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'can_view_wemail' ], - 'callback' => [ $this, 'send_ping' ], - ], - ] + 'permission_callback' => array( $this, 'can_view_wemail' ), + 'callback' => array( $this, 'send_ping' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/tools/ping/receive', - [ - [ + array( + array( 'methods' => WP_REST_Server::CREATABLE, - 'permission_callback' => [ $this, 'can_view_wemail' ], - 'callback' => [ $this, 'receive_ping' ], - ], - ] + 'permission_callback' => array( $this, 'can_view_wemail' ), + 'callback' => array( $this, 'receive_ping' ), + ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/tools/disconnect', - [ - [ + array( + array( 'methods' => WP_REST_Server::DELETABLE, - 'permission_callback' => [ $this, 'manage_options' ], - 'callback' => [ $this, 'disconnect_wemail' ], - ], - ] + 'permission_callback' => array( $this, 'manage_options' ), + 'callback' => array( $this, 'disconnect_wemail' ), + ), + ) ); } @@ -70,9 +70,9 @@ public function index() { $system = new SystemInfo(); return rest_ensure_response( - [ + array( 'data' => $system->allInfo(), - ] + ) ); } @@ -106,9 +106,9 @@ public function disconnect_wemail() { delete_metadata( 'user', 0, 'wemail_user_data', '', true ); return new \WP_REST_Response( - [ + array( 'status' => 'success', - ] + ) ); } } diff --git a/includes/Rest/MailPoet.php b/includes/Rest/MailPoet.php index b2c7a42a..2f4f098c 100644 --- a/includes/Rest/MailPoet.php +++ b/includes/Rest/MailPoet.php @@ -50,31 +50,31 @@ public function register_routes() { register_rest_route( $this->namespace, $this->rest_base . '/lists', - [ + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'lists' ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'lists' ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/lists/(?P[\d]+)/subscribers', - [ + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'subscribers' ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'subscribers' ), + ) ); register_rest_route( $this->namespace, $this->rest_base . '/meta-fields', - [ + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'meta_fields' ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'meta_fields' ), + ) ); } @@ -92,11 +92,11 @@ public function permission( $request ) { if ( ! empty( $api_key ) ) { $query = new WP_User_Query( - [ + array( 'fields' => 'ID', 'meta_key' => 'wemail_api_key', 'meta_value' => $api_key, - ] + ) ); if ( $query->get_total() ) { @@ -123,22 +123,22 @@ public function permission( $request ) { * @return \WP_Error|\WP_REST_Response|void */ public function __call( $name, $args ) { - $callbacks = [ 'lists', 'meta_fields', 'subscribers' ]; + $callbacks = array( 'lists', 'meta_fields', 'subscribers' ); if ( in_array( $name, $callbacks, true ) ) { $active_version = $this->active_version(); if ( ! $active_version ) { - return new WP_Error( 'mailpoet_is_not_active', __( 'MailPoet is not active', 'wemail' ), [ 'status' => 422 ] ); + return new WP_Error( 'mailpoet_is_not_active', __( 'MailPoet is not active', 'wemail' ), array( 'status' => 422 ) ); } $method = ( $active_version === 'v3' ) ? "{$name}_v3" : "{$name}_v2"; $request = $args[0]; - $data = [ + $data = array( $name => $this->$method( $request ), - ]; + ); return new WP_REST_Response( $data, 200 ); } @@ -183,11 +183,11 @@ private function lists_v3() { return array_map( function ( $id ) use ( $lists, $stats ) { - return [ + return array( 'id' => $id, 'name' => $lists[ $id ], 'count' => intval( $stats[ $id ] ), - ]; + ); }, array_keys( $stats ) ); @@ -207,17 +207,17 @@ private function lists_v2() { $users = \WYSIJA::get( 'user', 'model' ); - $data = []; + $data = array(); foreach ( $lists as $list ) { $list_id = absint( $list['list_id'] ); - $count = absint( $users->countSubscribers( [ $list_id ] ) ); + $count = absint( $users->countSubscribers( array( $list_id ) ) ); - $data[] = [ + $data[] = array( 'id' => $list_id, 'name' => $list['name'], 'count' => $count, - ]; + ); } return $data; @@ -231,15 +231,15 @@ private function lists_v2() { * @return array */ private function meta_fields_v3() { - $data = []; + $data = array(); $fields = \MailPoet\API\API::MP( 'v1' )->getSubscriberFields(); foreach ( $fields as $field ) { - $data[] = [ + $data[] = array( 'name' => $field['id'], 'title' => $field['name'], - ]; + ); } return $data; @@ -253,17 +253,17 @@ private function meta_fields_v3() { * @return array */ private function meta_fields_v2() { - $data = []; + $data = array(); $user = \WYSIJA::get( 'user_field', 'model' ); $fields = $user->getFields(); foreach ( $fields as $name => $title ) { - $data[] = [ + $data[] = array( 'name' => $name, 'title' => $title, - ]; + ); } return $data; @@ -295,7 +295,7 @@ private function subscribers_v3( $request ) { */ private function subscribers_v2( $request ) { if ( empty( $request['id'] ) ) { - return new WP_Error( 'required_field', __( 'List id is missing', 'wemail' ), [ 'status' => 422 ] ); + return new WP_Error( 'required_field', __( 'List id is missing', 'wemail' ), array( 'status' => 422 ) ); } // get subscribers @@ -318,7 +318,7 @@ private function subscribers_v2( $request ) { $select = array( 'A.*, B.sub_date, B.unsub_date' ); - $filters = []; + $filters = array(); $filters['lists'] = $request['id']; diff --git a/includes/Rest/Middleware/WeMailMiddleware.php b/includes/Rest/Middleware/WeMailMiddleware.php index c4a80505..fb72723a 100644 --- a/includes/Rest/Middleware/WeMailMiddleware.php +++ b/includes/Rest/Middleware/WeMailMiddleware.php @@ -25,11 +25,11 @@ public function handle( $request ) { if ( ! empty( $api_key ) ) { $query = new WP_User_Query( - [ + array( 'fields' => 'ID', 'meta_key' => 'wemail_api_key', 'meta_value' => $api_key, - ] + ) ); if ( $query->get_total() ) { diff --git a/includes/Rest/Pages.php b/includes/Rest/Pages.php index 7fd19667..188ab007 100644 --- a/includes/Rest/Pages.php +++ b/includes/Rest/Pages.php @@ -19,13 +19,13 @@ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, - [ - [ + array( + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'index' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'index' ), + ), + ) ); } @@ -42,18 +42,18 @@ public function index() { ); return rest_ensure_response( - [ + array( 'data' => array_map( function ( $page ) { - return [ + return array( 'id' => $page->ID, 'title' => $page->post_title, 'permalink' => get_permalink( $page->ID ), - ]; + ); }, get_pages( $args ) ), - ] + ) ); } } diff --git a/includes/Rest/Resources/Ecommerce/EDD/OrderItemResource.php b/includes/Rest/Resources/Ecommerce/EDD/OrderItemResource.php index d4105831..f7946eab 100644 --- a/includes/Rest/Resources/Ecommerce/EDD/OrderItemResource.php +++ b/includes/Rest/Resources/Ecommerce/EDD/OrderItemResource.php @@ -12,7 +12,7 @@ class OrderItemResource extends JsonResource { public function blueprint( $resource ) { $thumbnail = get_the_post_thumbnail_url( $resource['id'], 'thumbnail' ); - return [ + return array( 'id' => (string) $resource['id'], 'parent_id' => null, 'name' => $resource['name'], @@ -21,7 +21,7 @@ public function blueprint( $resource ) { 'thumbnail' => $thumbnail ? $thumbnail : null, 'categories' => $this->get_categories( $resource['id'] ), 'permalink' => get_permalink( $resource['id'] ), - ]; + ); } protected function get_categories( $id ) { @@ -30,7 +30,7 @@ protected function get_categories( $id ) { return array_map( function ( $term ) { return $term->term_id; - }, is_array( $terms ) ? $terms : [] + }, is_array( $terms ) ? $terms : array() ); } } diff --git a/includes/Rest/Resources/Ecommerce/EDD/OrderResource.php b/includes/Rest/Resources/Ecommerce/EDD/OrderResource.php index fac833ba..ca9a3ab0 100644 --- a/includes/Rest/Resources/Ecommerce/EDD/OrderResource.php +++ b/includes/Rest/Resources/Ecommerce/EDD/OrderResource.php @@ -14,7 +14,7 @@ public function blueprint( $resource ) { /** @var WP_Post $resource */ $payment = new EDD_Payment( $resource->ID ); - return [ + return array( 'id' => (string) $payment->transaction_id, 'parent_id' => $payment->parent_payment ? (string) $payment->parent_payment : null, 'customer_id' => $this->customer_id( $payment->user_info['email'] ), @@ -29,7 +29,7 @@ public function blueprint( $resource ) { 'permalink' => add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=download&page=edd-payment-history&view=view-order-details' ) ), 'source' => 'edd', 'type' => $this->is_refund( $resource->post_status ) ? 'refund' : 'order', - ]; + ); } /** @@ -51,7 +51,7 @@ public function customer_id( $email ) { * @return array */ protected function customer( $customer ) { - return [ + return array( 'first_name' => $customer['first_name'], 'last_name' => $customer['last_name'], 'email' => $customer['email'], @@ -61,7 +61,7 @@ protected function customer( $customer ) { 'state' => isset( $customer['address']['state'] ) ? $customer['address']['state'] : null, 'zip' => isset( $customer['address']['zip'] ) ? $customer['address']['zip'] : null, 'country' => isset( $customer['address']['country'] ) ? $customer['address']['country'] : null, - ]; + ); } /** diff --git a/includes/Rest/Resources/Ecommerce/EDD/OrderResourceV3.php b/includes/Rest/Resources/Ecommerce/EDD/OrderResourceV3.php index 50c06d2d..76490e54 100644 --- a/includes/Rest/Resources/Ecommerce/EDD/OrderResourceV3.php +++ b/includes/Rest/Resources/Ecommerce/EDD/OrderResourceV3.php @@ -17,7 +17,7 @@ public function blueprint( $resource ) { /** @var EDD_Payment $resource */ $is_order = $resource->order->type === 'sale'; - $data = [ + $data = array( 'id' => (string) $resource->ID, 'parent_id' => $resource->parent_payment ? (string) $resource->parent_payment : null, 'customer_id' => $this->customer_id( $resource->user_info['email'] ), @@ -31,7 +31,7 @@ public function blueprint( $resource ) { 'created_at' => $resource->order->date_created, 'updated_at' => $resource->order->date_modified, 'source' => 'edd', - ]; + ); if ( $is_order ) { $data['customer'] = $this->customer( $resource->user_info ); diff --git a/includes/Rest/Resources/Ecommerce/EDD/ProductResource.php b/includes/Rest/Resources/Ecommerce/EDD/ProductResource.php index 3cc6e796..1fe04c71 100644 --- a/includes/Rest/Resources/Ecommerce/EDD/ProductResource.php +++ b/includes/Rest/Resources/Ecommerce/EDD/ProductResource.php @@ -16,7 +16,7 @@ public function blueprint( $resource ) { $download = new EDD_Download( $resource->ID ); - return [ + return array( 'id' => (string) $resource->ID, 'parent_id' => (string) $resource->post_parent, 'name' => $resource->post_title, @@ -26,7 +26,7 @@ public function blueprint( $resource ) { 'thumbnail' => $this->get_thumbnail( $resource ), 'categories' => $this->get_categories( $resource->ID ), 'source' => 'edd', - ]; + ); } /** @@ -55,7 +55,7 @@ protected function get_categories( $id ) { return array_map( function ( $term ) { return $term->term_id; - }, is_array( $terms ) ? $terms : [] + }, is_array( $terms ) ? $terms : array() ); } } diff --git a/includes/Rest/Resources/Ecommerce/WooCommerce/CategoryResource.php b/includes/Rest/Resources/Ecommerce/WooCommerce/CategoryResource.php index e976414f..5e76b003 100644 --- a/includes/Rest/Resources/Ecommerce/WooCommerce/CategoryResource.php +++ b/includes/Rest/Resources/Ecommerce/WooCommerce/CategoryResource.php @@ -16,9 +16,9 @@ class CategoryResource extends JsonResource { * @return mixed|void */ public function blueprint( $resource ) { - return [ + return array( 'id' => $resource->term_id, 'name' => $resource->name, - ]; + ); } } diff --git a/includes/Rest/Resources/Ecommerce/WooCommerce/OrderItemResource.php b/includes/Rest/Resources/Ecommerce/WooCommerce/OrderItemResource.php index 90532d05..5926fbf4 100644 --- a/includes/Rest/Resources/Ecommerce/WooCommerce/OrderItemResource.php +++ b/includes/Rest/Resources/Ecommerce/WooCommerce/OrderItemResource.php @@ -17,7 +17,7 @@ public function blueprint( $order_item ) { $permalink = $product->get_permalink(); $thumbnail = wp_get_attachment_image_url( $product->get_image_id() ); - return [ + return array( 'id' => (string) $product->get_id(), 'parent_id' => (string) $product->get_parent_id(), 'name' => $order_item->get_name(), @@ -26,6 +26,6 @@ public function blueprint( $order_item ) { 'thumbnail' => $thumbnail ? $thumbnail : null, 'categories' => $product->get_category_ids(), 'permalink' => $permalink ? $permalink : null, - ]; + ); } } diff --git a/includes/Rest/Resources/Ecommerce/WooCommerce/OrderResource.php b/includes/Rest/Resources/Ecommerce/WooCommerce/OrderResource.php index c2c91e2c..4e45b9be 100644 --- a/includes/Rest/Resources/Ecommerce/WooCommerce/OrderResource.php +++ b/includes/Rest/Resources/Ecommerce/WooCommerce/OrderResource.php @@ -28,7 +28,7 @@ public function blueprint( $order ) { } ); - $data = [ + $data = array( 'id' => (string) $order->get_id(), 'parent_id' => $order->get_parent_id() ? (string) $order->get_parent_id() : null, 'products' => OrderItemResource::collection( $items ), @@ -39,16 +39,16 @@ public function blueprint( $order ) { 'type' => $this->get_type( $order->get_type() ), 'created_at' => $order->get_date_created()->setTimezone( new DateTimeZone( 'UTC' ) )->format( self::DATE_FORMAT ), 'updated_at' => $order->get_date_modified()->setTimezone( new DateTimeZone( 'UTC' ) )->format( self::DATE_FORMAT ), - ]; + ); if ( $this->is_refund( $data['type'] ) ) { /** @var $order \Automattic\WooCommerce\Admin\Overrides\OrderRefund */ $data['customer_id'] = $this->get_customer_id( wc_get_order( $order->get_parent_id() )->get_billing_email() ); - $data['permalink'] = get_edit_post_link( $order->get_parent_id(), 'raw' ); + $data['permalink'] = wc_get_order( $order->get_parent_id() )->get_edit_order_url(); $data['completed_at'] = $order->get_date_modified()->setTimezone( new DateTimeZone( 'UTC' ) )->format( self::DATE_FORMAT ); } else { $data['customer'] = $this->customer( $order ); - $data['permalink'] = get_edit_post_link( $order->get_id(), 'raw' ); + $data['permalink'] = $order->get_edit_order_url(); $data['customer_id'] = $this->get_customer_id( $data['customer']['email'] ); $completed_date = $order->get_date_completed(); $data['completed_at'] = $completed_date && $this->is_completed( $this->get_status( $order->get_status() ) ) ? $completed_date->setTimezone( new DateTimeZone( 'UTC' ) )->format( self::DATE_FORMAT ) : null; @@ -65,7 +65,7 @@ public function blueprint( $order ) { * @return array */ protected function customer( $order ) { - return [ + return array( 'first_name' => $order->get_billing_first_name(), 'last_name' => $order->get_billing_last_name(), 'email' => $order->get_billing_email(), @@ -76,7 +76,7 @@ protected function customer( $order ) { 'state' => $order->get_billing_state(), 'zip' => $order->get_billing_postcode(), 'country' => $order->get_billing_country(), - ]; + ); } /** diff --git a/includes/Rest/Resources/Ecommerce/WooCommerce/ProductResource.php b/includes/Rest/Resources/Ecommerce/WooCommerce/ProductResource.php index cffe638f..d9bc7833 100644 --- a/includes/Rest/Resources/Ecommerce/WooCommerce/ProductResource.php +++ b/includes/Rest/Resources/Ecommerce/WooCommerce/ProductResource.php @@ -14,7 +14,7 @@ public function blueprint( $resource ) { $thumbnail = wp_get_attachment_image_url( $resource->get_image_id(), 'woocommerce_thumbnail' ); - return [ + return array( 'id' => (string) $resource->get_id(), 'parent_id' => (string) $resource->get_parent_id(), 'name' => $this->get_resource_name( $resource ), @@ -24,7 +24,7 @@ public function blueprint( $resource ) { 'thumbnail' => $thumbnail ? $thumbnail : null, 'categories' => $resource->get_category_ids(), 'source' => 'woocommerce', - ]; + ); } /** diff --git a/includes/Rest/Resources/JsonResource.php b/includes/Rest/Resources/JsonResource.php index 65f4cade..8a1eca24 100644 --- a/includes/Rest/Resources/JsonResource.php +++ b/includes/Rest/Resources/JsonResource.php @@ -36,7 +36,7 @@ public static function single( $resource ) { public static function collection( array $resources ) { $instance = new static(); - $data = array_map( [ $instance, 'blueprint' ], $resources ); + $data = array_map( array( $instance, 'blueprint' ), $resources ); if ( $instance->reset_keys ) { $data = array_values( $data ); diff --git a/includes/Rest/Rest.php b/includes/Rest/Rest.php index 2d2fb372..633d1036 100644 --- a/includes/Rest/Rest.php +++ b/includes/Rest/Rest.php @@ -36,5 +36,4 @@ public function register_controllers() { new Help(); new AffiliateIntegrations(); } - } diff --git a/includes/Rest/Site.php b/includes/Rest/Site.php index b8a00e2a..a70f7b11 100644 --- a/includes/Rest/Site.php +++ b/includes/Rest/Site.php @@ -66,14 +66,14 @@ public function save_options( $request ) { update_option( "wemail_{$key}", $setting ); } - return rest_ensure_response( [ 'success' => true ] ); + return rest_ensure_response( array( 'success' => true ) ); } public function delete_site() { $this->delete_option_by_prefix( 'wemail_form_integration_' ); - $this->delete_user_metadata( [ 'wemail_api_key', 'wemail_user_data' ] ); + $this->delete_user_metadata( array( 'wemail_api_key', 'wemail_user_data' ) ); - $wemail_options = [ + $wemail_options = array( 'wemail_version', 'wemail_site_slug', 'wemail_accessible_roles', @@ -83,13 +83,13 @@ public function delete_site() { 'wemail_is_edd_synced', 'wemail_woocommerce_integrated', 'wemail_is_woocommerce_synced', - ]; + ); foreach ( $wemail_options as $option ) { delete_option( $option ); } - return rest_ensure_response( [ 'success' => true ] ); + return rest_ensure_response( array( 'success' => true ) ); } public function delete_option_by_prefix( $prefix ) { diff --git a/includes/Rest/States.php b/includes/Rest/States.php index 44f0206b..f8b1e795 100644 --- a/includes/Rest/States.php +++ b/includes/Rest/States.php @@ -19,20 +19,20 @@ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, - [ - 'args' => [ - 'country' => [ + array( + 'args' => array( + 'country' => array( 'description' => __( 'ISO 3166-1 alpha-2 country code', 'wemail' ), 'type' => 'string', 'required' => true, - ], - ], - [ + ), + ), + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'states' ], - ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'states' ), + ), + ) ); } @@ -42,12 +42,11 @@ public function permission( $request ) { public function states( $request ) { $response = rest_ensure_response( - [ + array( 'data' => wemail_get_country_states( $request['country'] ), - ] + ) ); return $response; } - } diff --git a/includes/Rest/Users.php b/includes/Rest/Users.php index f4ad9a93..45ef4dd1 100644 --- a/includes/Rest/Users.php +++ b/includes/Rest/Users.php @@ -28,27 +28,27 @@ public function permissions( $request ) { public function index() { $roles = get_option( 'wemail_accessible_roles', $default = false ); $args = array( - 'role__in' => $roles ? $roles : [ 'administrator', 'editor' ], - 'exclude' => [ get_current_user_id() ], + 'role__in' => $roles ? $roles : array( 'administrator', 'editor' ), + 'exclude' => array( get_current_user_id() ), ); return rest_ensure_response( - [ + array( 'data' => array_map( function ( $user ) { $map = get_user_meta( $user->ID, 'wemail_user_data', null ); $hash = isset( $map[0] ) && isset( $map[0]['hash'] ) ? $map[0]['hash'] : null; - return [ + return array( 'id' => $user->ID, 'name' => $user->display_name, 'email' => $user->user_email, 'roles' => $user->roles, 'hash' => $hash, - ]; + ); }, get_users( $args ) ), - ] + ) ); } @@ -61,20 +61,20 @@ public function store( $request ) { wemail()->api->set_api_key( $access_token[0] ); foreach ( $users as $user ) { - $wp_admin_response = wemail()->api->auth()->users()->post( - [ + $wp_admin_response = wemail()->api->teamUsers()->post( + array( 'name' => $user['name'], 'email' => $user['email'], 'role' => $role, 'include' => 'role,permissions', - ] + ) ); if ( isset( $wp_admin_response['access_token'] ) && $wp_admin_response['access_token'] !== '' ) { update_user_meta( $user['id'], 'wemail_api_key', $wp_admin_response['access_token'] ); if ( isset( $wp_admin_response['data'] ) ) { $response = $wp_admin_response['data']; - $user_meta = [ + $user_meta = array( 'deleted_at' => $response['deleted_at'], 'email' => $response['email'], 'hash' => $response['hash'], @@ -82,16 +82,16 @@ public function store( $request ) { 'permissions' => $response['permissions'], 'role' => $response['role'], 'roles' => $response['roles'], - ]; + ); update_user_meta( $user['id'], 'wemail_user_data', $user_meta ); } } } - return $this->respond( [ 'success' => true ], self::HTTP_CREATED ); + return $this->respond( array( 'success' => true ), self::HTTP_CREATED ); } - return $this->respond( [ 'message' => 'Access token not found' ], 422 ); + return $this->respond( array( 'message' => 'Access token not found' ), 422 ); } public function update( $request ) { @@ -102,17 +102,17 @@ public function update( $request ) { if ( $access_token ) { wemail()->api->set_api_key( $access_token[0] ); foreach ( $users as $user ) { - $response = wemail()->api->auth()->users()->move()->post( - [ + $response = wemail()->api->teamUsers()->update()->put( + array( 'email' => $user, 'role' => $role, 'include' => 'role,permissions', - ] + ) ); $wp_user = get_user_by( 'email', $user ); if ( isset( $wp_user->ID ) ) { - $user_meta = [ + $user_meta = array( 'deleted_at' => $response['data']['deleted_at'], 'email' => $response['data']['email'], 'hash' => $response['data']['hash'], @@ -120,15 +120,15 @@ public function update( $request ) { 'permissions' => $response['data']['permissions'], 'role' => $response['data']['role'], 'roles' => $response['data']['roles'], - ]; + ); update_user_meta( $wp_user->ID, 'wemail_user_data', $user_meta ); } } - return $this->respond( [ 'success' => true ], self::HTTP_CREATED ); + return $this->respond( array( 'success' => true ), self::HTTP_CREATED ); } - return $this->respond( [ 'message' => 'Access token not found' ], 422 ); + return $this->respond( array( 'message' => 'Access token not found' ), 422 ); } public function toggleStatus( $request ) { @@ -136,11 +136,11 @@ public function toggleStatus( $request ) { $status = $request->get_param( 'status' ); $user = get_user_by( 'email', $email ); if ( $user ) { - $wp_admin_response = wemail()->api->auth()->users()->status()->post( - [ + $wp_admin_response = wemail()->api->team()->users()->status()->post( + array( 'email' => $email, 'status' => $status, - ] + ) ); if ( $wp_admin_response['success'] ) { if ( isset( $wp_admin_response['token'] ) ) { @@ -153,16 +153,16 @@ public function toggleStatus( $request ) { delete_user_meta( $user->ID, 'wemail_disable_user_access' ); } - return $this->respond( [ 'message' => 'User status changed' ], 200 ); + return $this->respond( array( 'message' => 'User status changed' ), 200 ); } - return $this->respond( [ 'message' => $wp_admin_response ], 422 ); + return $this->respond( array( 'message' => $wp_admin_response ), 422 ); } return $this->respond( - [ + array( 'message' => 'User was not found in your site.It maybe removed previously.', - ], + ), 422 ); } @@ -170,26 +170,23 @@ public function toggleStatus( $request ) { public function roles() { $accessible_roles = get_option( 'wemail_accessible_roles', $default = false ); $roles = wp_roles(); - $available_roles = []; + $available_roles = array(); foreach ( $roles->roles as $key => $role ) { if ( $key !== 'subscriber' ) { - array_push( - $available_roles, - [ - 'slug' => $key, - 'name' => $role['name'], - ] + $available_roles[] = array( + 'slug' => $key, + 'name' => $role['name'], ); } } return $this->respond( - [ - 'data' => [ + array( + 'data' => array( 'roles' => $available_roles, - 'accessible_roles' => $accessible_roles ? $accessible_roles : [ 'administrator', 'editor' ], - ], - ], + 'accessible_roles' => $accessible_roles ? $accessible_roles : array( 'administrator', 'editor' ), + ), + ), 200 ); } @@ -199,6 +196,6 @@ public function storeRoles( $request ) { update_option( 'wemail_accessible_roles', $roles ); - return $this->respond( [ 'success' => true ], 200 ); + return $this->respond( array( 'success' => true ), 200 ); } } diff --git a/includes/Rest/Video.php b/includes/Rest/Video.php index f67bbbe1..75153137 100644 --- a/includes/Rest/Video.php +++ b/includes/Rest/Video.php @@ -21,11 +21,11 @@ public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, - [ + array( 'methods' => WP_REST_Server::READABLE, - 'permission_callback' => [ $this, 'permission' ], - 'callback' => [ $this, 'thumb' ], - ] + 'permission_callback' => array( $this, 'permission' ), + 'callback' => array( $this, 'thumb' ), + ) ); } @@ -41,7 +41,7 @@ public function thumb( $request ) { return new WP_Error( 'invalid_request', __( 'source and video_id fields are required', 'wemail' ), - [ 'status' => 400 ] + array( 'status' => 400 ) ); } @@ -57,7 +57,7 @@ public function thumb( $request ) { } } - return rest_ensure_response( [ 'image' => $image_link ] ); + return rest_ensure_response( array( 'image' => $image_link ) ); } /** @@ -70,17 +70,17 @@ public function thumb( $request ) { */ protected function get_existing_thumbnail( $source, $video_id ) { $query = new WP_Query( - [ + array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'posts_per_page' => 1, - 'meta_query' => [ - [ + 'meta_query' => array( + array( 'key' => sprintf( 'wemail_%s_id', $source ), 'value' => $video_id, - ], - ], - ] + ), + ), + ) ); if ( ! $query->have_posts() ) { @@ -108,7 +108,7 @@ protected function get_preview_image( $source, $video_id ) { return new WP_Error( 'invalid_request', $body->message, - [ 'status' => wp_remote_retrieve_response_code( $response ) ] + array( 'status' => wp_remote_retrieve_response_code( $response ) ) ); } $content_type = wp_remote_retrieve_header( $response, 'content-type' ); diff --git a/includes/Rest/WP.php b/includes/Rest/WP.php index 0a3f261a..638528cc 100644 --- a/includes/Rest/WP.php +++ b/includes/Rest/WP.php @@ -50,18 +50,18 @@ public function register_routes() { * @since 1.0.0 */ public function post_types( $request ) { - $post_types = []; - $registered_types = get_post_types( [ 'public' => true ], 'objects' ); + $post_types = array(); + $registered_types = get_post_types( array( 'public' => true ), 'objects' ); foreach ( $registered_types as $name => $object ) { if ( $object->name === 'attachment' || $object->name === 'product' ) { continue; } - $post_types[] = [ + $post_types[] = array( 'name' => $object->name, 'label' => $object->label, - ]; + ); } return rest_ensure_response( $post_types ); @@ -84,12 +84,12 @@ public function posts( $request ) { $limit = empty( $limit ) ? 5 : $limit; - $args = [ + $args = array( 'post_type' => ! empty( $post_type ) ? $post_type : 'post', 's' => $search, 'posts_per_page' => $limit, 'ignore_sticky_posts' => true, - ]; + ); if ( ! empty( $category_id ) ) { $args['cat'] = $category_id; @@ -106,7 +106,7 @@ public function posts( $request ) { function ( WP_Post $post ) use ( $query ) { $query->the_post(); - return [ + return array( 'id' => get_the_ID(), 'image' => get_the_post_thumbnail_url(), 'title' => html_entity_decode( get_the_title() ), @@ -115,13 +115,13 @@ function ( WP_Post $post ) use ( $query ) { 'url' => get_permalink(), 'content' => get_the_content(), 'excerpt' => html_entity_decode( get_the_excerpt() ), - 'meta' => [ + 'meta' => array( 'tags' => $this->get_tags( get_the_tags() ), 'postDate' => get_the_date( 'Y-m-d' ), 'author' => get_the_author(), 'categories' => $this->get_categories( get_the_category() ), - ], - ]; + ), + ); }, $query->query( $args ) ); @@ -139,18 +139,18 @@ function ( WP_Post $post ) use ( $query ) { public function user_roles( $request ) { global $wp_roles; - $user_roles = []; + $user_roles = array(); $roles = $wp_roles->get_names(); foreach ( $roles as $name => $title ) { - $user_roles[] = [ + $user_roles[] = array( 'name' => $name, 'title' => $title, - ]; + ); } - return rest_ensure_response( [ 'data' => $user_roles ] ); + return rest_ensure_response( array( 'data' => $user_roles ) ); } /** @@ -165,12 +165,12 @@ public function users( $request ) { $roles = $request->get_param( 'roles' ); $include = $request->get_param( 'include' ); - $args = [ - 'role__in' => ! empty( $roles ) ? $roles : [], + $args = array( + 'role__in' => ! empty( $roles ) ? $roles : array(), 'orderby' => 'ID', 'order' => 'ASC', 'fields' => 'all_with_meta', - ]; + ); if ( empty( $include ) ) { /** @@ -189,23 +189,23 @@ public function users( $request ) { $this->user_query_after_id = $request->get_param( 'after_id' ); - add_action( 'pre_user_query', [ $this, 'pre_user_query' ] ); + add_action( 'pre_user_query', array( $this, 'pre_user_query' ) ); $user_query = new \WP_User_Query( $args ); $wp_users = $user_query->get_results(); - remove_action( 'pre_user_query', [ $this, 'pre_user_query' ] ); + remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) ); - $users = []; + $users = array(); foreach ( $wp_users as $user ) { - $users[] = [ + $users[] = array( 'ID' => $user->ID, 'first_name' => $user->get( 'first_name' ), 'last_name' => $user->get( 'last_name' ), 'user_email' => $user->user_email, 'user_login' => $user->user_login, - ]; + ); } return rest_ensure_response( $users ); @@ -250,10 +250,10 @@ public function terms( \WP_REST_Request $request ) { $taxonomy = $request->get_param( 'taxonomy' ); $terms = get_terms( - [ + array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, - ] + ) ); return new \WP_REST_Response( $terms ); @@ -268,19 +268,19 @@ public function terms( \WP_REST_Request $request ) { public function products( $request ) { if ( ! class_exists( 'WooCommerce' ) ) { return rest_ensure_response( - [ - 'data' => (object) [], + array( + 'data' => (object) array(), 'message' => __( 'Please install or active woocomerce plugin.', 'wemail' ), - ] + ) ); } - $args = [ + $args = array( 'limit' => 20, 's' => $request->get_param( 's' ), - ]; + ); - $products = []; + $products = array(); $query = wc_get_products( $args ); @@ -291,7 +291,7 @@ public function products( $request ) { $post_thumb_id = get_post_thumbnail_id( $id ); $image = wemail_get_image_url( $post_thumb_id ); - $products[] = [ + $products[] = array( 'id' => $product->get_id(), 'name' => $product->get_name(), 'type' => $product->get_type(), @@ -302,14 +302,14 @@ public function products( $request ) { 'short_description' => $product->get_short_description(), 'price' => wc_price( $product->get_price() ), 'read_more' => get_permalink( $id ), - ]; + ); } return rest_ensure_response( - [ + array( 'data' => $products, 'message' => __( 'You don\'t have any products on your store.', 'wemail' ), - ] + ) ); } diff --git a/includes/RestController.php b/includes/RestController.php index 275c3785..8116cbb7 100644 --- a/includes/RestController.php +++ b/includes/RestController.php @@ -176,7 +176,7 @@ public function manage_options( $request ) { * * @return \WP_REST_Response */ - public function respond( $data = null, $status = self::HTTP_OK, $headers = [] ) { + public function respond( $data = null, $status = self::HTTP_OK, $headers = array() ) { return new WP_REST_Response( $data, $status, $headers ); } @@ -192,11 +192,11 @@ public function respond( $data = null, $status = self::HTTP_OK, $headers = [] ) * * @return \WP_Error */ - public function respond_error( $message = '', $code = '', $status = self::HTTP_UNPROCESSABLE_ENTITY, $args = [] ) { + public function respond_error( $message = '', $code = '', $status = self::HTTP_UNPROCESSABLE_ENTITY, $args = array() ) { $code = ! empty( $code ) ? $code : 'unprocessable_error'; - $data = [ 'status' => $status ]; + $data = array( 'status' => $status ); - $data['data'] = ! empty( $args['data'] ) ? $args['data'] : []; + $data['data'] = ! empty( $args['data'] ) ? $args['data'] : array(); return new WP_Error( $code, $message, $data ); } @@ -279,13 +279,13 @@ protected function register_route( $method, $endpoint, $callback, $permission_cb register_rest_route( $this->namespace, '/' . $route, - [ - [ + array( + array( 'methods' => $methods, - 'callback' => [ $this, $callback ], - 'permission_callback' => [ $this, $permission_cb ], - ], - ] + 'callback' => array( $this, $callback ), + 'permission_callback' => array( $this, $permission_cb ), + ), + ) ); } @@ -307,11 +307,11 @@ protected function set_current_user( $request ) { if ( ! empty( $api_key ) ) { $query = new WP_User_Query( - [ + array( 'fields' => 'ID', 'meta_key' => 'wemail_api_key', 'meta_value' => $api_key, - ] + ) ); if ( $query->get_total() ) { @@ -343,5 +343,4 @@ private function route( $route ) { return preg_replace( $pattern, $replacement, $route ); } - } diff --git a/includes/Traits/Ajax.php b/includes/Traits/Ajax.php index bd8640f5..541d4d9a 100644 --- a/includes/Traits/Ajax.php +++ b/includes/Traits/Ajax.php @@ -22,10 +22,10 @@ protected function add_ajax_action( $tag, $method = null, $nopriv = false ) { $tag = $tag . '_' . $method; } - add_action( 'wp_ajax_wemail_' . $tag, [ $this, $method ] ); + add_action( 'wp_ajax_wemail_' . $tag, array( $this, $method ) ); if ( $nopriv ) { - add_action( 'wp_ajax_nopriv_wemail_' . $tag, [ $this, $method ] ); + add_action( 'wp_ajax_nopriv_wemail_' . $tag, array( $this, $method ) ); } } @@ -69,5 +69,4 @@ public function send_success( $data = null ) { public function send_error( $data = null ) { wp_send_json_error( $data ); } - } diff --git a/includes/Traits/Hooker.php b/includes/Traits/Hooker.php index bedcf2aa..ed89b4f9 100644 --- a/includes/Traits/Hooker.php +++ b/includes/Traits/Hooker.php @@ -16,7 +16,7 @@ trait Hooker { * @return void */ public function add_action( $tag, $function, $priority = 10, $accepted_args = 1 ) { - add_action( $tag, [ $this, $function ], $priority, $accepted_args ); + add_action( $tag, array( $this, $function ), $priority, $accepted_args ); } /** @@ -32,7 +32,6 @@ public function add_action( $tag, $function, $priority = 10, $accepted_args = 1 * @return void */ public function add_filter( $tag, $function, $priority = 10, $accepted_args = 1 ) { - add_filter( $tag, [ $this, $function ], $priority, $accepted_args ); + add_filter( $tag, array( $this, $function ), $priority, $accepted_args ); } - } diff --git a/includes/Traits/Singleton.php b/includes/Traits/Singleton.php index 0b1bd8b0..6bfbb79b 100644 --- a/includes/Traits/Singleton.php +++ b/includes/Traits/Singleton.php @@ -27,5 +27,4 @@ public static function instance() { return self::$instance; } - } diff --git a/includes/Traits/Stringy.php b/includes/Traits/Stringy.php index 8046e4f1..ea00cb30 100644 --- a/includes/Traits/Stringy.php +++ b/includes/Traits/Stringy.php @@ -11,12 +11,11 @@ trait Stringy { public function underscored( $string ) { $trimmed = trim( $string ); - $withUnderscores = preg_replace('/(? true, - ]; + ); wemail()->api->site()->update_activation_status()->post( $data ); } - } diff --git a/includes/Upgrade.php b/includes/Upgrade.php index 7def0d27..79da5e9f 100644 --- a/includes/Upgrade.php +++ b/includes/Upgrade.php @@ -8,10 +8,10 @@ class Upgrade { * * @var string[] $upgrades */ - protected $upgrades = [ + protected $upgrades = array( '1.0.0' => 'Upgrades/upgrade-1.0.0.php', '1.10.0' => 'Upgrades/upgrade-1.10.0.php', - ]; + ); /** * WeMail version option key @@ -61,5 +61,4 @@ public function perform_updates() { update_option( $this->option_name, WEMAIL_VERSION ); } - } diff --git a/includes/WeMail.php b/includes/WeMail.php index 345cecca..07bedff9 100644 --- a/includes/WeMail.php +++ b/includes/WeMail.php @@ -68,7 +68,7 @@ final class WeMail { * * @var object */ - public $core = []; + public $core = array(); /** * WeMail site URL @@ -119,7 +119,7 @@ final class WeMail { * * @var array */ - private $admin_notices = []; + private $admin_notices = array(); /** * Initializes the WeMail() class @@ -150,7 +150,7 @@ public static function instance() { private function boot() { // Check requirements if ( ! $this->met_requirements() ) { - add_action( 'admin_notices', [ $this, 'admin_notices' ] ); + add_action( 'admin_notices', array( $this, 'admin_notices' ) ); return; } @@ -300,11 +300,11 @@ private function includes() { * @return void */ private function init_hooks() { - add_action( 'init', [ $this, 'init' ], 0 ); - add_action( 'plugins_loaded', [ $this, 'plugin_upgrades' ] ); + add_action( 'init', array( $this, 'init' ), 0 ); + add_action( 'plugins_loaded', array( $this, 'plugin_upgrades' ) ); - register_activation_hook( WEMAIL_FILE, [ '\WeDevs\WeMail\Install', 'install' ] ); - register_deactivation_hook( WEMAIL_FILE, [ '\WeDevs\WeMail\Uninstall', 'uninstall' ] ); + register_activation_hook( WEMAIL_FILE, array( '\WeDevs\WeMail\Install', 'install' ) ); + register_deactivation_hook( WEMAIL_FILE, array( '\WeDevs\WeMail\Uninstall', 'uninstall' ) ); } /** diff --git a/includes/functions.php b/includes/functions.php index 1a319017..1be3f8a1 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -58,7 +58,7 @@ function wemail_get_country_states( $country_code ) { if ( file_exists( $filename ) ) { return include $filename; } else { - return []; + return array(); } } @@ -70,7 +70,7 @@ function wemail_get_country_states( $country_code ) { * @return string */ function wemail_get_wp_timezone() { - $timezone_map = [ + $timezone_map = array( 'UTC-12' => 'Etc/GMT+12', 'UTC-11.5' => 'Pacific/Niue', 'UTC-11' => 'Pacific/Pago_Pago', @@ -127,7 +127,7 @@ function wemail_get_wp_timezone() { 'UTC+13' => 'Pacific/Fiji', 'UTC+13.75' => 'Pacific/Chatham', 'UTC+14' => 'Pacific/Tongatapu', - ]; + ); $current_offset = get_option( 'gmt_offset' ); $tzstring = get_option( 'timezone_string' ); @@ -300,8 +300,8 @@ function is_erp_crm_active() { * @param array $keys [description] * @return [type] [description] */ -function wemail_array_only( $arr, $keys = [] ) { - $new_arr = []; +function wemail_array_only( $arr, $keys = array() ) { + $new_arr = array(); foreach ( $keys as $key ) { if ( array_key_exists( $key, $arr ) ) { $new_arr[ $key ] = $arr[ $key ]; diff --git a/phpcs.xml b/phpcs.xml index 2af2983f..7b7beb26 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -93,9 +93,6 @@ error - - error - 0 diff --git a/readme.txt b/readme.txt index afcb24d3..31b18502 100644 --- a/readme.txt +++ b/readme.txt @@ -1,217 +1,244 @@ -=== weMail - Email Marketing, Newsletter, Optin Forms, Subscribers WordPress Plugin === +=== weMail - Email Marketing, Lead Generation, Optin Forms, Email Newsletters, A/B Testing, and Automation === Contributors: tareq1988, nizamuddinbabu, wedevs, wemail Donate link: https://getwemail.io -Tags: email marketing, subscription form, smtp, newsletter, email campaign, +Tags: email marketing, newsletter, subscription, smtp, optins Requires at least: 4.0 Tested up to: 6.4.3 Stable tag: 1.14.6 Requires PHP: 5.4 License: GPLv2 or later -License URI: https://www.gnu.org/licenses/gpl-2.0.html +License URL: https://www.gnu.org/licenses/gpl-2.0.html +Send email newsletter, automation, blog post notifications, build email lists with signup forms, and manage subscribers – all within WordPress. == Description == -A Simplified email marketing solution for WordPress. += Email marketing solution for WordPress with email newsletters, automation, optin forms, post notifications, and more = +With weMail, you can collect leads, send newsletters and automated emails, display popups and subscription forms, auto-add subscribers to a list, and manage subscribers – everything you need for email marketing. -weMail will help you to send newsletters, collect leads, automated emails, display subscription forms, auto add subscribers to a list, and manage subscribers all inside the WordPress dashboard. +Tightly integrated with WordPress, this cloud-powered email newsletter platform lets you send emails via Amazon SES, SparkPost, Mailgun, SendGrid, Elastic Mail, or your favorite SMTP provider — a perfect email marketing solution for small to large businesses with large email databases. -Tightly integrated with WordPress, Cloud-powered email newsletter platform that lets you send emails via Amazon SES, SparkPost, Mailgun, SendGrid, Elasti Mail, or your favorite SMTP provider. A perfect email marketing solution for small to large businesses with large email databases. += weMail is Your All-in-one Email Newsletter Solution: = +weMail comes with every feature a business or individual looks for to perfect their email marketing. Features at a glance that you’re getting completely free with weMail - -### weMail review from SaaSMaster - -[youtube https://www.youtube.com/watch?v=T9fdSOVZhS4] - -Having a large email subscriber list should not be expensive. weMail is tightly integrated into WordPress to make email marketing inside WordPress dashboard simple and easy and powerful - -[weMail](https://getwemail.io "weMail") will keep your email subscription process easy and simple. +1. Drag & drop editor, text-based simplified editor +2. Email automation / Drip campaigns +3. Email A/B testing +4. New post notifications +5. Multiple list management +6. Segments & tags +7. Cross-list sending +8. Opt-in forms +9. Reports, analytics, overview dashboard +10. Subscriber export/import +11. Pre-built email templates +12. WooCommerce, EDD, FastSpring integrations +13. Contact forms integrations +14. AffiliateWP integration +15. Time-warp for sending +16. Transactional emails +17. Bounce handling & suppression +18. Double opt-in confirmation +19. weMail team management +20. Freedom of choosing sending gateway +and more! -[![Best WordPress Email Marketing Tool](http://img.youtube.com/vi/XbNlyJlr53g/0.jpg)](https://www.youtube.com/watch?v=vy3D4PJWPUU "weMail Overview - Best WordPress Email Marketing Tool") +== A complete email marketing platform with everything you need - -With weMail, you can focus more on growing subscriber lists and email marketing within the WordPress Dashboard. += Create Any Type of Email Newsletter Effortlessly = +To achieve your marketing goals, you require various email marketing strategies. weMail allows you to set up any type of email campaign and carry out all these actions directly from your WordPress dashboard, without leaving your website. -## Features: -weMail features that will help your business - -## WordPress Integration: -WordPress integrations that will help you get email subscribers effortlessly and put them into a list to send an email later. Collecting email addresses from WooCommerce user-product order email collection, new WordPress user registration, and commentators' emails to grow your email list just got easier. +- **[Standard Campaign](https://getwemail.io/docs/wemail/campaigns/types-of-campaigns/#how-does-standard-campaign-work):** Send one bulk email to several subscribers at once with a standard campaign. Whenever you need to connect with your subscribers, use the Standard Campaign. +**How to design and send bulk emails (also called mass email):** +Creating beautiful email campaigns with weMail is super easy. You get two types of editors to craft your email content - (i) Drag and drop builder and (ii) Writing-focused simplified editor. +You can use any built-in template from the weMail template gallery to design your newsletters quickly. Or, select blank templates to design them in your own style. +After completing email body or content, give a relevant Subject Line, From Name & Address, and a Reply-to Address. +Send instantly or schedule your drafted email campaign for later. -- **[e-Commerce Integration](https://getwemail.io/docs/wemail/settings/) :** With each WooCommerce/EDD & FastSpring store order, you can collect subscribers and put them into an email list. +- **[Email Automation / Drip Campaign](https://getwemail.io/email-automation/):** Leverage the power of email automation to streamline your marketing efforts and nurture leads effectively. Create personalized drip campaigns tailored to your audience's needs, ensuring timely and relevant communication. With automated email sequences, you can automate follow-ups, welcome new subscribers, and provide required content to the right person at the right time. In weMail’s automation feature, you get to - -- **[User Registration](https://getwemail.io/docs/wemail/settings/) :** Collect subscribers each time anyone registers to your website. You can also automate welcome email as well as doubt opt-in to spam check. +- Select multiple starting points or triggers (based on which action the automation will trigger): when someone subscribes to a list, purchases a product, gets a tag, or reaches a milestone/anniversary, etc. +- Create personalized customer journeys with an intuitive workflow builder. Use delays, if/else conditions, or combine multiple rules to send the right message at the right time. +- Not only sending drip campaigns, you can also take specific actions according to your email marketing needs, such as - copying or moving subscribers to a list, adding or removing tags, unsubscribing, and more – all on autopilot. -- **[Comment Opt-in](https://getwemail.io/docs/wemail/settings/) :** Without redirecting visitors for sign up, you can also collect emails from blog comments. +- **[Email A/B Testing](https://getwemail.io/a-b-split-testing/):** weMail lets you test two variations of a single campaign to determine which works best. You can run the test on any of the three elements (one at a time) - Email Subject, From Name, or Email Content. +There are two methods for split-testing an email campaign: -- **[WordPress User Sync](https://getwemail.io/docs/wemail/settings/wordpress-users-sync/):** Auto import WordPress users to weMail subscribers. Every WordPress user role will auto-import without manually doing anything. + - (i) Send your A/B Test Campaign to an entire list. Variation A will go to 50% of your audience and variation B will go to the other 50%. Check in-detailed campaign reports to determine the better-performed variation. + - (ii) Send your A/B Test to a small group first, and then the better-performing variation will go out to the rest of the subscribers. Let’s say, you set a test group of 20% of your audience. So, 10% will receive variation A, 10% will get variation B, and the rest 80% will get the winning variation. -- **[Forms after blog posts]():** Show weMail opt-in forms after every WordPress blog posts of your site. -- **[WordPress Transactional Email ](https://getwemail.io/docs/wemail/settings/general/):** You can send all the WordPress transactional email via weMail. += Manage Email Lists and Subscribers = +Focus more on growing subscriber lists and email marketing within the WordPress dashboard. -## e-Commerce Integration: +- **[Collect Leads](https://getwemail.io/docs/wemail/forms/embeded-forms/):** Place weMail's HTML embed form or Opt-in form anywhere on the website and collect leads and add them to your email list. -- **[EDD Integration](https://getwemail.io/docs/wemail/settings/easy-digital-downloads/):** Welcome your first time customers with an automated thank you email for EDD customers. +- **[Automate onboarding emails](https://getwemail.io/docs/wemail/campaigns/types-of-campaigns/#how-does-automatic-campaign-work):** Welcome new subscribers with automated emails without manually doing it every time. -- **[FastSpring Integration](https://getwemail.io/docs/wemail/integrations/fastspring-wemail-integration/):** Collect email contacts from FastSpring checkout and power up your email workflow. +- **[Auto Clean List](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** weMail will automatically clean up fake, spam, or bounced emails from the lists to keep the lists healthy. -- **[WooCommerce Integration](https://getwemail.io/docs/wemail/integrations/fastspring-wemail-integration/):** Collect email contacts from wooCommerce checkout and send emails. +- **[Bounce Handling](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** Bounce handling feature will help you maintain email lists effortlessly without configuring it for hard bounce and soft bounce. -## e-Commerce Segmentation: -- **[Send Thank You Email to First Time Customers ](http://getwemail.io/docs/wemail/settings/woocommerce-integration-wemail):** Welcome your first time customers with an automated thank you email. += Email List Features = +- **[List](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Sorting and sending emails to the list of contacts is easier than before. Listings, segments, and tags - all can be configured from the get-go. -- **[Advance e-Commerce Segmentation](http://getwemail.io/docs/wemail/settings/woocommerce-integration-wemail):** With our advance e-Commerce segmentation you can target subscribers based on- +- **[Multi-list Sending](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** You can send a single email campaign to multiple lists; this way you do not have to create a separate campaign for sending the same email to different lists. Utilize the 'Exclude Recipients' option to target your campaigns more precisely by excluding subscribers by lists, segments, or tags. - - Order Spending (total order e.g - subscriber who purchased more than $500) - - Order Spending (single order e.g - subscriber who purchased less than $30 on a single order) - - Order Frequency (e.g - how many times a single subscribers purchased) - - Product Purchased (e.g - send email to who hasn’t purchased product A) - - Purchased activity (e.g - has purchased / has not purchased) - - Last Purchased +- **[Segmentation](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/#segment):** Segment your email contact more precisely with unlimited segment conditions. Cluster your email contacts and achieve your marketing goals more efficiently. +- **[Tags](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/#tags):** Tag contacts for better reference, email contacts make sense when you tag them by their actions. -## Contact Form Integrations: -weMail has integration for all your favorite contact form plugins - -- [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) -- [weForms](https://wordpress.org/plugins/weforms/) -- [Ninja Forms](https://wordpress.org/plugins/ninja-forms/) -- Gravity Forms -- [WPForms](https://wordpress.org/plugins/wpforms-lite/) -- [Caldera Forms](https://wordpress.org/plugins/caldera-forms/) -- [Happy Forms](https://wordpress.org/plugins/happyforms/) -- [Formidable Forms](https://wordpress.org/plugins/formidable/) -- [Fluent Forms](https://wordpress.org/plugins/fluentform/) - - -## Email Sending API Integrations: -weMail support world class email sending solution providers so that you don’t have to worry about the sending part. weMail currently supports - -- [Amazon SES](https://getwemail.io/docs/wemail/email-gateways/amazon-ses/) -- [Elastic Mail](https://getwemail.io/docs/wemail/email-gateways/elastic-email/) -- [Mailgun](https://getwemail.io/docs/wemail/email-gateways/mailgun/) -- [SparkPost](https://getwemail.io/docs/wemail/email-gateways/sparkpost/) -- [Postmark](https://getwemail.io/docs/wemail/email-gateways/postmark/) -- [SendGrid](https://getwemail.io/docs/wemail/email-gateways/sendgrid/) -- SMTP += WordPress Integration: = +A complete WordPress integration helps you get email subscribers effortlessly. Collecting email addresses from WooCommerce users, WooCommerce orders, new WordPress user registration, and new comments to grow your email list just got easier. -## Other Useful Integrations: -- [WP ERP](https://wperp.com/) -- [Appsero](https://appsero.com/) -- [Elementor](https://wordpress.org/plugins/elementor/) -- [Gutenberg](https://wordpress.org/plugins/gutenberg/) -- [Mailchimp](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-mailchimp/) -- [Mailpoet](https://wordpress.org/plugins/mailpoet/) -- [Campaign Monitor](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-campaign-monitor) -- [Mailoptin](https://wordpress.org/plugins/mailoptin/) +- **[User Registration](https://getwemail.io/docs/wemail/settings/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Collect subscribers each time anyone registers to your website. You can also automate welcome email or double opt-in confirmation to avoid spam submission. +- **[Comment Opt-in](https://getwemail.io/docs/wemail/settings/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Without redirecting visitors for sign up, you can also collect emails from blog post comments. +- **[WordPress User Sync](https://getwemail.io/docs/wemail/settings/wordpress-users-sync/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Auto import WordPress users to weMail subscribers. Every WordPress user role can be synced automatically without any manual work. -## Team -- **[Teams](https://getwemail.io/docs/wemail/teams/):** Team features will help you give and revoke access to your WordPress users for email marketing tasks. You can manage an entire email marketing team with weMail. There’s options to customize the user roles you want to give access to. Email marketing will be much easier with weMail. +- **[Forms after blog posts](https://getwemail.io/docs/wemail/forms/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Show weMail opt-in forms after every WordPress blog posts of your site. +- **[WordPress Transactional Email ](https://getwemail.io/docs/wemail/settings/general/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** You can send all the WordPress transactional emails via weMail. -## Contact Form Integrations -- **[Contact Form 7](https://getwemail.io/docs/wemail/forms/forms-integrations/):** Contact form 7 integration will ensure you don’t lose email addresses on contact form submission. += Complete Email Marketing Solution with E-commerce Integration: = -- **[Ninja Forms](https://getwemail.io/docs/wemail/forms/forms-integrations/):** It’s natural to list contact form submission email addresses into an email list. So that your email marketing workflow can be easier and simple. +- **[EDD Integration](https://getwemail.io/docs/wemail/settings/easy-digital-downloads/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Welcome your first-time customers with an automated thank you email for EDD customers. -- **[Caldera Forms](https://getwemail.io/docs/wemail/forms/forms-integrations/):** Whether it’s a single form or multiple forms. Caldera integrations will always work to power up your email marketing. +- **[FastSpring Integration](https://getwemail.io/docs/wemail/integrations/fastspring-wemail-integration/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Collect email contacts from FastSpring checkout and power up your email workflow. -- **[WPForms](https://getwemail.io/docs/wemail/forms/forms-integrations/):** One the most popular contact form plugin also works well with weMail. +- **[WooCommerce Integration](https://getwemail.io/docs/wemail/integrations/fastspring-wemail-integration/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Collect email contacts from wooCommerce checkout and send emails. -- **[weForms](https://getwemail.io/docs/wemail/forms/forms-integrations/):** weForms integration will make sure you have all your contact form submission saved up in a separate email list. += e-Commerce Segmentation: = +- **[Send Thank You Email to First Time Customers](http://getwemail.io/docs/wemail/settings/woocommerce-integration-wemail/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Welcome your first-time customers with an automated thank you email. -- **[Gravity Forms](https://getwemail.io/docs/wemail/forms/forms-integrations/):** Gravity Forms also work well with the weMail, giving you greater flexibility of collecting email addresses. +- **[Advanced e-Commerce Segmentation](http://getwemail.io/docs/wemail/settings/woocommerce-integration-wemail/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** With our advance e-Commerce segmentation you can target subscribers based on- + - Order Spending (total order e.g - subscriber who purchased more than $500) + - Order Spending (single order e.g - subscriber who purchased less than $30 on a single order) + - Order Frequency (e.g - how many times a single subscriber purchased) + - Product Purchased (e.g - send email to those who haven’t purchased product A) + - Purchase activity (e.g - has/has not purchased) + - Last Purchased -## Embed Forms -- **[Embed Forms](https://getwemail.io/docs/wemail/forms/embeded-forms/):** With HTML embed forms, you can place it anywhere. Widgets, posts or pages weMails embed form will work anywhere. -- **[Embed Form Options](https://getwemail.io/docs/wemail/forms/embeded-forms/):** Customizable embed form options make it easy for anyone to create an HTML form with custom fields. +### weMail review from SaaSMaster -## Opt-in Forms -- **[Inline Form](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-inline-form-work):** With the inline form you can place forms inside content and get the subscribers to any list you assign. +[youtube https://www.youtube.com/watch?v=T9fdSOVZhS4] -- **[Floating Bar](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-the-floating-bar-form-work):** Floating bar will float in your website header, when collecting email addresses is your top priority floating bar will help you greatly. +Having a large email subscriber list shouldn’t be expensive. [weMail](https://getwemail.io/??utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme "weMail") will keep your email subscription process easy and simple. -- **[Slide Up](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-slide-up-form-work):** Prefer to slide up the subscription box instead of other methods. You can use a weMail slide up form function to slide up a subscription box to collect new emails. You can even control when to show the slide up form depending upon page scroll percentage. -- **[Modal](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-modal-form-work):** If an email subscriber modal is your preferred way of collecting emails. You can use the Modal box to show the form when you like. += Contact Form Integrations: = +Using contact forms to collect leads? weMail has integration for all your favorite contact form plugins so that you can seamlessly bring them your lists and conduct email marketing - -## Double Opt-in -Double opt-in helps you prevent dead email contacts and verify them to clean the list. weMail double opt-in feature can provide: +- Contact Form 7 +- Ninja Forms +- Caldera Forms +- WPForms +- weForms +- Gravity Forms +- Happy Forms +- Formidable Forms +- Fluent Forms +- Forminator Froms +- Everest Forms +- Elementor Forms + + += Email Sending API Integrations: = +weMail supports world-class email sending solution providers so that you don’t have to worry about the sending part. weMail currently supports - + +- Amazon SES +- Brevo (formerly Sendinblue) +- Elastic Mail +- Mailgun +- SparkPost +- Postmark +- SendGrid +- Pepipost +- SMTP -- **[Double Opt-in](https://getwemail.io/docs/wemail/subscriber-lists/double-opt-in/):** Cut down your subscribers' bounce rate by using double opt-in. += Other Useful Integrations: = +- WP ERP +- Appsero +- Elementor +- Gutenberg +- Mailchimp +- Mailpoet +- Campaign Monitor +- Mailoptin -- **[Double Opt-in Redirection](https://getwemail.io/docs/wemail/settings/double-opt-in/):** Redirect double opt-in emails to any other page your campaign requires. You can redirect to any pages, URL or absolutely no redirection at all. -## Analytics -Analytics help you with campaign performance, to make a better-informed decision about your email marketing campaigns. weMail analytics will help -- **[24 Hours Email Statistics](https://getwemail.io/docs/wemail/settings/general/):** Too busy to check email campaign activity? 24-hour email statistics will send you campaign statistics for the last 24 hours. += Email Marketing Team = +- **[Teams](https://getwemail.io/docs/wemail/teams/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Manage an entire email marketing team with weMail. Give and revoke access to your WordPress users for email marketing tasks. You can also customize which WordPress user roles will be eligible to give access to. -- **[Google Analytics](https://getwemail.io/docs/wemail/campaigns/create-campaigns-with-google-analytics):** weMail will give you the option to use Google Analytics tag so that email link clicks can be tracked and viewed in Google analytics for better references. -- **[Campaign Overview](https://getwemail.io/docs/wemail/campaigns/)**: You can get all the email campaigns' overview from the overview tab, and get a broad picture of how many emails are sent and how many will be sent with what forms and what's the sending statistics. += Embed Forms = +- **[Embed Forms](https://getwemail.io/docs/wemail/forms/embeded-forms/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** With HTML embed forms, you can place it anywhere. Widgets, posts or pages – weMails embed form works anywhere. -- **[Email Link Click](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** Links inside email content will automatically have statistics of how many times they were clicked without setting up third-party trackers. Tracking link clicks is easier than ever. +- **[Custom Field Support](https://getwemail.io/docs/wemail/forms/embeded-forms/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Customizable embed form options make it easy for anyone to create an HTML form with custom fields. -## Email List Features ## -- **[List](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/):** Sorting and sending emails to the list of contacts is easier than before. Listings, segments, and tags all can be configured for from the get-go. += Opt-in Forms = +- **[Inline Form](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-inline-form-work/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** With the inline form you can place forms inside content and get the subscribers to any list you assign. -- **[Multiple List](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/):** You can send email to multiple lists, this way you do not have to create a separate campaign for sending the same email to another list. +- **[Floating Bar](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-the-floating-bar-form-work):** Floating bar forms will attach to the bottom or top of users’ screen and will scroll along. To make your subscription form highly noticeable, floating bar is a great option. -- **[Segments](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/#segment):** Segment will help you segment your email contact more precisely, create an unlimited segment to cluster your email contacts appropriately. +- **[Slide Up](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-slide-up-form-work):** Prefer to slide up the subscription box? Use a weMail slide up form function to collect new leads. You can even control when to show the slide-up form on your users’ screen. -- **[Tags](https://getwemail.io/docs/wemail/subscriber-lists/how-to-create-a-list/#tags):** Tag contacts for better reference, email contacts make sense when you tag them by their actions. +- **[Modal](https://getwemail.io/docs/wemail/forms/types-of-forms/#how-does-modal-form-work):** Reduce the visual clutter of your webpage when asking someone to subscribe. Use the Modal box to show the form as per your requirements. -## Import & Export ## -- **[Import Contacts](https://getwemail.io/docs/wemail/imports/):** Import your custom templates, email list from other email marketing tools to weMail using our built-in import settings. Migration is easy, simple and solid. += Double Opt-in = +Double opt-in helps you prevent fake email contacts from entering your lists. It helps in: -- **[Import from Mailchimp](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-mailchimp/):** You can import your email lists from Mailchimp using API into new or existing weMail lists. +- **[Reducing Bounce Rate](https://getwemail.io/docs/wemail/subscriber-lists/double-opt-in/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Cut down your subscribers' bounce rate which is important for email deliverability and sender’s reputation. -- **[Import from Campaign Monitor](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-campaign-monitor/):** You want to import your email marketing subscribers from Campaign Monitor? weMail got your back. You can import Campaign Monitor lists into weMail by using Campaign Monitors API. +- **[Double Opt-in Redirection](https://getwemail.io/docs/wemail/settings/double-opt-in/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Redirect double opt-in emails to anywhere your campaign requires. You can redirect to any page, or URL, or no redirection at all. += Built-in Analytics and Dashboard = +weMail analytics help you to make a better-informed decision about your email marketing campaigns. Get all the necessary stats and data on your subscribers, campaign performance, sending gateways, and active forms from the dashboard. -- **[Import from MailPoet](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-mailpoet/):** Import from MailPoet is also possible with weMail. You only just need to insert your Mailpoet API key and weMail will import all the subscribers into weMail. And you can resume your email marketing activities as usual. +- **[24 Hours Email Statistics](https://getwemail.io/docs/wemail/settings/general/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Too busy to check email campaign activity? weMail can send you a report automatically with campaign statistics for the last 24 hours. -- **[Import from Active Campaign](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-active-campaign/):** Import from Active Campaign is also possible with weMail. You only just need to insert your API key, client ID andweMail will import all the subscribers into weMail. And you can resume your email marketing activities as usual. +- **[Google Analytics](https://getwemail.io/docs/wemail/campaigns/create-campaigns-with-google-analytics/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** weMail will give you the option to use Google Analytics tag so that email link clicks can be tracked and viewed in Google analytics for better references. -- **[Import from CSV](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-csv/):** You want more control over what to import. You can use CSV files to import your subscribers for email marketing. +- **[Campaign Overview](https://getwemail.io/docs/wemail/campaigns/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme)**: You can get a broad picture of how many emails are sent, how many subscribers and forms you have, from the Overview tab. +- **[Email Link Click](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** Links inside email content will automatically have statistics of how many times they were clicked without setting up third-party trackers. -- **[Export Email to CSV](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-csv/):** Exporting your email contacts to CSV is just a single click away. -## Campaigns ## -- **[Email Campaign](https://getwemail.io/docs/wemail/campaigns/):** Campaigns can be configured straight from the WordPress dashboard without leaving your website. += Subscribers Import & Export = +- **[Import Contacts](https://getwemail.io/docs/wemail/imports/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Import your contacts or subscriber lists from other email marketing tools to weMail using our built-in import settings. Migration is easy, simple, and solid. -- **[Standard Campaign](https://getwemail.io/docs/wemail/campaigns/types-of-campaigns/#how-does-standard-campaign-work):** Send emails with a standard campaign whenever you feel like to connect with your subscribers. +- **[Import from Mailchimp](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-mailchimp/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** You can import your email lists from Mailchimp using API into new or existing weMail lists. -- **[Automated Campaign](https://getwemail.io/docs/wemail/campaigns/types-of-campaigns/#how-does-automatic-campaign-work):** Send emails automatically with an automatic campaign, automate the process without going manual ever again. +- **[Import from Campaign Monitor](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-campaign-monitor/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Want to import your email marketing subscribers from Campaign Monitor? Bring Campaign Monitor lists easily into weMail using Campaign Monitors API. -- **[Templates](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/):** There is a template for that! You can use our built-in beautiful templates for sending emails. -## Email List Management ## -- **[Collect Leads](https://getwemail.io/docs/wemail/forms/embeded-forms/):** Place weMail's HTML embed form or Opt-in form anywhere on the website and collect leads and add them to email list without sweat +- **[Import from MailPoet](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-mailpoet/?utm_medium=referral&utm_source=wporg&utm_campaign=weMail+Readme):** Import from MailPoet is also possible with weMail. You just need to insert your Mailpoet API key and weMail will import all the subscribers into weMail. And you can resume your email marketing activities as usual. -- **[Automate email](https://getwemail.io/docs/wemail/campaigns/types-of-campaigns/#how-does-automatic-campaign-work):** Welcome new subscribers with automated emails without manually doing it every time. +- **[Import from Active Campaign](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-active-campaign/):** Import lists from Active Campaign to weMail. Just follow the on-screen instructions and migrate in a few simple steps. -- **[Auto Clean List](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** weMail will automatically clean lists based on bounce email so that you do not have to keep track manually. +- **[Import from CSV](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-csv/):** Get even more control over what to import. You can upload CSV files from any platform to import your subscribers for email marketing. -- **[Bounce Handling](https://getwemail.io/docs/wemail/campaigns/your-first-campaign/#Link%20Clicks):** Bounce handling feature will help you maintain email lists effortlessly without configuring it for hard bounce and soft bounce. +- **[Export Subscribers to CSV](https://getwemail.io/docs/wemail/imports/import-subscriber-list-from-csv/):** Exporting your email contacts to CSV is just a single click away. - **[Mailchimp Sync](https://getwemail.io/docs/wemail/subscriber-lists/mailchimp-sync/):** -Mailchimp sync will help you to maintain the same email list in both weMail & Mailchimp. Any kind of subscribe & unsubscribe will work the same way in both the list. This gives you the option to try out weMail at the same time using Mailchimp. +Mailchimp sync is to maintain the same email list in both weMail & Mailchimp. Any kind of subscribe & unsubscribe activity will work simultaneously on both platforms. This gives you the option to keep your lists synced until you complete the migration process. -## weMail is best for: -1. Tightly integrated WordPress email marketing plugin -2. Built-in native forms like (Slide Up, Inline, Modal, Floating Bar) to capture emails. += weMail is the best email marketing plugin because it offers: = +1. Solid WordPress integration as an email marketing plugin. +2. Built-in native forms (Slide Up, Inline, Modal, Floating Bar) to capture emails. 3. Handy subscriber management system. -4. Manage everything inside WP Dashboard -5. Contact Form plugins integration -6. Over 100+ awesome templates -7. Multiple email sending API gateway compatible +4. Manage everything inside your WordPress Dashboard. +5. Contact Form plugins integration. +6. Over 100+ awesome templates. +7. Multiple email sending API gateway compatible. **weMail Supports:** @@ -225,7 +252,6 @@ So why wait? Install weMail today and supercharge your email marketing workflow! weMail development repository on [GitHub](https://github.com/weDevsOfficial/wemail/ "weMail GitHub") -weMail free is limited to 3,000 subscribers with weMail branding in the footer. weMail gives you greater flexibility with a generous subscriber plan - https://getwemail.io/pricing . weMail premium starts from $9 for 10,000 subscribers. ## Privacy Policy weMail collects some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements. @@ -236,40 +262,60 @@ Additionally, read weDevs [privacy policy](https://wedevs.com/privacy-policy/) f == Installation == -How to install the plugin and get it working. +How to install the plugin and get it working: 1. Upload the plugin files to the `/wp-content/plugins/weMail` directory, or install the plugin through the WordPress plugins screen directly. 2. Activate the plugin from the dashboard in WordPress 3. Go to the Dashboard->weMail settings to configure the plugin +== More products from our parent company - weDevs! == + +**[Dokan:](https://wordpress.org/plugins/dokan-lite/)** The pioneer WooCommerce multivendor marketplace solution for WordPress. Start your own multi vendor marketplace like Amazon, eBay, Etsy - in minutes! + +**[Texty:](https://wordpress.org/plugins/texty/)** A lightweight SMS Notification plugin for WordPress, WooCommerce, Dokan, and more. Get instant notification with gateways like Twilio, Vonage – Formerly Nexmo, etc. + +**[weDocs:](https://wordpress.org/plugins/wedocs/)** The best WordPress documentation and knowledge base plugin for managing your self-hosted knowledge base, wiki, and docs. + +**[wePOS:](https://wordpress.org/plugins/wepos/)** WooCommerce point of sale solution for WordPress by weDevs. + +**[WP Project Manager:](https://wordpress.org/plugins/wedevs-project-manager/)** A project management plugin by weDevs making task scheduling, project management, and team collaboration simpler than ever featuring a Kanban board and Gantt charts. + +**[WP User Frontend:](https://wordpress.org/plugins/wp-user-frontend/)** Get content access & restriction, user login & registration, subscription & membership, form builder, profile builder & Frontend post submission plugin - all in one product + +**[Happy Addons for Elementor:](https://wordpress.org/plugins/happy-elementor-addons/)** An Elementor Addon solution that comes with Header Footer Builder, 500+ templates, 143+ free & essential pro elementor widgets like – Theme Builder, Mega Menu, and more! + +**[WP ERP:](https://wordpress.org/plugins/erp/)** An ERP with complete HR, Recruitment, and Job Listings for Business Managers with WooCommerce CRM and accounting solutions by weDevs. + + + == Frequently Asked Questions == = What is weMail? = -weMail is a plugin for WordPress which enables the user/users of a WordPress website to send email newsletters with feature-packed email builder and connect with email sending solutions such as Amazon Web Services, MailGun, SparkPost, etc to send those emails. +weMail is a plugin for WordPress which enables the user/users of a WordPress website to send email newsletters with a feature-packed email builder and connect with email-sending solutions such as Amazon Web Services, MailGun, SparkPost, etc. to send those emails. = How does it work? = -weMail comes with a built-in email template builder. With its user-friendly interface and most basic elements, you will be able to create any type of email you want to build. After creating your desired email template just hit send. Set the email subject, preview text, which list the email will be sent to and that's it. To connect weMail with any of the supported email sending service providers you need to set the API key with weMail. In the backend settings of the WordPress plugin you will find the option to insert the API key. After that, you will be able to send emails to your subscribers list. +weMail comes with a built-in email template builder. With its user-friendly interface and most basic elements, you can create any kind of email you want. After creating your desired email template, set the email Subject, Preview text, Recipients (lists, segments), From Name & Address, etc. Now, to send this email you need a sending service provider. To connect weMail with any of the supported email-sending service providers, you need to set the API key with weMail. In the backend settings of the WordPress plugin, you will find the option to insert the API key. After that, you will be able to send bulk emails to your subscribers. -Please note, some email sending services require further configuration. See those specific email sending services documentation for more detailed instructions on how the configuration works. There is also a link with every email sending service configuration settings to their official documentation. +Please note, some email-sending services require further configuration. See those specific email-sending services documentation for more detailed instructions on how the configuration works. There is also a link with every email sending service configuration settings to their official documentation. -= Is It Dependent On Anything Else? = += Is it dependent on anything else? = -Yes. To send your emails you will need to connect with an email sending service. As of right now, weMail supports SparkPost, SendGrid, PostMark, Mailgun, Elastic Email, Amazon SES. Support for other solutions will come in the future. +Yes. To send your emails, you will need to connect with an email-sending service. As of right now, weMail supports SparkPost, SendGrid, PostMark, Mailgun, Elastic Email, Amazon SES. Support for other solutions will come in the future. -= Is There An Email Sending Limit? = += Is there an email sending limit? = -weMail only helps you build the emails, select the list which the email will be sent, and other necessary email configurations. The sending of an email is handled by the email sending service that you choose(Such as AWS, SparkPost, etc.). To see the limitations of your email sending limitation please see the details page of the service that you choose to use. +weMail only helps you build the emails, select the list to which the email will be sent, and other necessary email configurations. The sending of an email will be handled by the email-sending service you choose (such as AWS, SparkPost, etc.). To check your sending limit, please contact your chosen service or see their details. -= How Is My Data Being Handled? = += How is my data being handled? = -Rest assured. All your data is GDPR compliant. We only use your data to provide you with a better weMail experience. If you ever wish to delete your data just give us a knock. We will happily comply. +Rest assured. All your data is GDPR compliant. We only use your data to provide you with a better weMail experience. If you ever wish to delete your data just give us a message. We will happily comply. = Is there any prerequisite for using weMail? = -weMail doesn't require any pre-requisite. But we do advise you first look through the options & documentation provided by the email sending API service providers. As you will need these services to send emails. +weMail doesn't require any pre-requisite. But we do advise you first look through the options & documentation provided by the email sending API service providers. You will need these services to send emails. = = @@ -296,9 +342,14 @@ weMail doesn't require any pre-requisite. But we do advise you first look throug * WordPress 6.4.3 compatibility = v1.14.3 - (25th Mar, 2024) = -* Fixed notice vulnerability issue -* Fixed help tools permission checking +* Fix notice vulnerability issue +* Fix help tools permission checking + += v1.14.2 - (11th Sep, 2023) = +* Update appsero apk version += v1.14.1 - (10th Aug, 2023) = +* WordPress 6.3 compatibility = v1.14.0 - (13th Jul, 2023) = * **New:** Added Elementor Form integration diff --git a/views/customizer.html b/views/customizer.html index 93874a8b..74a4a3b3 100644 --- a/views/customizer.html +++ b/views/customizer.html @@ -94,6 +94,7 @@ :data-section-index="sectionIndex" :data-content-index="contentIndex" class="content-wrapper" + @click="editContent(sectionIndex, contentIndex)" > ' . __( 'Docs', 'wemail' ) . '', '' . __( 'Support', 'wemail' ) . '', '' . __( 'Visit Site', 'wemail' ) . '', - ], + ), $links );