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() {
%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