Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -34,6 +34,7 @@
|
||||
<exclude name="Squiz.Commenting.VariableComment.Missing" />
|
||||
<exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis" />
|
||||
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
|
||||
<exclude name="Universal.Arrays.DisallowShortArraySyntax" />
|
||||
</rule>
|
||||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
||||
<properties>
|
||||
|
@ -25,33 +25,41 @@
|
||||
"php": ">=7.4.1",
|
||||
"automattic/jetpack-autoloader": "^5.0.0",
|
||||
"rpnzl/arrch": "dev-master#994258bbefb7722243211654c4f78813312cd5ed",
|
||||
"amphp/amp": "v2.6.2",
|
||||
"psr/log": "1.1.4",
|
||||
"delight-im/cookie": "v3.4.0",
|
||||
"berlindb/core": "2.0.1",
|
||||
"mexitek/phpcolors": "v1.0.4",
|
||||
"phpdocumentor/reflection-docblock": "5.3.0",
|
||||
"stripe/stripe-php": "v10.21.0",
|
||||
"hashids/hashids": "4.1.0",
|
||||
"amphp/amp": "^2.6.2",
|
||||
"psr/log": "^1.1.4",
|
||||
"delight-im/cookie": "^3.4.0",
|
||||
"berlindb/core": "^2.0.1",
|
||||
"mexitek/phpcolors": "^1.0.4",
|
||||
"phpdocumentor/reflection-docblock": "^5.3.0",
|
||||
"stripe/stripe-php": "^10.21.0",
|
||||
"hashids/hashids": "^4.1.0",
|
||||
"rakit/validation": "dev-master#ff003a35cdf5030a5f2482299f4c93f344a35b29",
|
||||
"ifsnop/mysqldump-php": "v2.12",
|
||||
"mpdf/mpdf": "v8.2.0",
|
||||
"remotelyliving/php-dns": "4.3.0",
|
||||
"jasny/sso": "v0.4.2",
|
||||
"nyholm/psr7": "1.8.0",
|
||||
"symfony/cache": "v5.4.29",
|
||||
"scssphp/scssphp": "v1.11.1",
|
||||
"ifsnop/mysqldump-php": "^2.12",
|
||||
"mpdf/mpdf": "^8.2.0",
|
||||
"remotelyliving/php-dns": "^4.3.0",
|
||||
"jasny/sso": "^0.4.2",
|
||||
"nyholm/psr7": "^1.8.0",
|
||||
"symfony/cache": "^5.4.29",
|
||||
"scssphp/scssphp": "^1.11.1",
|
||||
"cweagans/composer-patches": "^1.7",
|
||||
"woocommerce/action-scheduler": "^3.9.1",
|
||||
"ext-json": "*"
|
||||
"ext-json": "*",
|
||||
"symfony/polyfill-php80": "^1.31.0",
|
||||
"symfony/polyfill-php81": "^1.31.0",
|
||||
"symfony/polyfill-php82": "^1.31.0",
|
||||
"symfony/polyfill-php83": "^1.31.0",
|
||||
"symfony/polyfill-php84": "^1.31.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/installers": "1.9.0",
|
||||
"composer/installers": "^1.9.0",
|
||||
"phpunit/phpunit": "^9.6.22",
|
||||
"yoast/phpunit-polyfills": "^1.1.3",
|
||||
"woocommerce/woocommerce-sniffs": "^1.0.0",
|
||||
"symplify/vendor-patches": "^11.3",
|
||||
"fakerphp/faker": "^1.24"
|
||||
"fakerphp/faker": "^1.24",
|
||||
"rector/rector": "^2.0.8",
|
||||
"szepeviktor/phpstan-wordpress": "^2.0.1",
|
||||
"phpstan/extension-installer": "^1.1"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
@ -61,7 +69,8 @@
|
||||
"composer/installers": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"automattic/jetpack-autoloader": true,
|
||||
"cweagans/composer-patches": true
|
||||
"cweagans/composer-patches": true,
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
@ -99,6 +108,6 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": "cd vendor/mpdf/mpdf/ttfonts && rm -f AboriginalSansREGULAR.ttf Aegean.otf Aegyptus.otf Akkadian.otf ayar.ttf damase_v.2.ttf DBSILBR.ttf DejaVuSerif.ttf Dhyana-Regular.ttf DejaVuSansMono-Oblique.ttf DejaVuSerif-BoldItalic.ttf DhyanaOFL.txt DejaVuSerifCondensed-BoldItalic.ttf DejaVuSansMono-Bold.ttf DejaVuSerif-Italic.ttf DejaVuSerifCondensed-Bold.ttf DejaVuSansMono.ttf DejaVuSansMono-BoldOblique.ttf DejaVuSerif-Bold.ttf Dhyana-Bold.ttf DejaVuSerifCondensed-Italic.ttf DejaVuSansCondensed-BoldOblique.ttf DejaVuSansCondensed-Oblique.ttf DejaVuSans-Oblique.ttf DejaVuSans-BoldOblique.ttf DejaVuSans-Bold.ttf DejaVuSans.ttf FreeMonoBoldOblique.ttf FreeMonoOblique.ttf FreeSans.ttf FreeSansBold.ttf FreeSansBoldOblique.ttf FreeSansOblique.ttf FreeSerifBoldItalic.ttf FreeSerifItalic.ttf Garuda.ttf Garuda-Bold.ttf Garuda-BoldOblique.ttf Garuda-Oblique.ttf GNUFreeFontinfo.txt Jomolhari.ttf Jomolhari-OFL.txt kaputaunicode.ttf KhmerOFL.txt KhmerOS.ttf lannaalif-v1-03.ttf 'Lateef font OFL.txt' LateefRegOT.ttf Lohit-Kannada.ttf LohitKannadaOFL.txt ocrb10.ttf ocrbinfo.txt Padauk-book.ttf Pothana2000.ttf Quivira.otf Sun-ExtA.ttf Sun-ExtB.ttf SundaneseUnicode-1.0.5.ttf SyrCOMEdessa.otf SyrCOMEdessa_license.txt TaameyDavidCLM-LICENSE.txt TaameyDavidCLM-Medium.ttf TaiHeritagePro.ttf Tharlon-Regular.ttf TharlonOFL.txt UnBatang_0613.ttf Uthman.otf 'XB Riyaz.ttf' 'XB RiyazBd.ttf' 'XB RiyazBdIt.ttf' 'XB RiyazIt.ttf' 'XW Zar Font Info.txt' ZawgyiOne.ttf"
|
||||
"post-update-cmd": "cd vendor/mpdf/mpdf/ttfonts && rm -f AboriginalSansREGULAR.ttf Aegean.otf Aegyptus.otf Akkadian.otf ayar.ttf damase_v.2.ttf DBSILBR.ttf DejaVuSerif.ttf Dhyana-Regular.ttf DejaVuSansMono-Oblique.ttf DejaVuSerif-BoldItalic.ttf DhyanaOFL.txt DejaVuSerifCondensed-BoldItalic.ttf DejaVuSansMono-Bold.ttf DejaVuSerif-Italic.ttf DejaVuSansMono.ttf DejaVuSansMono-BoldOblique.ttf DejaVuSerif-Bold.ttf Dhyana-Bold.ttf DejaVuSerifCondensed-Italic.ttf DejaVuSansCondensed-BoldOblique.ttf DejaVuSansCondensed-Oblique.ttf DejaVuSans-Oblique.ttf DejaVuSans-BoldOblique.ttf DejaVuSans-Bold.ttf DejaVuSans.ttf FreeMonoBoldOblique.ttf FreeMonoOblique.ttf FreeSans.ttf FreeSansBold.ttf FreeSansBoldOblique.ttf FreeSansOblique.ttf FreeSerif.ttf FreeSerifBold.ttf FreeSerifBoldItalic.ttf FreeSerifItalic.ttf Garuda.ttf Garuda-Bold.ttf Garuda-BoldOblique.ttf Garuda-Oblique.ttf GNUFreeFontinfo.txt Jomolhari.ttf Jomolhari-OFL.txt kaputaunicode.ttf KhmerOFL.txt KhmerOS.ttf lannaalif-v1-03.ttf 'Lateef font OFL.txt' LateefRegOT.ttf Lohit-Kannada.ttf LohitKannadaOFL.txt ocrb10.ttf ocrbinfo.txt Padauk-book.ttf Pothana2000.ttf Quivira.otf Sun-ExtA.ttf Sun-ExtB.ttf SundaneseUnicode-1.0.5.ttf SyrCOMEdessa.otf SyrCOMEdessa_license.txt TaameyDavidCLM-LICENSE.txt TaameyDavidCLM-Medium.ttf TaiHeritagePro.ttf Tharlon-Regular.ttf TharlonOFL.txt UnBatang_0613.ttf Uthman.otf 'XB Riyaz.ttf' 'XB RiyazBd.ttf' 'XB RiyazBdIt.ttf' 'XB RiyazIt.ttf' 'XW Zar Font Info.txt' ZawgyiOne.ttf Abyssinica_SIL.ttf"
|
||||
}
|
||||
}
|
||||
|
715
composer.lock
generated
715
composer.lock
generated
@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b82b320cecc6701508316d46bc4335c3",
|
||||
"content-hash": "c27fa56bfcbf860f1ae2a70ef5153e7a",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
"version": "v2.6.2",
|
||||
"version": "v2.6.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/amphp/amp.git",
|
||||
"reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb"
|
||||
"reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
|
||||
"reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
|
||||
"url": "https://api.github.com/repos/amphp/amp/zipball/ded3d9be08f526089eb7ee8d9f16a9768f9dec2d",
|
||||
"reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -29,8 +29,8 @@
|
||||
"ext-json": "*",
|
||||
"jetbrains/phpstorm-stubs": "^2019.3",
|
||||
"phpunit/phpunit": "^7 | ^8 | ^9",
|
||||
"psalm/phar": "^3.11@dev",
|
||||
"react/promise": "^2"
|
||||
"react/promise": "^2",
|
||||
"vimeo/psalm": "^3.12"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -85,7 +85,7 @@
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/amphp",
|
||||
"issues": "https://github.com/amphp/amp/issues",
|
||||
"source": "https://github.com/amphp/amp/tree/v2.6.2"
|
||||
"source": "https://github.com/amphp/amp/tree/v2.6.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -93,7 +93,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-02-20T17:52:18+00:00"
|
||||
"time": "2024-03-21T18:52:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "automattic/jetpack-autoloader",
|
||||
@ -978,16 +978,16 @@
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v8.2.0",
|
||||
"version": "v8.2.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "170a236a588d177c2aa7447ce490a030ca68e6f4"
|
||||
"reference": "e175b05e3e00977b85feb96a8cccb174ac63621f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/170a236a588d177c2aa7447ce490a030ca68e6f4",
|
||||
"reference": "170a236a588d177c2aa7447ce490a030ca68e6f4",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/e175b05e3e00977b85feb96a8cccb174ac63621f",
|
||||
"reference": "e175b05e3e00977b85feb96a8cccb174ac63621f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -997,7 +997,7 @@
|
||||
"mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
|
||||
"myclabs/deep-copy": "^1.7",
|
||||
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
|
||||
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
|
||||
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
|
||||
"psr/http-message": "^1.0 || ^2.0",
|
||||
"psr/log": "^1.0 || ^2.0 || ^3.0",
|
||||
"setasign/fpdi": "^2.1"
|
||||
@ -1045,7 +1045,7 @@
|
||||
"utf-8"
|
||||
],
|
||||
"support": {
|
||||
"docs": "http://mpdf.github.io",
|
||||
"docs": "https://mpdf.github.io",
|
||||
"issues": "https://github.com/mpdf/mpdf/issues",
|
||||
"source": "https://github.com/mpdf/mpdf"
|
||||
},
|
||||
@ -1055,7 +1055,7 @@
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2023-09-01T11:44:52+00:00"
|
||||
"time": "2024-11-18T15:30:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/psr-http-message-shim",
|
||||
@ -1211,16 +1211,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nyholm/psr7",
|
||||
"version": "1.8.0",
|
||||
"version": "1.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Nyholm/psr7.git",
|
||||
"reference": "3cb4d163b58589e47b35103e8e5e6a6a475b47be"
|
||||
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/3cb4d163b58589e47b35103e8e5e6a6a475b47be",
|
||||
"reference": "3cb4d163b58589e47b35103e8e5e6a6a475b47be",
|
||||
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
|
||||
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1273,7 +1273,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Nyholm/psr7/issues",
|
||||
"source": "https://github.com/Nyholm/psr7/tree/1.8.0"
|
||||
"source": "https://github.com/Nyholm/psr7/tree/1.8.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1285,7 +1285,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-02T11:26:24+00:00"
|
||||
"time": "2024-09-09T07:06:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
@ -1392,28 +1392,35 @@
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "5.3.0",
|
||||
"version": "5.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
|
||||
"reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
|
||||
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8",
|
||||
"reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/deprecations": "^1.1",
|
||||
"ext-filter": "*",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.2",
|
||||
"phpdocumentor/type-resolver": "^1.3",
|
||||
"phpdocumentor/type-resolver": "^1.7",
|
||||
"phpstan/phpdoc-parser": "^1.7|^2.0",
|
||||
"webmozart/assert": "^1.9.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~1.3.2",
|
||||
"psalm/phar": "^4.8"
|
||||
"mockery/mockery": "~1.3.5 || ~1.6.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-mockery": "^1.1",
|
||||
"phpstan/phpstan-webmozart-assert": "^1.2",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"psalm/phar": "^5.26"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -1437,15 +1444,15 @@
|
||||
},
|
||||
{
|
||||
"name": "Jaap van Otterdijk",
|
||||
"email": "account@ijaap.nl"
|
||||
"email": "opensource@ijaap.nl"
|
||||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
|
||||
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1"
|
||||
},
|
||||
"time": "2021-10-19T17:43:47+00:00"
|
||||
"time": "2024-12-07T09:39:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
@ -2163,16 +2170,16 @@
|
||||
},
|
||||
{
|
||||
"name": "scssphp/scssphp",
|
||||
"version": "v1.11.1",
|
||||
"version": "v1.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/scssphp/scssphp.git",
|
||||
"reference": "ace2503684bab0dcc817d7614c8a54b865122414"
|
||||
"reference": "63d1157457e5554edf00b0c1fabab4c1511d2520"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/ace2503684bab0dcc817d7614c8a54b865122414",
|
||||
"reference": "ace2503684bab0dcc817d7614c8a54b865122414",
|
||||
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/63d1157457e5554edf00b0c1fabab4c1511d2520",
|
||||
"reference": "63d1157457e5554edf00b0c1fabab4c1511d2520",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2237,9 +2244,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/scssphp/scssphp/issues",
|
||||
"source": "https://github.com/scssphp/scssphp/tree/v1.11.1"
|
||||
"source": "https://github.com/scssphp/scssphp/tree/v1.13.0"
|
||||
},
|
||||
"time": "2023-09-24T13:38:17+00:00"
|
||||
"time": "2024-08-17T21:02:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
@ -2433,16 +2440,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/cache",
|
||||
"version": "v5.4.29",
|
||||
"version": "v5.4.46",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/cache.git",
|
||||
"reference": "e29c5a97bc2d81269973c3e1d7ceb9d48b4d5151"
|
||||
"reference": "0fe08ee32cec2748fbfea10c52d3ee02049e0f6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/cache/zipball/e29c5a97bc2d81269973c3e1d7ceb9d48b4d5151",
|
||||
"reference": "e29c5a97bc2d81269973c3e1d7ceb9d48b4d5151",
|
||||
"url": "https://api.github.com/repos/symfony/cache/zipball/0fe08ee32cec2748fbfea10c52d3ee02049e0f6b",
|
||||
"reference": "0fe08ee32cec2748fbfea10c52d3ee02049e0f6b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2470,8 +2477,8 @@
|
||||
"require-dev": {
|
||||
"cache/integration-tests": "dev-master",
|
||||
"doctrine/cache": "^1.6|^2.0",
|
||||
"doctrine/dbal": "^2.13.1|^3.0",
|
||||
"predis/predis": "^1.1",
|
||||
"doctrine/dbal": "^2.13.1|^3|^4",
|
||||
"predis/predis": "^1.1|^2.0",
|
||||
"psr/simple-cache": "^1.0|^2.0",
|
||||
"symfony/config": "^4.4|^5.0|^6.0",
|
||||
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
|
||||
@ -2510,7 +2517,7 @@
|
||||
"psr6"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/cache/tree/v5.4.29"
|
||||
"source": "https://github.com/symfony/cache/tree/v5.4.46"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2526,7 +2533,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-09-19T13:25:51+00:00"
|
||||
"time": "2024-11-04T11:43:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/cache-contracts",
|
||||
@ -2994,6 +3001,310 @@
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php81.git",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php81\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php82",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php82.git",
|
||||
"reference": "5d2ed36f7734637dacc025f179698031951b1692"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692",
|
||||
"reference": "5d2ed36f7734637dacc025f179698031951b1692",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php82\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php82/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php83.git",
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php83\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php84",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php84.git",
|
||||
"reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/e5493eb51311ab0b1cc2243416613f06ed8f18bd",
|
||||
"reference": "e5493eb51311ab0b1cc2243416613f06ed8f18bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/polyfill",
|
||||
"name": "symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php84\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php84/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T12:04:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v5.4.47",
|
||||
@ -3317,16 +3628,16 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v1.9.0",
|
||||
"version": "v1.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca"
|
||||
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
|
||||
"reference": "b93bcf0fa1fccb0b7d176b0967d969691cd74cca",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
|
||||
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3337,17 +3648,18 @@
|
||||
"shama/baton": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "1.6.* || 2.0.*@dev",
|
||||
"composer/semver": "1.0.* || 2.0.*@dev",
|
||||
"phpunit/phpunit": "^4.8.36",
|
||||
"sebastian/comparator": "^1.2.4",
|
||||
"composer/composer": "1.6.* || ^2.0",
|
||||
"composer/semver": "^1 || ^3",
|
||||
"phpstan/phpstan": "^0.12.55",
|
||||
"phpstan/phpstan-phpunit": "^0.12.16",
|
||||
"symfony/phpunit-bridge": "^4.2 || ^5",
|
||||
"symfony/process": "^2.3"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Composer\\Installers\\Plugin",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
"dev-main": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -3385,6 +3697,7 @@
|
||||
"Porto",
|
||||
"RadPHP",
|
||||
"SMF",
|
||||
"Starbug",
|
||||
"Thelia",
|
||||
"Whmcs",
|
||||
"WolfCMS",
|
||||
@ -3418,13 +3731,16 @@
|
||||
"majima",
|
||||
"mako",
|
||||
"mediawiki",
|
||||
"miaoxing",
|
||||
"modulework",
|
||||
"modx",
|
||||
"moodle",
|
||||
"osclass",
|
||||
"pantheon",
|
||||
"phpbb",
|
||||
"piwik",
|
||||
"ppi",
|
||||
"processwire",
|
||||
"puppet",
|
||||
"pxcms",
|
||||
"reindex",
|
||||
@ -3434,6 +3750,7 @@
|
||||
"sydes",
|
||||
"sylius",
|
||||
"symfony",
|
||||
"tastyigniter",
|
||||
"typo3",
|
||||
"wordpress",
|
||||
"yawik",
|
||||
@ -3442,19 +3759,23 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/installers/issues",
|
||||
"source": "https://github.com/composer/installers/tree/v1.9.0"
|
||||
"source": "https://github.com/composer/installers/tree/v1.12.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-04-07T06:57:05+00:00"
|
||||
"time": "2021-09-13T08:19:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
@ -3843,6 +4164,54 @@
|
||||
},
|
||||
"time": "2022-02-21T01:04:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-stubs/wordpress-stubs",
|
||||
"version": "v6.7.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-stubs/wordpress-stubs.git",
|
||||
"reference": "27f32faacb65a1230d9dac09f1b6c5ce78a6e61a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/27f32faacb65a1230d9dac09f1b6c5ce78a6e61a",
|
||||
"reference": "27f32faacb65a1230d9dac09f1b6c5ce78a6e61a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"nikic/php-parser": "^4.13",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php-stubs/generator": "^0.8.3",
|
||||
"phpdocumentor/reflection-docblock": "^5.4.1",
|
||||
"phpstan/phpstan": "^1.11",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1",
|
||||
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/sodium_compat": "Pure PHP implementation of libsodium",
|
||||
"symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan"
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "WordPress function and class declaration stubs for static analysis.",
|
||||
"homepage": "https://github.com/php-stubs/wordpress-stubs",
|
||||
"keywords": [
|
||||
"PHPStan",
|
||||
"static analysis",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-stubs/wordpress-stubs/issues",
|
||||
"source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.2"
|
||||
},
|
||||
"time": "2025-02-05T17:57:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpcompatibility/php-compatibility",
|
||||
"version": "9.3.5",
|
||||
@ -4213,6 +4582,112 @@
|
||||
],
|
||||
"time": "2024-05-20T13:34:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/extension-installer",
|
||||
"version": "1.4.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/extension-installer.git",
|
||||
"reference": "85e90b3942d06b2326fba0403ec24fe912372936"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936",
|
||||
"reference": "85e90b3942d06b2326fba0403ec24fe912372936",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^2.0",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"phpstan/phpstan": "^1.9.0 || ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^2.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2.0",
|
||||
"phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "PHPStan\\ExtensionInstaller\\Plugin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\ExtensionInstaller\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Composer plugin for automatic installation of PHPStan extensions",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/extension-installer/issues",
|
||||
"source": "https://github.com/phpstan/extension-installer/tree/1.4.3"
|
||||
},
|
||||
"time": "2024-09-04T20:21:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "64ae44e48214f3deebdaeebf2694297a10a2bea9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/64ae44e48214f3deebdaeebf2694297a10a2bea9",
|
||||
"reference": "64ae44e48214f3deebdaeebf2694297a10a2bea9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan-shim": "*"
|
||||
},
|
||||
"bin": [
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||
"source": "https://github.com/phpstan/phpstan-src"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ondrejmirtes",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/phpstan",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-07T15:05:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "9.2.32",
|
||||
@ -4635,6 +5110,65 @@
|
||||
],
|
||||
"time": "2024-12-05T13:48:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
"version": "2.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rectorphp/rector.git",
|
||||
"reference": "3c70238bc677eb98866000a05b19a34f12955954"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/3c70238bc677eb98866000a05b19a34f12955954",
|
||||
"reference": "3c70238bc677eb98866000a05b19a34f12955954",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"phpstan/phpstan": "^2.1.2"
|
||||
},
|
||||
"conflict": {
|
||||
"rector/rector-doctrine": "*",
|
||||
"rector/rector-downgrade-php": "*",
|
||||
"rector/rector-phpunit": "*",
|
||||
"rector/rector-symfony": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "To manipulate phpunit.xml via the custom-rule command"
|
||||
},
|
||||
"bin": [
|
||||
"bin/rector"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
|
||||
"keywords": [
|
||||
"automation",
|
||||
"dev",
|
||||
"migration",
|
||||
"refactoring"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/rectorphp/rector/issues",
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.0.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/tomasvotruba",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-06T14:02:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
"version": "1.0.2",
|
||||
@ -5725,6 +6259,68 @@
|
||||
],
|
||||
"time": "2024-01-23T17:12:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "szepeviktor/phpstan-wordpress",
|
||||
"version": "v2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/szepeviktor/phpstan-wordpress.git",
|
||||
"reference": "f7beb13cd22998e3d913fdb897a1e2553ccd637e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/f7beb13cd22998e3d913fdb897a1e2553ccd637e",
|
||||
"reference": "f7beb13cd22998e3d913fdb897a1e2553ccd637e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php-stubs/wordpress-stubs": "^6.6.2",
|
||||
"phpstan/phpstan": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^2.1.14",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^2.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0",
|
||||
"wp-coding-standards/wpcs": "3.1.0 as 2.3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SzepeViktor\\PHPStan\\WordPress\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "WordPress extensions for PHPStan",
|
||||
"keywords": [
|
||||
"PHPStan",
|
||||
"code analyse",
|
||||
"code analysis",
|
||||
"static analysis",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/szepeviktor/phpstan-wordpress/issues",
|
||||
"source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.1"
|
||||
},
|
||||
"time": "2024-12-01T02:13:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
"version": "1.2.3",
|
||||
@ -5953,7 +6549,8 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.4.1"
|
||||
"php": ">=7.4.1",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"platform-overrides": {
|
||||
|
@ -9,7 +9,7 @@
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
return array(
|
||||
return [
|
||||
'day' => __('day', 'wp-ultimo'),
|
||||
'days' => __('days', 'wp-ultimo'),
|
||||
'week' => __('week', 'wp-ultimo'),
|
||||
@ -18,4 +18,4 @@ return array(
|
||||
'months' => __('months', 'wp-ultimo'),
|
||||
'year' => __('year', 'wp-ultimo'),
|
||||
'years' => __('years', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
@ -74,9 +74,9 @@ class About_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
@ -117,7 +117,7 @@ class About_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
wu_get_template('about');
|
||||
}
|
||||
@ -128,7 +128,7 @@ class About_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
@ -140,7 +140,7 @@ class About_Admin_Page extends Base_Admin_Page {
|
||||
background: url("%s") right bottom no-repeat;
|
||||
background-size: 60%%;
|
||||
}',
|
||||
wu_get_asset('bg-setup.png', 'img')
|
||||
wu_get_asset('bg-setup.webp', 'img')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @var array
|
||||
*/
|
||||
public $action_links = array();
|
||||
public $action_links = [];
|
||||
|
||||
/**
|
||||
* Holds the page title
|
||||
@ -159,9 +159,9 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Creates the page with the necessary hooks.
|
||||
@ -173,9 +173,9 @@ abstract class Base_Admin_Page {
|
||||
* Adds the page to all the necessary admin panels.
|
||||
*/
|
||||
foreach ($this->supported_panels as $panel => $capability) {
|
||||
add_action($panel, array($this, 'add_menu_page'));
|
||||
add_action($panel, [$this, 'add_menu_page']);
|
||||
|
||||
add_action($panel, array($this, 'fix_subdomain_name'), 100);
|
||||
add_action($panel, [$this, 'fix_subdomain_name'], 100);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -186,7 +186,7 @@ abstract class Base_Admin_Page {
|
||||
/*
|
||||
* Add forms
|
||||
*/
|
||||
add_action('plugins_loaded', array($this, 'register_forms'));
|
||||
add_action('plugins_loaded', [$this, 'register_forms']);
|
||||
|
||||
/**
|
||||
* Allow plugin developers to run additional things when pages are registered.
|
||||
@ -236,7 +236,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function fix_subdomain_name() {
|
||||
public function fix_subdomain_name(): void {
|
||||
|
||||
global $submenu;
|
||||
|
||||
@ -271,7 +271,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function install_hooks() {
|
||||
public function install_hooks(): void {
|
||||
|
||||
/**
|
||||
* Get the action links
|
||||
@ -309,9 +309,9 @@ abstract class Base_Admin_Page {
|
||||
/**
|
||||
* Fixes menu highlights when necessary.
|
||||
*/
|
||||
add_filter('parent_file', array($this, 'fix_menu_highlight'), 99);
|
||||
add_filter('parent_file', [$this, 'fix_menu_highlight'], 99);
|
||||
|
||||
add_filter('submenu_file', array($this, 'fix_menu_highlight'), 99);
|
||||
add_filter('submenu_file', [$this, 'fix_menu_highlight'], 99);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,7 +335,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
final public function display() {
|
||||
final public function display(): void {
|
||||
|
||||
/**
|
||||
* 'Hack-y' solution for the customer facing title problem... but good enough for now.
|
||||
@ -411,7 +411,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function add_menu_page() {
|
||||
public function add_menu_page(): void {
|
||||
|
||||
/**
|
||||
* Create the admin page or sub-page
|
||||
@ -441,7 +441,7 @@ abstract class Base_Admin_Page {
|
||||
$this->get_menu_label(),
|
||||
$this->get_capability(),
|
||||
$this->id,
|
||||
array($this, 'display'),
|
||||
[$this, 'display'],
|
||||
$this->menu_icon,
|
||||
$this->position
|
||||
);
|
||||
@ -465,7 +465,7 @@ abstract class Base_Admin_Page {
|
||||
$this->get_menu_label(),
|
||||
$this->get_capability(),
|
||||
$this->id,
|
||||
array($this, 'display')
|
||||
[$this, 'display']
|
||||
);
|
||||
}
|
||||
|
||||
@ -475,14 +475,14 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_branding() {
|
||||
public function add_branding(): void {
|
||||
|
||||
if (apply_filters('wp_ultimo_remove_branding', false) === false) {
|
||||
add_action('in_admin_header', array($this, 'brand_header'));
|
||||
add_action('in_admin_header', [$this, 'brand_header']);
|
||||
|
||||
add_action('wu_header_right', array($this, 'add_container_toggle'));
|
||||
add_action('wu_header_right', [$this, 'add_container_toggle']);
|
||||
|
||||
add_action('in_admin_footer', array($this, 'brand_footer'));
|
||||
add_action('in_admin_footer', [$this, 'brand_footer']);
|
||||
|
||||
add_filter('admin_footer_text', '__return_empty_string', 1000);
|
||||
|
||||
@ -496,13 +496,13 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_container_toggle() {
|
||||
public function add_container_toggle(): void {
|
||||
|
||||
wu_get_template(
|
||||
'ui/container-toggle',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -512,13 +512,13 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function brand_header() {
|
||||
public function brand_header(): void {
|
||||
|
||||
wu_get_template(
|
||||
'ui/branding/header',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -528,13 +528,13 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function brand_footer() {
|
||||
public function brand_footer(): void {
|
||||
|
||||
wu_get_template(
|
||||
'ui/branding/footer',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -544,7 +544,7 @@ abstract class Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_admin_body_classes() {
|
||||
public function add_admin_body_classes(): void {
|
||||
|
||||
add_action(
|
||||
'admin_body_class',
|
||||
@ -579,28 +579,28 @@ abstract class Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
final public function enqueue_default_hooks() {
|
||||
final public function enqueue_default_hooks(): void {
|
||||
|
||||
if ($this->page_hook) {
|
||||
add_action("load-$this->page_hook", array($this, 'install_hooks'));
|
||||
add_action("load-$this->page_hook", [$this, 'install_hooks']);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'page_loaded'));
|
||||
add_action("load-$this->page_hook", [$this, 'page_loaded']);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'hooks'));
|
||||
add_action("load-$this->page_hook", [$this, 'hooks']);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'register_scripts'), 10);
|
||||
add_action("load-$this->page_hook", [$this, 'register_scripts'], 10);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'screen_options'), 10);
|
||||
add_action("load-$this->page_hook", [$this, 'screen_options'], 10);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'register_widgets'), 20);
|
||||
add_action("load-$this->page_hook", [$this, 'register_widgets'], 20);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'add_admin_body_classes'), 20);
|
||||
add_action("load-$this->page_hook", [$this, 'add_admin_body_classes'], 20);
|
||||
|
||||
/*
|
||||
* Add the page to WP Multisite WaaS branding (aka top-bar and footer)
|
||||
*/
|
||||
if (is_network_admin()) {
|
||||
add_action("load-$this->page_hook", array($this, 'add_branding'));
|
||||
add_action("load-$this->page_hook", [$this, 'add_branding']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -622,11 +622,11 @@ abstract class Base_Admin_Page {
|
||||
public function get_title_links() {
|
||||
|
||||
if (wu_get_documentation_url($this->get_id(), false)) {
|
||||
$this->action_links[] = array(
|
||||
$this->action_links[] = [
|
||||
'url' => wu_get_documentation_url($this->get_id()),
|
||||
'label' => __('Documentation'),
|
||||
'icon' => 'wu-open-book',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -647,7 +647,7 @@ abstract class Base_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $original_parameters = array();
|
||||
protected $original_parameters = [];
|
||||
|
||||
/**
|
||||
* If this customer facing page has menu settings.
|
||||
@ -62,7 +62,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
$this->change_parameters();
|
||||
|
||||
@ -70,17 +70,17 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$this->editing = wu_request('customize');
|
||||
|
||||
add_action('wu_enqueue_extra_hooks', array($this, 'additional_hooks'));
|
||||
add_action('wu_enqueue_extra_hooks', [$this, 'additional_hooks']);
|
||||
|
||||
add_action('updated_user_meta', array($this, 'save_settings'), 10, 4);
|
||||
add_action('updated_user_meta', [$this, 'save_settings'], 10, 4);
|
||||
|
||||
wu_register_form(
|
||||
"edit_admin_page_$this->id",
|
||||
array(
|
||||
'render' => array($this, 'render_edit_page'),
|
||||
'handler' => array($this, 'handle_edit_page'),
|
||||
[
|
||||
'render' => [$this, 'render_edit_page'],
|
||||
'handler' => [$this, 'handle_edit_page'],
|
||||
'capability' => 'exist',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->register_page_settings();
|
||||
@ -92,13 +92,13 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function change_parameters() {
|
||||
public function change_parameters(): void {
|
||||
|
||||
$this->original_parameters = array(
|
||||
$this->original_parameters = [
|
||||
'title' => $this->get_title(),
|
||||
'position' => $this->position,
|
||||
'menu_icon' => $this->menu_icon,
|
||||
);
|
||||
];
|
||||
|
||||
$new_parameters = $this->get_page_settings();
|
||||
|
||||
@ -114,71 +114,71 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_edit_page() {
|
||||
public function render_edit_page(): void {
|
||||
|
||||
$settings = $this->get_page_settings();
|
||||
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
|
||||
$fields['title'] = array(
|
||||
$fields['title'] = [
|
||||
'type' => 'text',
|
||||
'title' => __('Page & Menu Title', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'title', ''),
|
||||
'tooltip' => '',
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->menu_settings) {
|
||||
$fields['position'] = array(
|
||||
$fields['position'] = [
|
||||
'type' => 'number',
|
||||
'title' => __('Menu', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'position', ''),
|
||||
'tooltip' => '',
|
||||
);
|
||||
];
|
||||
|
||||
$fields['menu_icon'] = array(
|
||||
$fields['menu_icon'] = [
|
||||
'type' => 'dashicon',
|
||||
'title' => __('Menu Icon', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'menu_icon', ''),
|
||||
'tooltip' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$fields['save_line'] = array(
|
||||
$fields['save_line'] = [
|
||||
'type' => 'group',
|
||||
'classes' => 'wu-justify-between',
|
||||
'wrapper_classes' => 'wu-bg-gray-100',
|
||||
'fields' => array(
|
||||
'reset' => array(
|
||||
'fields' => [
|
||||
'reset' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Reset Settings', 'wp-ultimo'),
|
||||
'value' => 'edit',
|
||||
'classes' => 'button',
|
||||
'wrapper_classes' => 'wu-mb-0',
|
||||
),
|
||||
'submit' => array(
|
||||
],
|
||||
'submit' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Save Changes', 'wp-ultimo'),
|
||||
'value' => 'edit',
|
||||
'classes' => 'button button-primary',
|
||||
'wrapper_classes' => 'wu-mb-0',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$fields = apply_filters("wu_customer_facing_page_{$this->id}_fields", $fields);
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'edit_page',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => "{$this->id}_page_customize",
|
||||
'data-state' => wu_convert_to_state(),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
echo '<div class="wu-styling">';
|
||||
@ -194,16 +194,16 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_edit_page() {
|
||||
public function handle_edit_page(): void {
|
||||
|
||||
$settings_to_save = wu_request('submit') !== 'restore' ? $_POST : array(); // don't worry, this gets cleaned later on.
|
||||
$settings_to_save = wu_request('submit') !== 'restore' ? $_POST : []; // don't worry, this gets cleaned later on.
|
||||
|
||||
$this->save_page_settings($settings_to_save);
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => add_query_arg('updated', 1, $_SERVER['HTTP_REFERER']),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -239,14 +239,14 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_page_settings() {
|
||||
public function register_page_settings(): void {
|
||||
|
||||
wu_register_settings_field(
|
||||
'core',
|
||||
$this->get_page_unique_id() . '_settings',
|
||||
array(
|
||||
[
|
||||
'raw' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_page_settings() {
|
||||
|
||||
$atts = wu_get_setting($this->get_page_unique_id() . '_settings', array());
|
||||
$atts = wu_get_setting($this->get_page_unique_id() . '_settings', []);
|
||||
|
||||
return wp_parse_args($atts, $this->get_defaults());
|
||||
}
|
||||
@ -284,13 +284,13 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function additional_hooks() {
|
||||
public function additional_hooks(): void {
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'register_additional_scripts'));
|
||||
add_action("load-$this->page_hook", [$this, 'register_additional_scripts']);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'add_additional_body_classes'));
|
||||
add_action("load-$this->page_hook", [$this, 'add_additional_body_classes']);
|
||||
|
||||
add_action("load-$this->page_hook", array($this, 'additional_on_page_load'));
|
||||
add_action("load-$this->page_hook", [$this, 'additional_on_page_load']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,13 +299,13 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function additional_on_page_load() {
|
||||
public function additional_on_page_load(): void {
|
||||
|
||||
add_filter('wu_element_display_super_admin_notice', array($this, 'is_edit_mode'));
|
||||
add_filter('wu_element_display_super_admin_notice', [$this, 'is_edit_mode']);
|
||||
|
||||
add_action("get_user_option_meta-box-order_{$this->page_hook}", array($this, 'get_settings'), 10, 3);
|
||||
add_action("get_user_option_meta-box-order_{$this->page_hook}", [$this, 'get_settings'], 10, 3);
|
||||
|
||||
add_action("get_user_option_screen_layout_{$this->page_hook}", array($this, 'get_settings'), 10, 3);
|
||||
add_action("get_user_option_screen_layout_{$this->page_hook}", [$this, 'get_settings'], 10, 3);
|
||||
|
||||
/**
|
||||
* 'Hack-y' solution for the customer facing title problem... but good enough for now.
|
||||
@ -330,7 +330,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_additional_body_classes() {
|
||||
public function add_additional_body_classes(): void {
|
||||
|
||||
add_action(
|
||||
'admin_body_class',
|
||||
@ -349,7 +349,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_additional_scripts() {
|
||||
public function register_additional_scripts(): void {
|
||||
|
||||
\WP_Ultimo\Scripts::get_instance()->register_style('wu-admin-screen', wu_get_asset('admin-screen.css', 'css'));
|
||||
|
||||
@ -360,21 +360,21 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
}
|
||||
|
||||
if (current_user_can($this->edit_capability)) {
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-admin-screen', wu_get_asset('admin-screen.js', 'js'), array('jquery', 'wu-fonticonpicker'));
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-admin-screen', wu_get_asset('admin-screen.js', 'js'), ['jquery', 'wu-fonticonpicker']);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-admin-screen',
|
||||
'wu_admin_screen',
|
||||
array(
|
||||
[
|
||||
'page_customize_link' => wu_get_form_url("edit_admin_page_$this->id"),
|
||||
'customize_link' => add_query_arg('customize', 1),
|
||||
'close_link' => remove_query_arg('customize'),
|
||||
'i18n' => array(
|
||||
'i18n' => [
|
||||
'page_customize_label' => __('Customize Page', 'wp-ultimo'),
|
||||
'customize_label' => __('Customize Elements', 'wp-ultimo'),
|
||||
'close_label' => __('Exit Customize Mode', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-admin-screen');
|
||||
@ -411,13 +411,13 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
* @param mixed $_meta_value The original saved value.
|
||||
* @return void
|
||||
*/
|
||||
public function save_settings($meta_id, $user_id, $meta_key, $_meta_value) {
|
||||
public function save_settings($meta_id, $user_id, $meta_key, $_meta_value): void {
|
||||
|
||||
if (wu_request('action') !== 'meta-box-order') {
|
||||
return;
|
||||
}
|
||||
|
||||
$is_this_page = strpos((string) wu_request('page'), $this->id) !== false;
|
||||
$is_this_page = str_contains((string) wu_request('page'), $this->id);
|
||||
|
||||
if ( ! $is_this_page) {
|
||||
return;
|
||||
@ -460,7 +460,7 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
$this->title . ' ' . $this->get_badge(),
|
||||
$this->get_capability(),
|
||||
$this->id,
|
||||
array($this, 'display'),
|
||||
[$this, 'display'],
|
||||
$this->menu_icon,
|
||||
$this->position
|
||||
);
|
||||
|
@ -76,9 +76,9 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_broadcasts',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -86,72 +86,72 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'events',
|
||||
array(
|
||||
[
|
||||
'title' => __('Events', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Inside_Events_List_Table(),
|
||||
'query_filter' => array($this, 'events_query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'events_query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'save_broadcast',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'type' => $this->get_object()->get_type(),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
'type' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'type' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Broadcast Type', 'wp-ultimo'),
|
||||
'placeholder' => __('Type', 'wp-ultimo'),
|
||||
'desc' => __('Broadcast type cannot be edited.', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'broadcast_email' => __('Email', 'wp-ultimo'),
|
||||
'broadcast_notice' => __('Admin Notice', 'wp-ultimo'),
|
||||
),
|
||||
],
|
||||
'value' => $this->get_object()->get_type(),
|
||||
'tooltip' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'disabled' => 'disabled',
|
||||
'name' => '',
|
||||
),
|
||||
),
|
||||
'notice_type' => array(
|
||||
],
|
||||
],
|
||||
'notice_type' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Broadcast Status', 'wp-ultimo'),
|
||||
'placeholder' => __('Status', 'wp-ultimo'),
|
||||
'desc' => __('This option determines the color of the admin notice.', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'info' => __('Info (blue)', 'wp-ultimo'),
|
||||
'success' => __('Success (green)', 'wp-ultimo'),
|
||||
'warning' => __('Warning (yellow)', 'wp-ultimo'),
|
||||
'error' => __('Error (red)', 'wp-ultimo'),
|
||||
),
|
||||
],
|
||||
'value' => $this->get_object()->get_notice_type(),
|
||||
'tooltip' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-if' => 'type === "broadcast_notice"',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box('wp-ultimo-broadcast-customer-targets', __('Customer Targets', 'wp-ultimo'), array($this, 'output_default_widget_customer_targets'), get_current_screen()->id, 'side');
|
||||
add_meta_box('wp-ultimo-broadcast-customer-targets', __('Customer Targets', 'wp-ultimo'), [$this, 'output_default_widget_customer_targets'], get_current_screen()->id, 'side');
|
||||
|
||||
add_meta_box('wp-ultimo-broadcast-product-targets', __('Product Targets', 'wp-ultimo'), array($this, 'output_default_widget_product_targets'), get_current_screen()->id, 'side');
|
||||
add_meta_box('wp-ultimo-broadcast-product-targets', __('Product Targets', 'wp-ultimo'), [$this, 'output_default_widget_product_targets'], get_current_screen()->id, 'side');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,13 +160,13 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_customer_targets() {
|
||||
public function output_default_widget_customer_targets(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
$all_targets = $object->get_message_targets();
|
||||
|
||||
$targets = array();
|
||||
$targets = [];
|
||||
|
||||
$customer_targets = wu_get_isset($all_targets, 'customers', '');
|
||||
|
||||
@ -198,9 +198,9 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
case $targets_count === 1:
|
||||
$customer = wu_get_customer($targets[0]);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -209,10 +209,10 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_name = $customer->get_display_name();
|
||||
@ -242,14 +242,14 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -257,13 +257,13 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
}
|
||||
|
||||
if ($targets_count < 7) {
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $object->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu--mr-4">
|
||||
@ -277,13 +277,13 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
} else {
|
||||
$count = $targets_count - 6;
|
||||
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $object->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-ml-4">
|
||||
@ -310,25 +310,25 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_product_targets() {
|
||||
public function output_default_widget_product_targets(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
$targets = wu_get_broadcast_targets($object->get_id(), 'products');
|
||||
|
||||
$product_targets = array();
|
||||
$product_targets = [];
|
||||
|
||||
if ($targets) {
|
||||
foreach ($targets as $key => $value) {
|
||||
$product = wu_get_product($value);
|
||||
|
||||
if ($product) {
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_product_targets_display',
|
||||
'product_id' => $product->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
);
|
||||
];
|
||||
|
||||
$link = wu_get_form_url('view_broadcast_targets', $modal_atts);
|
||||
|
||||
@ -347,23 +347,23 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
// translators: %s is the number of customers.
|
||||
$description = sprintf(__('%s customer(s) targeted.', 'wp-ultimo'), $customer_count);
|
||||
|
||||
$product_targets[ $key ] = array(
|
||||
$product_targets[ $key ] = [
|
||||
'link' => $link,
|
||||
'avatar' => $image,
|
||||
'display_name' => $product->get_name(),
|
||||
'id' => $product->get_id(),
|
||||
'description' => $description,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'targets' => $product_targets,
|
||||
'loading_text' => __('Loading...', 'wp-ultimo'),
|
||||
'wrapper_class' => 'wu-bg-gray-100 wu--mt-3 wu--mb-6 wu--mx-3',
|
||||
'modal_class' => 'wubox',
|
||||
);
|
||||
];
|
||||
|
||||
wu_get_template('broadcast/widget-targets', $args);
|
||||
}
|
||||
@ -398,7 +398,7 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,7 +409,7 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Broadcast', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Broadcast', 'wp-ultimo'),
|
||||
'updated_message' => __('Broadcast updated with success!', 'wp-ultimo'),
|
||||
@ -419,7 +419,7 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Broadcast', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,10 +432,10 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'broadcast',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -495,10 +495,10 @@ class Broadcast_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function events_query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'broadcast',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_broadcasts',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms that we use for send broadcasts.
|
||||
@ -62,28 +62,28 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new broadcast notice.
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_broadcast_message',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_broadcast_modal'),
|
||||
'handler' => array($this, 'handle_add_new_broadcast_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_broadcast_modal'],
|
||||
'handler' => [$this, 'handle_add_new_broadcast_modal'],
|
||||
'capability' => 'wu_add_broadcasts',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
* Ajax to render the broadcast targets modal.
|
||||
*/
|
||||
add_action('wu_ajax_wu_modal_targets_display', array($this, 'display_targets_modal'));
|
||||
add_action('wu_ajax_wu_modal_targets_display', [$this, 'display_targets_modal']);
|
||||
|
||||
/**
|
||||
* Ajax to render the targets modal with customers from a specific membership.
|
||||
*/
|
||||
add_action('wu_ajax_wu_modal_product_targets_display', array($this, 'display_product_targets_modal'));
|
||||
add_action('wu_ajax_wu_modal_product_targets_display', [$this, 'display_product_targets_modal']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +92,7 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
@ -105,7 +105,7 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_targets_modal() {
|
||||
public function display_targets_modal(): void {
|
||||
|
||||
$broadcast_id = wu_request('object_id');
|
||||
|
||||
@ -115,16 +115,16 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$targets = wu_get_broadcast_targets($object->get_id(), $target_type);
|
||||
|
||||
$display_targets = array();
|
||||
$display_targets = [];
|
||||
|
||||
if ($targets) {
|
||||
if ($target_type === 'customers') {
|
||||
foreach ($targets as $key => $value) {
|
||||
$customer = wu_get_customer($value);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -133,19 +133,19 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
48,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_targets[ $key ] = array(
|
||||
$display_targets[ $key ] = [
|
||||
'link' => $link,
|
||||
'avatar' => $avatar,
|
||||
'display_name' => $customer->get_display_name(),
|
||||
'id' => $customer->get_id(),
|
||||
'description' => $customer->get_email_address(),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,9 +153,9 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
foreach ($targets as $key => $value) {
|
||||
$product = wu_get_product($value);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $product->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$link = wu_network_admin_url('wp-ultimo-edit-product', $url_atts);
|
||||
|
||||
@ -178,22 +178,22 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
// translators: %s is the number of customers.
|
||||
$description = sprintf(__('%s customer(s) targeted.', 'wp-ultimo'), $customer_count);
|
||||
|
||||
$display_targets[ $key ] = array(
|
||||
$display_targets[ $key ] = [
|
||||
'link' => $link,
|
||||
'avatar' => $avatar,
|
||||
'display_name' => $product->get_name(),
|
||||
'id' => $product->get_id(),
|
||||
'description' => $description,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'targets' => $display_targets,
|
||||
'wrapper_class' => 'wu-bg-gray-100 wu--mt-3 wu--mb-6 wu-max-h-2',
|
||||
'modal_class' => '',
|
||||
);
|
||||
];
|
||||
|
||||
wu_get_template('broadcast/widget-targets', $args);
|
||||
|
||||
@ -206,21 +206,21 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_product_targets_modal() {
|
||||
public function display_product_targets_modal(): void {
|
||||
|
||||
$product_id = wu_request('product_id');
|
||||
|
||||
$customers = wu_get_membership_customers($product_id);
|
||||
|
||||
$display_targets = array();
|
||||
$display_targets = [];
|
||||
|
||||
if ($customers) {
|
||||
foreach ($customers as $key => $value) {
|
||||
$customer = wu_get_customer($value);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -229,27 +229,27 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
48,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_targets[ $key ] = array(
|
||||
$display_targets[ $key ] = [
|
||||
'link' => $link,
|
||||
'avatar' => $avatar,
|
||||
'display_name' => $customer->get_display_name(),
|
||||
'id' => $customer->get_id(),
|
||||
'description' => $customer->get_email_address(),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'targets' => $display_targets,
|
||||
'wrapper_class' => 'wu-bg-gray-100 wu--mt-3 wu--mb-6 wu-max-h-2',
|
||||
'modal_class' => '',
|
||||
);
|
||||
];
|
||||
|
||||
wu_get_template('broadcast/widget-targets', $args);
|
||||
|
||||
@ -262,10 +262,10 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_broadcast_modal() {
|
||||
public function render_add_new_broadcast_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'type' => array(
|
||||
$fields = [
|
||||
'type' => [
|
||||
'type' => 'select-icon',
|
||||
'title' => __('Broadcast Type', 'wp-ultimo'),
|
||||
'desc' => __('Select the type of message you want to send.', 'wp-ultimo'),
|
||||
@ -273,171 +273,171 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
'classes' => 'wu-w-1/2',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 1',
|
||||
),
|
||||
'options' => array(
|
||||
'broadcast_notice' => array(
|
||||
],
|
||||
'options' => [
|
||||
'broadcast_notice' => [
|
||||
'title' => __('Message', 'wp-ultimo'),
|
||||
'tooltip' => __('Display a message on your customers\' dashboard.', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-before dashicons-excerpt-view',
|
||||
),
|
||||
'broadcast_email' => array(
|
||||
],
|
||||
'broadcast_email' => [
|
||||
'title' => __('Email', 'wp-ultimo'),
|
||||
'tooltip' => __('Send an email to your customers.', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-before dashicons-email',
|
||||
),
|
||||
),
|
||||
),
|
||||
'step_note' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'step_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => sprintf('<a href="#" class="wu-no-underline wu-mt-1 wu-uppercase wu-text-2xs wu-font-semibold wu-text-gray-600" v-show="step === 2" v-on:click.prevent="step = 1">%s</a>', __('← Back to Type Selection', 'wp-ultimo')),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 2',
|
||||
),
|
||||
),
|
||||
'target_customers' => array(
|
||||
],
|
||||
],
|
||||
'target_customers' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Target Customers', 'wp-ultimo'),
|
||||
'desc' => __('This broadcast will be sent to the user or users that are selected here. You can select more than one.', 'wp-ultimo'),
|
||||
'placeholder' => __('Search a customer...', 'wp-ultimo'),
|
||||
'min' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'target_customers',
|
||||
'data-model' => 'customer',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'display_name',
|
||||
'data-search-field' => 'display_name',
|
||||
'data-max-items' => 10000,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 2',
|
||||
),
|
||||
),
|
||||
'target_products' => array(
|
||||
],
|
||||
],
|
||||
'target_products' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Target Product', 'wp-ultimo'),
|
||||
'desc' => __('This broadcast will be sent to the users that have this product. You can select more than one.', 'wp-ultimo'),
|
||||
'placeholder' => __('Search for a product..', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'target_products',
|
||||
'data-model' => 'product',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'name',
|
||||
'data-search-field' => 'name',
|
||||
'data-max-items' => 99,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 2',
|
||||
),
|
||||
),
|
||||
'notice_type' => array(
|
||||
],
|
||||
],
|
||||
'notice_type' => [
|
||||
'title' => __('Message Type', 'wp-ultimo'),
|
||||
'desc' => __('The color of the notice is based on the type.', 'wp-ultimo'),
|
||||
'type' => 'select',
|
||||
'default' => 'success',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'success' => __('Success (green)', 'wp-ultimo'),
|
||||
'info' => __('Info (blue)', 'wp-ultimo'),
|
||||
'warning' => __('Warning (orange)', 'wp-ultimo'),
|
||||
'error' => __('Error (red)', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "step === 2 && require('type', 'broadcast_notice')",
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
'step_note_2' => array(
|
||||
],
|
||||
],
|
||||
'step_note_2' => [
|
||||
'type' => 'note',
|
||||
'desc' => sprintf('<a href="#" class="wu-no-underline wu-mt-1 wu-uppercase wu-text-2xs wu-font-semibold wu-text-gray-600" v-show="step === 3" v-on:click.prevent="step = 2">%s</a>', __('← Back to Target Selection', 'wp-ultimo')),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 3',
|
||||
),
|
||||
),
|
||||
'subject' => array(
|
||||
],
|
||||
],
|
||||
'subject' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Message Subject', 'wp-ultimo'),
|
||||
'desc' => __('The title will appear above the main content in the notice or used as subject of the email.', 'wp-ultimo'),
|
||||
'placeholder' => __('Enter a title for your broadcast.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'subject',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 3',
|
||||
),
|
||||
),
|
||||
'content' => array(
|
||||
],
|
||||
],
|
||||
'content' => [
|
||||
'id' => 'content',
|
||||
'title' => __('Content', 'wp-ultimo'),
|
||||
'desc' => __('The main content of your broadcast.', 'wp-ultimo'),
|
||||
'type' => 'wp-editor',
|
||||
'settings' => array(
|
||||
'tinymce' => array('toolbar1' => 'bold,italic,strikethrough,link,unlink,undo,redo,pastetext'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
'settings' => [
|
||||
'tinymce' => ['toolbar1' => 'bold,italic,strikethrough,link,unlink,undo,redo,pastetext'],
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'content',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 3',
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Next Step →', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 1',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => 'type === ""',
|
||||
'v-on:click.prevent' => 'step = 2',
|
||||
),
|
||||
),
|
||||
'submit_button_2' => array(
|
||||
],
|
||||
],
|
||||
'submit_button_2' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Next Step →', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 2',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => 'target_customers === "" && target_products === ""', // phpcs:ignore
|
||||
'v-on:click.prevent' => 'step = 3',
|
||||
),
|
||||
),
|
||||
'submit_button_3' => array(
|
||||
],
|
||||
],
|
||||
'submit_button_3' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Send →', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => 'subject === ""',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'step === 3',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_broadcast',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_new_broadcast',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'type' => 'broadcast_notice',
|
||||
'content' => '',
|
||||
'step' => 1,
|
||||
@ -445,10 +445,10 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
'target_customers' => '',
|
||||
'target_products' => '',
|
||||
'subject' => '',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -460,7 +460,7 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_broadcast_modal() {
|
||||
public function handle_add_new_broadcast_modal(): void {
|
||||
|
||||
$broadcast = Broadcast_Manager::get_instance();
|
||||
|
||||
@ -483,10 +483,10 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Broadcast removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Broadcast', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -530,19 +530,19 @@ class Broadcast_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Broadcast', 'wp-ultimo'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_broadcast_message'),
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-emails'),
|
||||
'label' => __('System Emails'),
|
||||
'icon' => 'wu-mail',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,9 +52,9 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_checkout_forms',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the list page tour.
|
||||
@ -62,31 +62,31 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Tours::get_instance()->create_tour(
|
||||
'checkout-form-list',
|
||||
array(
|
||||
array(
|
||||
[
|
||||
[
|
||||
'id' => 'checkout-form-list',
|
||||
'title' => __('Checkout Forms', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('Checkout Forms are an easy and flexible way to experiment with different approaches when trying to convert new customers.', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 'default-form',
|
||||
'title' => __('Experiment!', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('You can create as many checkout forms as you want, with different fields, products on offer, etc.', 'wp-ultimo'),
|
||||
__('Planning on running some sort of promotion? Why not create a custom landing page with a tailor-maid checkout form to go with? The possibilities are endless.', 'wp-ultimo'),
|
||||
),
|
||||
'attachTo' => array(
|
||||
],
|
||||
'attachTo' => [
|
||||
'element' => '#wp-ultimo-wrap > h1 > a:first-child',
|
||||
'on' => 'right',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -96,17 +96,17 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new Checkout Form
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_checkout_form',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_checkout_form_modal'),
|
||||
'handler' => array($this, 'handle_add_new_checkout_form_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_checkout_form_modal'],
|
||||
'handler' => [$this, 'handle_add_new_checkout_form_modal'],
|
||||
'capability' => 'wu_edit_checkout_forms',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -116,10 +116,10 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_checkout_form_modal() {
|
||||
public function render_add_new_checkout_form_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'template' => array(
|
||||
$fields = [
|
||||
'template' => [
|
||||
'type' => 'select-icon',
|
||||
'title' => __('Checkout Form Template', 'wp-ultimo'),
|
||||
'desc' => __('Select a starting point for a new Checkout Form.', 'wp-ultimo'),
|
||||
@ -127,49 +127,49 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
'classes' => 'wu-w-1/3',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'template',
|
||||
),
|
||||
'options' => array(
|
||||
'single-step' => array(
|
||||
],
|
||||
'options' => [
|
||||
'single-step' => [
|
||||
'title' => __('Single Step', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-before dashicons-list-view',
|
||||
),
|
||||
'multi-step' => array(
|
||||
],
|
||||
'multi-step' => [
|
||||
'title' => __('Multi-Step', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-before dashicons-excerpt-view',
|
||||
),
|
||||
'blank' => array(
|
||||
],
|
||||
'blank' => [
|
||||
'title' => __('Blank', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-before dashicons-admin-page',
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Go to the Editor →', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_checkout_form',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_checkout_form_field',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'template' => 'single-step',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -181,7 +181,7 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_checkout_form_modal() {
|
||||
public function handle_add_new_checkout_form_modal(): void {
|
||||
|
||||
$template = wu_request('template');
|
||||
|
||||
@ -201,14 +201,14 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
wp_send_json_error($status);
|
||||
} else {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-checkout-form',
|
||||
array(
|
||||
[
|
||||
'id' => $checkout_form->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -221,10 +221,10 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Checkout Form removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Checkout Form', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,14 +268,14 @@ class Checkout_Form_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Checkout Form'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_checkout_form'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,11 +46,11 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.1
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
|
||||
add_action('plugins_loaded', array($this, 'export_customers'));
|
||||
add_action('plugins_loaded', [$this, 'export_customers']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +59,7 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.1
|
||||
* @return void
|
||||
*/
|
||||
public function export_customers() {
|
||||
public function export_customers(): void {
|
||||
|
||||
if (wu_request('wu_action') !== 'wu_export_customers') {
|
||||
return;
|
||||
@ -81,7 +81,7 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
$billing_address = array_map(fn($field) => $field['value'], $customer->get_billing_address()->get_fields());
|
||||
|
||||
return array_merge(
|
||||
array(
|
||||
[
|
||||
$customer->get_id(),
|
||||
$customer->get_user_id(),
|
||||
$customer->get_hash(),
|
||||
@ -93,12 +93,12 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
$customer->get_signup_form(),
|
||||
$membership_amount,
|
||||
implode('|', $memberships_ids),
|
||||
),
|
||||
],
|
||||
$billing_address,
|
||||
array(
|
||||
[
|
||||
$customer->get_last_login(),
|
||||
$customer->get_date_registered(),
|
||||
)
|
||||
]
|
||||
);
|
||||
},
|
||||
wu_get_customers()
|
||||
@ -107,7 +107,7 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
$billing_fields = array_keys(\WP_Ultimo\Objects\Billing_Address::fields());
|
||||
|
||||
$headers = array_merge(
|
||||
array(
|
||||
[
|
||||
'id',
|
||||
'user_id',
|
||||
'customer_hash',
|
||||
@ -119,17 +119,17 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
'signup_form',
|
||||
'membership_amount',
|
||||
'membership_ids',
|
||||
),
|
||||
],
|
||||
$billing_fields,
|
||||
array(
|
||||
[
|
||||
'last_login',
|
||||
'date_registered',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$file_name = sprintf('wp-ultimo-customers-(%s)', gmdate('Y-m-d', wu_get_current_time('timestamp')));
|
||||
|
||||
wu_generate_csv($file_name, array_merge(array($headers), $customer_data));
|
||||
wu_generate_csv($file_name, array_merge([$headers], $customer_data));
|
||||
|
||||
die;
|
||||
}
|
||||
@ -144,9 +144,9 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_customers',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms that we use for payments.
|
||||
@ -154,17 +154,17 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new Customer
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_customer',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_customer_modal'),
|
||||
'handler' => array($this, 'handle_add_new_customer_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_customer_modal'],
|
||||
'handler' => [$this, 'handle_add_new_customer_modal'],
|
||||
'capability' => 'wu_invite_customers',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -174,100 +174,100 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_customer_modal() {
|
||||
public function render_add_new_customer_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'type' => array(
|
||||
$fields = [
|
||||
'type' => [
|
||||
'type' => 'tab-select',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
'options' => array(
|
||||
],
|
||||
'options' => [
|
||||
'existing' => __('Existing User', 'wp-ultimo'),
|
||||
'new' => __('Invite New', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
'user_id' => array(
|
||||
],
|
||||
],
|
||||
'user_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Existing User', 'wp-ultimo'),
|
||||
'placeholder' => __('Search WordPress user...', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'min' => 1,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'existing')",
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'data-model' => 'user',
|
||||
'data-value-field' => 'ID',
|
||||
'data-label-field' => 'display_name',
|
||||
'data-search-field' => 'display_name',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
),
|
||||
'username' => array(
|
||||
],
|
||||
],
|
||||
'username' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Username', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. johnsmith', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'new')",
|
||||
),
|
||||
),
|
||||
'email_address' => array(
|
||||
],
|
||||
],
|
||||
'email_address' => [
|
||||
'type' => 'email',
|
||||
'title' => __('Email Address', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. customer@wpultimo.dev', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'new')",
|
||||
),
|
||||
),
|
||||
'set_password' => array(
|
||||
],
|
||||
],
|
||||
'set_password' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Set Password', 'wp-ultimo'),
|
||||
'desc' => __('If not set, the user will be asked to set a password after accepting the invite.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'new')",
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'set_password',
|
||||
),
|
||||
),
|
||||
'password' => array(
|
||||
],
|
||||
],
|
||||
'password' => [
|
||||
'type' => 'password',
|
||||
'title' => __('Password', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. p@$$w0rd', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'new') && require('set_password', true)",
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Create Customer', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
// 'v-bind:disabled' => '!confirmed',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_customer',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_new_customer',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'set_password' => false,
|
||||
'type' => 'existing',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -279,19 +279,19 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_customer_modal() {
|
||||
public function handle_add_new_customer_modal(): void {
|
||||
|
||||
if (wu_request('type', 'existing') === 'new') {
|
||||
$customer_data = array(
|
||||
$customer_data = [
|
||||
'email' => wu_request('email_address'),
|
||||
'username' => wu_request('username'),
|
||||
'password' => wu_request('password', false),
|
||||
'meta' => array(),
|
||||
);
|
||||
'meta' => [],
|
||||
];
|
||||
} else {
|
||||
$customer_data = array(
|
||||
$customer_data = [
|
||||
'user_id' => wu_request('user_id', 0),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
@ -304,14 +304,14 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-customer',
|
||||
array(
|
||||
[
|
||||
'id' => $customer->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -331,10 +331,10 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Customer removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Customer', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -378,24 +378,24 @@ class Customer_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Customer', 'wp-ultimo'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_customer'),
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'label' => __('Export as CSV', 'wp-ultimo'),
|
||||
'icon' => 'wu-export',
|
||||
'url' => add_query_arg(
|
||||
array(
|
||||
[
|
||||
'wu_action' => 'wu_export_customers',
|
||||
'nonce' => wp_create_nonce('wu_export_customers'),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ abstract class Customizer_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
/**
|
||||
* Process save, if necessary
|
||||
@ -59,7 +59,7 @@ abstract class Customizer_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
add_action("wu_edit_{$screen->id}_after_normal", array($this, 'display_preview_window'));
|
||||
add_action("wu_edit_{$screen->id}_after_normal", [$this, 'display_preview_window']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,14 +68,14 @@ abstract class Customizer_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_preview_window() {
|
||||
public function display_preview_window(): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/edit/editor-customizer',
|
||||
array(
|
||||
[
|
||||
'preview_iframe_url' => $this->get_preview_url(),
|
||||
'preview_height' => $this->preview_height,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -85,11 +85,11 @@ abstract class Customizer_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_enqueue_script('wu-customizer', wu_get_asset('customizer.js', 'js'), array('jquery', 'wu-vue', 'wu-block-ui'));
|
||||
wp_enqueue_script('wu-customizer', wu_get_asset('customizer.js', 'js'), ['jquery', 'wu-vue', 'wu-block-ui']);
|
||||
|
||||
wp_enqueue_style('wp-color-picker');
|
||||
|
||||
|
@ -60,9 +60,9 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_dashboard',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The tab being displayed.
|
||||
@ -94,7 +94,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
|
||||
@ -113,11 +113,11 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function hooks() {
|
||||
public function hooks(): void {
|
||||
|
||||
add_action('wu_dash_after_full_metaboxes', array($this, 'render_filter'));
|
||||
add_action('wu_dash_after_full_metaboxes', [$this, 'render_filter']);
|
||||
|
||||
add_action('wu_dashboard_general_widgets', array($this, 'register_general_tab_widgets'), 10, 2);
|
||||
add_action('wu_dashboard_general_widgets', [$this, 'register_general_tab_widgets'], 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,32 +128,32 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @param WP_Ultimo\Admin_Pages\Base_Admin_Page $page The page object.
|
||||
* @return void
|
||||
*/
|
||||
public function render_filter($page) {
|
||||
public function render_filter($page): void {
|
||||
|
||||
if (apply_filters('wu_dashboard_display_filter', true) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($page->id === 'wp-ultimo') {
|
||||
$preset_options = array(
|
||||
'last_7_days' => array(
|
||||
$preset_options = [
|
||||
'last_7_days' => [
|
||||
'label' => __('Last 7 days', 'wp-ultimo'),
|
||||
'start_date' => date_i18n('Y-m-d', strtotime('-7 days')),
|
||||
'end_date' => date_i18n('Y-m-d'),
|
||||
),
|
||||
'last_30_days' => array(
|
||||
],
|
||||
'last_30_days' => [
|
||||
'label' => __('Last 30 days', 'wp-ultimo'),
|
||||
'start_date' => date_i18n('Y-m-d', strtotime('-30 days')),
|
||||
'end_date' => date_i18n('Y-m-d'),
|
||||
),
|
||||
'year_to_date' => array(
|
||||
],
|
||||
'year_to_date' => [
|
||||
'label' => __('Year to date', 'wp-ultimo'),
|
||||
'start_date' => date_i18n('Y-m-d', strtotime('first day of january this year')),
|
||||
'end_date' => date_i18n('Y-m-d'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'preset_options' => $preset_options,
|
||||
'filters_el_id' => 'dashboard-filters',
|
||||
'search_label' => '',
|
||||
@ -162,7 +162,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
'table' => $this,
|
||||
'active_tab' => $this->tab,
|
||||
'views' => $this->get_views(),
|
||||
);
|
||||
];
|
||||
|
||||
wu_get_template('dashboard-statistics/filter', $args);
|
||||
}
|
||||
@ -176,14 +176,14 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
$dashboard_filters = array(
|
||||
'general' => array(
|
||||
$dashboard_filters = [
|
||||
'general' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('tab', 'general'),
|
||||
'label' => __('General', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return apply_filters('wu_dashboard_filter_bar', $dashboard_filters);
|
||||
}
|
||||
@ -194,7 +194,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
@ -227,49 +227,49 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
if (wu_request('tab', 'general') === 'general') {
|
||||
\WP_Ultimo\UI\Tours::get_instance()->create_tour(
|
||||
'wp-ultimo-dashboard',
|
||||
array(
|
||||
array(
|
||||
[
|
||||
[
|
||||
'id' => 'your-dashboard',
|
||||
'title' => __('Our dashboard', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('This is the <strong>WP Multisite WaaS Dashboard</strong>, where you will find most of the important information you will need regarding your business\' performance.', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 'documentation',
|
||||
'title' => __('Learning more', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('Most of the WP Multisite WaaS admin pages will contain a link like this one at the top. These will link directly to the relevant knowledge base page on the WP Multisite WaaS site.', 'wp-ultimo'),
|
||||
),
|
||||
'attachTo' => array(
|
||||
],
|
||||
'attachTo' => [
|
||||
'element' => '#wp-ultimo-wrap > h1 > a:last-child',
|
||||
'on' => 'left',
|
||||
),
|
||||
),
|
||||
array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 'mrr-growth',
|
||||
'title' => __('It\'s all about growth!', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('This graph allows you to follow how your monthly recurring revenue is growing this year.', 'wp-ultimo'),
|
||||
),
|
||||
'attachTo' => array(
|
||||
],
|
||||
'attachTo' => [
|
||||
'element' => '#wp-ultimo-mrr-growth',
|
||||
'on' => 'bottom',
|
||||
),
|
||||
),
|
||||
array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 'tailor-made',
|
||||
'title' => __('Date-range support', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__('Checking statistics and comparing data for different periods is key in maintaining a good grasp on your business.', 'wp-ultimo'),
|
||||
__('You can use the date-range selectors to have access to just the data you need and nothing more.', 'wp-ultimo'),
|
||||
),
|
||||
'attachTo' => array(
|
||||
],
|
||||
'attachTo' => [
|
||||
'element' => '#dashboard-filters',
|
||||
'on' => 'bottom',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -283,21 +283,21 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @param \WP_Screen $screen The screen object.
|
||||
* @return void
|
||||
*/
|
||||
public function register_general_tab_widgets($tab, $screen) {
|
||||
public function register_general_tab_widgets($tab, $screen): void {
|
||||
|
||||
if (current_user_can('wu_read_financial')) {
|
||||
add_meta_box('wp-ultimo-mrr-growth', __('Monthly Recurring Revenue Growth', 'wp-ultimo'), array($this, 'output_widget_mrr_growth'), $screen->id, 'full', 'high');
|
||||
add_meta_box('wp-ultimo-mrr-growth', __('Monthly Recurring Revenue Growth', 'wp-ultimo'), [$this, 'output_widget_mrr_growth'], $screen->id, 'full', 'high');
|
||||
|
||||
add_meta_box('wp-ultimo-revenue', __('Revenue', 'wp-ultimo'), array($this, 'output_widget_revenues'), $screen->id, 'normal', 'high');
|
||||
add_meta_box('wp-ultimo-revenue', __('Revenue', 'wp-ultimo'), [$this, 'output_widget_revenues'], $screen->id, 'normal', 'high');
|
||||
}
|
||||
|
||||
add_meta_box('wp-ultimo-countries', __('Signups by Countries', 'wp-ultimo'), array($this, 'output_widget_countries'), $screen->id, 'side', 'high');
|
||||
add_meta_box('wp-ultimo-countries', __('Signups by Countries', 'wp-ultimo'), [$this, 'output_widget_countries'], $screen->id, 'side', 'high');
|
||||
|
||||
add_meta_box('wp-ultimo-signups', __('Signups by Form', 'wp-ultimo'), array($this, 'output_widget_forms'), $screen->id, 'side', 'high');
|
||||
add_meta_box('wp-ultimo-signups', __('Signups by Form', 'wp-ultimo'), [$this, 'output_widget_forms'], $screen->id, 'side', 'high');
|
||||
|
||||
add_meta_box('wp-ultimo-most-visited-sites', __('Most Visited Sites', 'wp-ultimo'), array($this, 'output_widget_most_visited_sites'), $screen->id, 'side', 'low');
|
||||
add_meta_box('wp-ultimo-most-visited-sites', __('Most Visited Sites', 'wp-ultimo'), [$this, 'output_widget_most_visited_sites'], $screen->id, 'side', 'low');
|
||||
|
||||
add_meta_box('wp-ultimo-new-accounts', __('New Memberships', 'wp-ultimo'), array($this, 'output_widget_new_accounts'), $screen->id, 'normal', 'low');
|
||||
add_meta_box('wp-ultimo-new-accounts', __('New Memberships', 'wp-ultimo'), [$this, 'output_widget_new_accounts'], $screen->id, 'normal', 'low');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,7 +306,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @return void
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function output_widget_mrr_growth() {
|
||||
public function output_widget_mrr_growth(): void {
|
||||
|
||||
wu_get_template('dashboard-statistics/widget-mrr-growth');
|
||||
}
|
||||
@ -317,14 +317,14 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @return void
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function output_widget_countries() {
|
||||
public function output_widget_countries(): void {
|
||||
|
||||
wu_get_template(
|
||||
'dashboard-statistics/widget-countries',
|
||||
array(
|
||||
[
|
||||
'countries' => wu_get_countries_of_customers(10, $this->start_date, $this->end_date),
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -334,14 +334,14 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @return void
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function output_widget_forms() {
|
||||
public function output_widget_forms(): void {
|
||||
|
||||
wu_get_template(
|
||||
'dashboard-statistics/widget-forms',
|
||||
array(
|
||||
[
|
||||
'forms' => wu_calculate_signups_by_form($this->start_date, $this->end_date),
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -351,9 +351,9 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @return void
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function output_widget_most_visited_sites() {
|
||||
public function output_widget_most_visited_sites(): void {
|
||||
|
||||
$sites = array();
|
||||
$sites = [];
|
||||
|
||||
$site_results = \WP_Ultimo\Objects\Visits::get_sites_by_visit_count($this->start_date, $this->end_date, 10);
|
||||
|
||||
@ -364,18 +364,18 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sites[] = (object) array(
|
||||
$sites[] = (object) [
|
||||
'site' => $site,
|
||||
'count' => $site_result->count,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
wu_get_template(
|
||||
'dashboard-statistics/widget-most-visited-sites',
|
||||
array(
|
||||
[
|
||||
'sites' => $sites,
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -388,16 +388,16 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $metabox With the metabox arguments passed when registered.
|
||||
* @return void.
|
||||
*/
|
||||
public function output_widget_revenues($unknown = null, $metabox = null) {
|
||||
public function output_widget_revenues($unknown = null, $metabox = null): void {
|
||||
|
||||
wu_get_template(
|
||||
'dashboard-statistics/widget-revenue',
|
||||
array(
|
||||
[
|
||||
'mrr' => wu_calculate_mrr(),
|
||||
'gross_revenue' => wu_calculate_revenue($this->start_date, $this->end_date),
|
||||
'refunds' => wu_calculate_refunds($this->start_date, $this->end_date),
|
||||
'product_stats' => wu_calculate_financial_data_by_product($this->start_date, $this->end_date),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -410,25 +410,25 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $metabox With the metabox arguments passed when registered.
|
||||
* @return void.
|
||||
*/
|
||||
public function output_widget_new_accounts($unknown = null, $metabox = array()) {
|
||||
public function output_widget_new_accounts($unknown = null, $metabox = []): void {
|
||||
|
||||
$new_accounts = wu_get_memberships(
|
||||
array(
|
||||
'fields' => array('plan_id'),
|
||||
'date_query' => array(
|
||||
[
|
||||
'fields' => ['plan_id'],
|
||||
'date_query' => [
|
||||
'column' => 'date_created',
|
||||
'after' => $this->start_date . ' 00:00:00',
|
||||
'before' => $this->end_date . ' 23:59:59',
|
||||
'inclusive' => true,
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$products = wu_get_products(
|
||||
array(
|
||||
[
|
||||
'type' => 'plan',
|
||||
'fields' => array('id', 'name', 'count'),
|
||||
)
|
||||
'fields' => ['id', 'name', 'count'],
|
||||
]
|
||||
);
|
||||
|
||||
$products_ids = array_column($products, 'id');
|
||||
@ -448,10 +448,10 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
/**
|
||||
* Add edge case for no plan.
|
||||
*/
|
||||
$products['none'] = (object) array(
|
||||
$products['none'] = (object) [
|
||||
'name' => __('No Product', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($new_accounts as $new_account) {
|
||||
if (isset($products[ $new_account->plan_id ])) {
|
||||
@ -463,10 +463,10 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
wu_get_template(
|
||||
'dashboard-statistics/widget-new-accounts',
|
||||
array(
|
||||
[
|
||||
'new_accounts' => count($new_accounts),
|
||||
'products' => $products,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -476,9 +476,9 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
$month_list = array();
|
||||
$month_list = [];
|
||||
|
||||
$current_year = date_i18n('Y');
|
||||
|
||||
@ -487,42 +487,42 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
}
|
||||
|
||||
$statistics = new Dashboard_Statistics(
|
||||
array(
|
||||
[
|
||||
'start_date' => $this->start_date,
|
||||
'end_date' => $this->end_date,
|
||||
'types' => array(
|
||||
'types' => [
|
||||
'mrr_growth' => 'mrr_growth',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$data = $statistics->statistics_data();
|
||||
|
||||
wp_register_script('wu-apex-charts', wu_get_asset('apexcharts.js', 'js/lib'), array(), wu_get_version(), true);
|
||||
wp_register_script('wu-apex-charts', wu_get_asset('apexcharts.js', 'js/lib'), [], wu_get_version(), true);
|
||||
|
||||
wp_register_script('wu-vue-apex-charts', wu_get_asset('vue-apexcharts.js', 'js/lib'), array(), wu_get_version(), true);
|
||||
wp_register_script('wu-vue-apex-charts', wu_get_asset('vue-apexcharts.js', 'js/lib'), [], wu_get_version(), true);
|
||||
|
||||
wp_register_script('wu-dashboard-stats', wu_get_asset('dashboard-statistics.js', 'js'), array('jquery', 'wu-functions', 'wu-ajax-list-table', 'moment', 'wu-block-ui', 'dashboard', 'wu-apex-charts', 'wu-vue-apex-charts'), wu_get_version(), true);
|
||||
wp_register_script('wu-dashboard-stats', wu_get_asset('dashboard-statistics.js', 'js'), ['jquery', 'wu-functions', 'wu-ajax-list-table', 'moment', 'wu-block-ui', 'dashboard', 'wu-apex-charts', 'wu-vue-apex-charts'], wu_get_version(), true);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-dashboard-stats',
|
||||
'wu_dashboard_statistics_vars',
|
||||
array(
|
||||
[
|
||||
'mrr_array' => $data['mrr_growth'],
|
||||
'start_date' => date_i18n('Y-m-d', strtotime((string) wu_request('start_date', '-1 month'))),
|
||||
'end_date' => date_i18n('Y-m-d', strtotime((string) wu_request('end_date', 'tomorrow'))),
|
||||
'today' => date_i18n('Y-m-d', strtotime('tomorrow')),
|
||||
'month_list' => $month_list,
|
||||
'i18n' => array(
|
||||
'i18n' => [
|
||||
'new_mrr' => __('New MRR', 'wp-ultimo'),
|
||||
'cancellations' => __('Cancellations', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-dashboard-stats');
|
||||
|
||||
wp_enqueue_style('wu-apex-charts', wu_get_asset('apexcharts.css', 'css'), array(), wu_get_version());
|
||||
wp_enqueue_style('wu-apex-charts', wu_get_asset('apexcharts.css', 'css'), [], wu_get_version());
|
||||
|
||||
wp_enqueue_style('wu-flags');
|
||||
}
|
||||
@ -566,17 +566,17 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/dash',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'has_full_position' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -588,16 +588,16 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $args Data array to convert to CSV.
|
||||
* @return void
|
||||
*/
|
||||
public function render_csv_button($args) {
|
||||
public function render_csv_button($args): void {
|
||||
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
[
|
||||
'slug' => 'csv',
|
||||
'headers' => array(),
|
||||
'data' => array(),
|
||||
'headers' => [],
|
||||
'data' => [],
|
||||
'action' => apply_filters('wu_export_data_table_action', 'wu_generate_csv'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$slug = $args['slug'];
|
||||
|
@ -77,9 +77,9 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_discount_codes',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -87,150 +87,150 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
$this->add_fields_widget(
|
||||
'description',
|
||||
array(
|
||||
[
|
||||
'title' => __('Description', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'fields' => array(
|
||||
'description' => array(
|
||||
'fields' => [
|
||||
'description' => [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Description', 'wp-ultimo'),
|
||||
'placeholder' => __('Tell your customers what this product is about.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_description(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'rows' => 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$tz_note = sprintf('The site timezone is <code>%s</code>. The current time is <code>%s</code>', date_i18n('e'), date_i18n('r'));
|
||||
|
||||
$options = array(
|
||||
'general' => array(
|
||||
$options = [
|
||||
'general' => [
|
||||
'title' => __('Limit Uses', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-lock',
|
||||
'desc' => __('Rules and limitations to the applicability of this discount code.', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'uses' => array(
|
||||
'fields' => [
|
||||
'uses' => [
|
||||
'title' => __('Uses', 'wp-ultimo'),
|
||||
'type' => 'text-display',
|
||||
// translators: %d is the number of times the coupon was used.
|
||||
'display_value' => sprintf(__('This discount code was used %d times.', 'wp-ultimo'), $this->get_object()->get_uses()),
|
||||
'tooltip' => __('The number of times that this discount code was used so far.', 'wp-ultimo'),
|
||||
),
|
||||
'max_uses' => array(
|
||||
],
|
||||
'max_uses' => [
|
||||
'title' => __('Max Uses', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to set a limit on how many times this discount code can be used. Leave blank or 0 for unlimited uses.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'min' => 0,
|
||||
'placeholder' => 0,
|
||||
'value' => $this->get_object()->has_max_uses() ? $this->get_object()->get_max_uses() : __('Unlimited', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'time' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'time' => [
|
||||
'title' => __('Start & Expiration Dates', 'wp-ultimo'),
|
||||
'desc' => __('Define a start and end date for this discount code. Useful when running campaigns for a pre-determined period.', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-calendar',
|
||||
'state' => array(
|
||||
'state' => [
|
||||
'enable_date_start' => $this->get_object()->get_date_start(),
|
||||
'enable_date_expiration' => $this->get_object()->get_date_expiration(),
|
||||
),
|
||||
'fields' => array(
|
||||
'enable_date_start' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'enable_date_start' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Enable Start Date', 'wp-ultimo'),
|
||||
'desc' => __('Allows you to set a start date for this coupon code.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'enable_date_start',
|
||||
),
|
||||
),
|
||||
'date_start' => array(
|
||||
],
|
||||
],
|
||||
'date_start' => [
|
||||
'title' => __('Start Date', 'wp-ultimo'),
|
||||
'desc' => __('The discount code will only be good to be used after this date.', 'wp-ultimo') . ' ' . $tz_note,
|
||||
'type' => 'text',
|
||||
'date' => true,
|
||||
'value' => $this->edit ? $this->get_object()->get_date_start() : __('No date', 'wp-ultimo'),
|
||||
'placeholder' => 'E.g. 2020-04-04 12:00:00',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'enable_date_start',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-bind:name' => 'enable_date_start ? "date_start" : ""',
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'Y-m-d H:i:S',
|
||||
'data-allow-time' => 'true',
|
||||
),
|
||||
),
|
||||
'enable_date_expiration' => array(
|
||||
],
|
||||
],
|
||||
'enable_date_expiration' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Enable Expiration Date', 'wp-ultimo'),
|
||||
'desc' => __('Allows you to set an expiration date for this coupon code.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'enable_date_expiration',
|
||||
),
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
],
|
||||
'date_expiration' => [
|
||||
'title' => __('Expiration Date', 'wp-ultimo'),
|
||||
'desc' => __('The discount code will expire after this date.', 'wp-ultimo') . ' ' . $tz_note,
|
||||
'type' => 'text',
|
||||
'date' => true,
|
||||
'value' => $this->edit ? $this->get_object()->get_date_expiration() : __('Never Expires', 'wp-ultimo'),
|
||||
'placeholder' => 'E.g. 2020-04-04 12:00:00',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'enable_date_expiration',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-bind:name' => 'enable_date_expiration ? "date_expiration" : ""',
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'Y-m-d H:i:S',
|
||||
'data-allow-time' => 'true',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'products' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'products' => [
|
||||
'title' => __('Limit Products', 'wp-ultimo'),
|
||||
'desc' => __('Determine if you want this discount code to apply to all discountable products or not.', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-price-tag',
|
||||
'state' => array(
|
||||
'state' => [
|
||||
'limit_products' => $this->get_object()->get_limit_products(),
|
||||
),
|
||||
],
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
'limit_products' => array(
|
||||
[
|
||||
'limit_products' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Select Products', 'wp-ultimo'),
|
||||
'desc' => __('Manually select to which products this discount code should be applicable.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'limit_products',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
$this->get_product_field_list()
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$this->add_tabs_widget(
|
||||
'options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Advanced Options', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'sections' => apply_filters('wu_discount_code_options_sections', $options, $this->get_object()),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -240,151 +240,151 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'events',
|
||||
array(
|
||||
[
|
||||
'title' => __('Events', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Inside_Events_List_Table(),
|
||||
'query_filter' => array($this, 'query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'save_discount_code',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'apply_to_setup_fee' => $this->get_object()->get_setup_fee_value() > 0,
|
||||
'code' => $this->get_object()->get_code(),
|
||||
'type' => $this->get_object()->get_type(),
|
||||
'value' => $this->get_object()->get_value(),
|
||||
'setup_fee_type' => $this->get_object()->get_setup_fee_type(),
|
||||
'setup_fee_value' => $this->get_object()->get_setup_fee_value(),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
'code' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'code' => [
|
||||
'title' => __('Coupon Code', 'wp-ultimo'),
|
||||
'type' => 'text',
|
||||
'placeholder' => __('E.g. XMAS10OFF', 'wp-ultimo'),
|
||||
'desc' => __('The actual code your customers will enter during checkout.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_code(),
|
||||
'tooltip' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-on:input' => 'code = $event.target.value.toUpperCase().replace(/[^A-Z0-9-_]+/g, "")',
|
||||
'v-bind:value' => 'code',
|
||||
),
|
||||
),
|
||||
'value_group' => array(
|
||||
],
|
||||
],
|
||||
'value_group' => [
|
||||
'type' => 'group',
|
||||
'title' => __('Discount', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'fields' => array(
|
||||
'type' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'type' => [
|
||||
'type' => 'select',
|
||||
'value' => $this->get_object()->get_type(),
|
||||
'placeholder' => '',
|
||||
'wrapper_classes' => 'wu-w-2/3',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'percentage' => __('Percentage (%)', 'wp-ultimo'),
|
||||
// translators: %s is the currency symbol. e.g. $
|
||||
'absolute' => sprintf(__('Absolute (%s)', 'wp-ultimo'), wu_get_currency_symbol()),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
),
|
||||
'value' => array(
|
||||
],
|
||||
],
|
||||
'value' => [
|
||||
'type' => 'number',
|
||||
'value' => $this->get_object()->get_value(),
|
||||
'placeholder' => '',
|
||||
'wrapper_classes' => 'wu-ml-2 wu-w-1/3',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'min' => 0,
|
||||
'v-bind:max' => "type === 'percentage' ? 100 : 999999999",
|
||||
'step' => 'any',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'apply_to_renewals' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'apply_to_renewals' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Apply to Renewals', 'wp-ultimo'),
|
||||
'desc' => __('By default, discounts are only applied to the first payment.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->should_apply_to_renewals(),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
'apply_to_setup_fee' => array(
|
||||
],
|
||||
],
|
||||
'apply_to_setup_fee' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Setup Fee Discount', 'wp-ultimo'),
|
||||
'desc' => __('Also set a discount for setup fee?', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_setup_fee_value() > 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'apply_to_setup_fee',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
'setup_fee_value_group' => array(
|
||||
],
|
||||
],
|
||||
'setup_fee_value_group' => [
|
||||
'type' => 'group',
|
||||
'title' => __('Setup Fee Discount', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'apply_to_setup_fee',
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'fields' => array(
|
||||
'setup_fee_type' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'setup_fee_type' => [
|
||||
'type' => 'select',
|
||||
'value' => $this->get_object()->get_setup_fee_type(),
|
||||
'placeholder' => '',
|
||||
'wrapper_classes' => 'wu-w-2/3',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'percentage' => __('Percentage (%)', 'wp-ultimo'),
|
||||
// translators: %s is the currency symbol. e.g $
|
||||
'absolute' => sprintf(__('Absolute (%s)', 'wp-ultimo'), wu_get_currency_symbol()),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'setup_fee_type',
|
||||
),
|
||||
),
|
||||
'setup_fee_value' => array(
|
||||
],
|
||||
],
|
||||
'setup_fee_value' => [
|
||||
'type' => 'number',
|
||||
'value' => $this->get_object()->get_setup_fee_value(),
|
||||
'placeholder' => '',
|
||||
'wrapper_classes' => 'wu-ml-2 wu-w-1/3',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'min' => 0,
|
||||
'v-bind:max' => "setup_fee_type === 'percentage' ? 100 : 999999999",
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'active',
|
||||
array(
|
||||
[
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'active' => array(
|
||||
'fields' => [
|
||||
'active' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to manually enable or disable this discount code for new sign-ups.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_active(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -396,48 +396,48 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
protected function get_product_field_list() {
|
||||
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
|
||||
foreach (wu_get_products() as $product) {
|
||||
$product_id = $product->get_id();
|
||||
|
||||
$fields[ "allowed_products_{$product_id}" ] = array(
|
||||
$fields[ "allowed_products_{$product_id}" ] = [
|
||||
'type' => 'toggle',
|
||||
'title' => $product->get_name(),
|
||||
'desc' => __('Make applicable to this product.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'wrapper_classes' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
':name' => "'allowed_products[]'",
|
||||
':checked' => json_encode(!$this->get_object()->get_limit_products() || in_array($product_id, $this->get_object()->get_allowed_products())), // phpcs:ignore
|
||||
':value' => $product_id,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'limit_products',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// TODO: this is a hack-y fix. Needs to be re-implemented.
|
||||
$fields['allowed_products_none'] = array(
|
||||
$fields['allowed_products_none'] = [
|
||||
'type' => 'hidden',
|
||||
'value' => '__none',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
':name' => "'allowed_products[]'",
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if (empty($fields)) {
|
||||
$fields['allowed_products_no_products'] = array(
|
||||
$fields['allowed_products_no_products'] = [
|
||||
'type' => 'note',
|
||||
'title' => '',
|
||||
'desc' => __('You do not have any products at this moment.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'limit_products',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
@ -449,11 +449,11 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_legacy_options() {
|
||||
public function handle_legacy_options(): void {
|
||||
|
||||
global $wp_filter;
|
||||
|
||||
$tabs = array(__('Legacy Add-ons', 'wp-ultimo'));
|
||||
$tabs = [__('Legacy Add-ons', 'wp-ultimo')];
|
||||
|
||||
if ( ! isset($wp_filter['wp_ultimo_coupon_advanced_options'])) {
|
||||
return;
|
||||
@ -463,40 +463,40 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$priorities = $wp_filter['wp_ultimo_coupon_advanced_options']->callbacks;
|
||||
|
||||
$fields = array(
|
||||
'heading' => array(
|
||||
$fields = [
|
||||
'heading' => [
|
||||
'type' => 'header',
|
||||
'title' => __('Legacy Options', 'wp-ultimo'),
|
||||
// translators: %s is the comma-separated list of legacy add-ons.
|
||||
'desc' => sprintf(__('Options for %s, and others.', 'wp-ultimo'), implode(', ', $tabs)),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($priorities as $priority => $callbacks) {
|
||||
foreach ($callbacks as $id => $callable) {
|
||||
$fields[ $id ] = array(
|
||||
$fields[ $id ] = [
|
||||
'type' => 'html',
|
||||
'classes' => 'wu--mt-2',
|
||||
'content' => function () use ($callable) {
|
||||
|
||||
call_user_func($callable['function'], $this->get_object());
|
||||
},
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_fields_widget(
|
||||
'legacy-options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Legacy Options', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'fields' => $fields,
|
||||
'classes' => 'wu-legacy-options-panel',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'margin-top: -5px;',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -506,16 +506,16 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Delete Discount code - Confirmation modal
|
||||
*/
|
||||
|
||||
add_filter(
|
||||
'wu_data_json_success_delete_discount_code_modal',
|
||||
fn($data_json) => array(
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-discount-codes', array('deleted' => 1)),
|
||||
)
|
||||
fn($data_json) => [
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-discount-codes', ['deleted' => 1]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -529,10 +529,10 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'discount_code',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -567,7 +567,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -578,7 +578,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Discount Code', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Discount Code', 'wp-ultimo'),
|
||||
'updated_message' => __('Discount Code updated successfully!', 'wp-ultimo'),
|
||||
@ -588,7 +588,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Discount Code', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -639,7 +639,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
/*
|
||||
* Set the recurring value to zero if the toggle is disabled.
|
||||
*/
|
||||
|
@ -50,9 +50,9 @@ class Discount_Code_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_discount_codes',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -70,10 +70,10 @@ class Discount_Code_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Discount Code removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Discount Code', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,13 +117,13 @@ class Discount_Code_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-discount-code'),
|
||||
'label' => __('Add Discount Code'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,9 +76,9 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_domains',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms.
|
||||
@ -86,13 +86,13 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Adds the hooks to handle deletion.
|
||||
*/
|
||||
add_filter('wu_form_fields_delete_domain_modal', array($this, 'domain_extra_delete_fields'), 10, 2);
|
||||
add_filter('wu_form_fields_delete_domain_modal', [$this, 'domain_extra_delete_fields'], 10, 2);
|
||||
|
||||
add_action('wu_after_delete_domain_modal', array($this, 'domain_after_delete_actions'));
|
||||
add_action('wu_after_delete_domain_modal', [$this, 'domain_after_delete_actions']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,47 +116,47 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
$has_other_domains = is_countable($other_domains) ? count($other_domains) - 1 : false;
|
||||
}
|
||||
|
||||
$custom_fields = array(
|
||||
'set_domain_as_primary' => array(
|
||||
$custom_fields = [
|
||||
'set_domain_as_primary' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Set another domain as primary', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'domain',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'domain',
|
||||
'data-search-field' => 'domain',
|
||||
'data-max-items' => 1,
|
||||
'data-exclude' => json_encode(array($domain->get_id())),
|
||||
'data-exclude' => json_encode([$domain->get_id()]),
|
||||
'data-include' => json_encode($domain->get_blog_id()),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-if' => $is_primary_domain && $has_other_domains ? 'true' : 'false',
|
||||
),
|
||||
),
|
||||
'confirm' => array(
|
||||
],
|
||||
],
|
||||
'confirm' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Confirm Deletion', 'wp-ultimo'),
|
||||
'desc' => __('This action can not be undone.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'confirmed',
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Delete', 'wp-ultimo'),
|
||||
'placeholder' => __('Delete', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => '!confirmed',
|
||||
),
|
||||
),
|
||||
'id' => array(
|
||||
],
|
||||
],
|
||||
'id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => $domain->get_id(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return array_merge($custom_fields, $fields);
|
||||
}
|
||||
@ -169,7 +169,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @param object $domain The domain object.
|
||||
* @return void
|
||||
*/
|
||||
public function domain_after_delete_actions($domain) {
|
||||
public function domain_after_delete_actions($domain): void {
|
||||
|
||||
$new_primary_domain_name = wu_request('set_domain_as_primary');
|
||||
|
||||
@ -188,180 +188,180 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
$this->add_fields_widget(
|
||||
'domain-url',
|
||||
array(
|
||||
[
|
||||
'title' => __('Domain URL', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'after' => array($this, 'render_dns_widget'),
|
||||
'fields' => array(
|
||||
'domain' => array(
|
||||
'after' => [$this, 'render_dns_widget'],
|
||||
'fields' => [
|
||||
'domain' => [
|
||||
'type' => 'text-display',
|
||||
'title' => __('Domain', 'wp-ultimo'),
|
||||
'tooltip' => __('Editing an existing domain is not possible. If you want to make changes to this domain, first delete it, and then re-add the right domain.', 'wp-ultimo'),
|
||||
'display_value' => '<span class="wu-text-sm wu-uppercase wu-font-mono">' . $this->get_object()->get_domain() . '</span> <a target="_blank" class="wu-no-underline" href="' . esc_url($this->get_object()->get_url()) . '"><span class="dashicons-wu-link1 "></span></a>',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_tabs_widget(
|
||||
'options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Domain Options', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'sections' => array(
|
||||
'general' => array(
|
||||
'sections' => [
|
||||
'general' => [
|
||||
'title' => __('General', 'wp-ultimo'),
|
||||
'desc' => __('General options for the domain.', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-globe',
|
||||
'state' => array(
|
||||
'state' => [
|
||||
'primary_domain' => $this->get_object()->is_primary_domain(),
|
||||
),
|
||||
'fields' => array(
|
||||
'primary_domain' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'primary_domain' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Is Primary Domain?', 'wp-ultimo'),
|
||||
'desc' => __('Set as the primary domain.', 'wp-ultimo'),
|
||||
'tooltip' => __('Setting this as the primary domain will remove any other domain mapping marked as the primary domain for this site.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_primary_domain(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'primary_domain',
|
||||
),
|
||||
),
|
||||
'primary_note' => array(
|
||||
],
|
||||
],
|
||||
'primary_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('By making this the primary domain, we will convert the previous primary domain for this site, if one exists, into an alias domain.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-if' => "require('primary_domain', true)",
|
||||
),
|
||||
),
|
||||
'secure' => array(
|
||||
],
|
||||
],
|
||||
'secure' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Is Secure?', 'wp-ultimo'),
|
||||
'desc' => __('Force the load using HTTPS.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_secure(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'sites',
|
||||
array(
|
||||
[
|
||||
'title' => __('Linked Site', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Memberships_Site_List_Table(),
|
||||
'query_filter' => array($this, 'sites_query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'sites_query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box('wp-ultimo-domain-log', __('Domain Test Log', 'wp-ultimo'), array($this, 'render_log_widget'), get_current_screen()->id, 'normal', null);
|
||||
add_meta_box('wp-ultimo-domain-log', __('Domain Test Log', 'wp-ultimo'), [$this, 'render_log_widget'], get_current_screen()->id, 'normal', null);
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'events',
|
||||
array(
|
||||
[
|
||||
'title' => __('Events', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Inside_Events_List_Table(),
|
||||
'query_filter' => array($this, 'query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'save',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'stage' => $this->get_object()->get_stage(),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
'stage' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'stage' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Stage', 'wp-ultimo'),
|
||||
'placeholder' => __('Select Stage', 'wp-ultimo'),
|
||||
'desc' => __('The stage in the checking lifecycle of this domain.', 'wp-ultimo'),
|
||||
'options' => Domain_Stage::to_array(),
|
||||
'value' => $this->get_object()->get_stage(),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'@change' => 'window.wu_basic.stage = $event.target.value',
|
||||
'v-model' => 'stage',
|
||||
),
|
||||
),
|
||||
'blog_id' => array(
|
||||
],
|
||||
],
|
||||
'blog_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Site', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Site...', 'wp-ultimo'),
|
||||
'desc' => __('The target site of this domain.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_blog_id(),
|
||||
'tooltip' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'site',
|
||||
'data-value-field' => 'blog_id',
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
'data-max-items' => 1,
|
||||
'data-selected' => $this->get_object()->get_site() ? json_encode($this->get_object()->get_site()->to_search_results()) : '',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$check_for_active_string = sprintf('%s.includes(stage)', json_encode(\WP_Ultimo\Models\Domain::INACTIVE_STAGES));
|
||||
|
||||
$this->add_fields_widget(
|
||||
'basic',
|
||||
array(
|
||||
[
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'basic',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'stage' => $this->get_object()->get_stage(),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
'active' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'active' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to manually enable or disable this domain.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_active(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
'v-bind:disabled' => $check_for_active_string,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-bind:class' => "$check_for_active_string ? 'wu-cursor-not-allowed wu-opacity-75' : ''",
|
||||
),
|
||||
],
|
||||
|
||||
),
|
||||
'note' => array(
|
||||
],
|
||||
'note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('This domain has a domain stage that forces it to be inactive. Change the status to Ready or Ready (without SSL) to be able to control the active status directly.', 'wp-ultimo'),
|
||||
'classes' => 'wu-p-2 wu-bg-red-100 wu-text-red-600 wu-rounded wu-w-full',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => $check_for_active_string,
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -371,13 +371,13 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_dns_widget() {
|
||||
public function render_dns_widget(): void {
|
||||
|
||||
wu_get_template(
|
||||
'domain/dns-table',
|
||||
array(
|
||||
[
|
||||
'domain' => $this->get_object(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -387,14 +387,14 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_log_widget() {
|
||||
public function render_log_widget(): void {
|
||||
|
||||
wu_get_template(
|
||||
'domain/log',
|
||||
array(
|
||||
[
|
||||
'domain' => $this->get_object(),
|
||||
'log_path' => \WP_Ultimo\Logger::get_logs_folder(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -439,7 +439,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Domain', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Domain', 'wp-ultimo'),
|
||||
'updated_message' => __('Domain updated with success!', 'wp-ultimo'),
|
||||
@ -449,7 +449,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Domain', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -462,10 +462,10 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'domain',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -527,7 +527,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
if ( ! wu_request('primary_domain')) {
|
||||
$_POST['primary_domain'] = false;
|
||||
@ -541,7 +541,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
$_POST['secure'] = false;
|
||||
}
|
||||
|
||||
wu_enqueue_async_action('wu_async_process_domain_stage', array('domain_id' => $this->get_object()->get_id()), 'domain');
|
||||
wu_enqueue_async_action('wu_async_process_domain_stage', ['domain_id' => $this->get_object()->get_id()], 'domain');
|
||||
|
||||
parent::handle_save();
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_domains',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms that we use for payments.
|
||||
@ -63,17 +63,17 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new Domain
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_domain',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_domain_modal'),
|
||||
'handler' => array($this, 'handle_add_new_domain_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_domain_modal'],
|
||||
'handler' => [$this, 'handle_add_new_domain_modal'],
|
||||
'capability' => 'wu_edit_domains',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -83,127 +83,127 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_domain_modal() {
|
||||
public function render_add_new_domain_modal(): void {
|
||||
|
||||
$addon_url = wu_network_admin_url(
|
||||
'wp-ultimo-addons',
|
||||
array(
|
||||
[
|
||||
's' => 'Domain Seller',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
// translators: %s is the URL to the add-on.
|
||||
$note_desc = sprintf(__('To activate this feature you need to install the <a href="%s" target="_blank" class="wu-no-underline">WP Multisite WaaS: Domain Seller</a> add-on.', 'wp-ultimo'), $addon_url);
|
||||
|
||||
$fields = array(
|
||||
'type' => array(
|
||||
$fields = [
|
||||
'type' => [
|
||||
'type' => 'tab-select',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'add' => __('Add Existing Domain', 'wp-ultimo'),
|
||||
'register' => __('Register New', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
),
|
||||
'domain' => array(
|
||||
],
|
||||
],
|
||||
'domain' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Domain', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. mydomain.com', 'wp-ultimo'),
|
||||
'desc' => __('Be sure the domain has the right DNS setup in place before adding it.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'add')",
|
||||
),
|
||||
),
|
||||
'blog_id' => array(
|
||||
],
|
||||
],
|
||||
'blog_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Apply to Site', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Sites...', 'wp-ultimo'),
|
||||
'desc' => __('The target site of the domain being added.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'site',
|
||||
'data-value-field' => 'blog_id',
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'add')",
|
||||
),
|
||||
),
|
||||
'stage' => array(
|
||||
],
|
||||
],
|
||||
'stage' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Stage', 'wp-ultimo'),
|
||||
'placeholder' => __('Select Stage', 'wp-ultimo'),
|
||||
'desc' => __('The stage in the domain check lifecycle. Leave "Checking DNS" to have the domain go through WP Multisite WaaS\'s automated tests.', 'wp-ultimo'),
|
||||
'options' => Domain_Stage::to_array(),
|
||||
'value' => Domain_Stage::CHECKING_DNS,
|
||||
),
|
||||
'primary_domain' => array(
|
||||
],
|
||||
'primary_domain' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Primary Domain', 'wp-ultimo'),
|
||||
'desc' => __('Check to set this domain as the primary', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'primary_domain',
|
||||
),
|
||||
),
|
||||
'primary_note' => array(
|
||||
],
|
||||
],
|
||||
'primary_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('By making this the primary domain, we will convert the previous primary domain for this site, if one exists, into an alias domain.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('primary_domain', true)",
|
||||
),
|
||||
),
|
||||
'submit_button_new' => array(
|
||||
],
|
||||
],
|
||||
'submit_button_new' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Add Existing Domain', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'add')",
|
||||
),
|
||||
),
|
||||
'addon_note' => array(
|
||||
],
|
||||
],
|
||||
'addon_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => $note_desc,
|
||||
'classes' => 'wu-p-2 wu-bg-blue-100 wu-text-gray-600 wu-rounded wu-w-full',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'register')",
|
||||
),
|
||||
),
|
||||
'submit_button_register' => array(
|
||||
],
|
||||
],
|
||||
'submit_button_register' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Register and Add Domain (soon)', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "require('type', 'register')",
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'disabled' => 'disabled',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_domain',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_new_domain',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'type' => 'add',
|
||||
'primary_domain' => false,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -215,7 +215,7 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_domain_modal() {
|
||||
public function handle_add_new_domain_modal(): void {
|
||||
|
||||
/**
|
||||
* Fires before handle the add new domain modal request.
|
||||
@ -229,12 +229,12 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
* Tries to create the domain
|
||||
*/
|
||||
$domain = wu_create_domain(
|
||||
array(
|
||||
[
|
||||
'domain' => wu_request('domain'),
|
||||
'stage' => wu_request('stage'),
|
||||
'blog_id' => (int) wu_request('blog_id'),
|
||||
'primary_domain' => (bool) wu_request('primary_domain'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (is_wp_error($domain)) {
|
||||
@ -243,31 +243,31 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
if (wu_request('primary_domain')) {
|
||||
$old_primary_domains = wu_get_domains(
|
||||
array(
|
||||
[
|
||||
'primary_domain' => true,
|
||||
'blog_id' => wu_request('blog_id'),
|
||||
'id__not_in' => array($domain->get_id()),
|
||||
'id__not_in' => [$domain->get_id()],
|
||||
'fields' => 'ids',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
* Trigger async action to update the old primary domains.
|
||||
*/
|
||||
do_action('wu_async_remove_old_primary_domains', array($old_primary_domains));
|
||||
do_action('wu_async_remove_old_primary_domains', [$old_primary_domains]);
|
||||
}
|
||||
|
||||
wu_enqueue_async_action('wu_async_process_domain_stage', array('domain_id' => $domain->get_id()), 'domain');
|
||||
wu_enqueue_async_action('wu_async_process_domain_stage', ['domain_id' => $domain->get_id()], 'domain');
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-domain',
|
||||
array(
|
||||
[
|
||||
'id' => $domain->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -280,10 +280,10 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Domains removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Domains', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,14 +327,14 @@ class Domain_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Domain'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_domain'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
/**
|
||||
* Setups the object
|
||||
@ -106,11 +106,11 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function hooks() {
|
||||
public function hooks(): void {
|
||||
|
||||
parent::hooks();
|
||||
|
||||
add_filter('removable_query_args', array($this, 'removable_query_args'));
|
||||
add_filter('removable_query_args', [$this, 'removable_query_args']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,17 +143,17 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
// translators: %s is the date, using the site format options
|
||||
$message = sprintf(__('This item is locked from editions.<br />This is probably due to a background action being performed (like a transfer between different accounts, for example). You can manually unlock it, but be careful. The lock should be released automatically in %s seconds.', 'wp-ultimo'), wu_get_next_queue_run() + 10);
|
||||
|
||||
$actions = array(
|
||||
'preview' => array(
|
||||
$actions = [
|
||||
'preview' => [
|
||||
'title' => __('Unlock', 'wp-ultimo'),
|
||||
'url' => add_query_arg(
|
||||
array(
|
||||
[
|
||||
'remove-lock' => 1,
|
||||
'unlock_wpultimo_nonce' => wp_create_nonce(sprintf('unlocking_%s', $this->object_id)),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
WP_Ultimo()->notices->add($message, 'warning', 'network-admin', false, $actions);
|
||||
}
|
||||
@ -165,7 +165,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function remove_lock() {
|
||||
public function remove_lock(): void {
|
||||
|
||||
$unlock_tag = "unlocking_{$this->object_id}";
|
||||
|
||||
@ -186,10 +186,10 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
wp_redirect(
|
||||
remove_query_arg(
|
||||
array(
|
||||
[
|
||||
'remove-lock',
|
||||
'unlock_wpultimo_nonce',
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
@ -203,7 +203,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
final public function process_save() {
|
||||
final public function process_save(): void {
|
||||
|
||||
$saving_tag = "saving_{$this->object_id}";
|
||||
|
||||
@ -234,7 +234,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
final public function process_delete() {
|
||||
final public function process_delete(): void {
|
||||
|
||||
$deleting_tag = "deleting_{$this->object_id}";
|
||||
|
||||
@ -263,7 +263,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
$default_labels = array(
|
||||
$default_labels = [
|
||||
'edit_label' => __('Edit Object', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add New Object', 'wp-ultimo'),
|
||||
'updated_message' => __('Object updated with success!', 'wp-ultimo'),
|
||||
@ -273,7 +273,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return apply_filters('wu_edit_admin_page_labels', $default_labels);
|
||||
}
|
||||
@ -284,7 +284,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
@ -315,20 +315,20 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
$this->add_info_widget(
|
||||
'info',
|
||||
array(
|
||||
[
|
||||
'title' => __('Timestamps', 'wp-ultimo'),
|
||||
'position' => 'side-bottom',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ($this->edit) {
|
||||
$this->add_delete_widget('delete', array());
|
||||
$this->add_delete_widget('delete', []);
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array containing the attributes to be passed to the widget.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_info_widget($id, $atts = array()) {
|
||||
protected function add_info_widget($id, $atts = []) {
|
||||
|
||||
$created_key = 'date_created';
|
||||
|
||||
@ -349,38 +349,38 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
$created_key = 'date_registered';
|
||||
}
|
||||
|
||||
$created_value = call_user_func(array($this->get_object(), "get_$created_key"));
|
||||
$created_value = call_user_func([$this->get_object(), "get_$created_key"]);
|
||||
|
||||
$atts['fields'][ $created_key ] = array(
|
||||
$atts['fields'][ $created_key ] = [
|
||||
'title' => __('Created at', 'wp-ultimo'),
|
||||
'type' => 'text-display',
|
||||
'date' => true,
|
||||
'display_value' => $this->edit ? $created_value : false,
|
||||
'value' => $created_value,
|
||||
'placeholder' => '2020-04-04 12:00:00',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'Y-m-d H:i:S',
|
||||
'data-allow-time' => 'true',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$show_modified = wu_get_isset($atts, 'modified', true);
|
||||
|
||||
if ($this->edit && $show_modified === true) {
|
||||
$atts['fields']['date_modified'] = array(
|
||||
$atts['fields']['date_modified'] = [
|
||||
'title' => __('Last Modified at', 'wp-ultimo'),
|
||||
'type' => 'text-display',
|
||||
'date' => true,
|
||||
'display_value' => $this->edit ? $this->get_object()->get_date_modified() : __('No date', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_date_modified(),
|
||||
'placeholder' => '2020-04-04 12:00:00',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'Y-m-d H:i:S',
|
||||
'data-allow-time' => 'true',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$this->add_fields_widget($id, $atts);
|
||||
@ -395,11 +395,11 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array containing the attributes to be passed to the widget.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_list_table_widget($id, $atts = array()) {
|
||||
protected function add_list_table_widget($id, $atts = []) {
|
||||
|
||||
$atts = wp_parse_args(
|
||||
$atts,
|
||||
array(
|
||||
[
|
||||
'widget_id' => $id,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
@ -412,7 +412,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
'edit' => true,
|
||||
'table' => false,
|
||||
'query_filter' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$atts['table']->set_context('widget');
|
||||
@ -460,22 +460,22 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array of attributes to pass to the form.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_fields_widget($id, $atts = array()) {
|
||||
protected function add_fields_widget($id, $atts = []) {
|
||||
|
||||
$atts = wp_parse_args(
|
||||
$atts,
|
||||
array(
|
||||
[
|
||||
'widget_id' => $id,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'title' => __('Fields', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'screen' => get_current_screen(),
|
||||
'fields' => array(),
|
||||
'html_attr' => array(),
|
||||
'fields' => [],
|
||||
'html_attr' => [],
|
||||
'classes' => '',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box(
|
||||
@ -484,13 +484,13 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
function () use ($atts) {
|
||||
|
||||
if (wu_get_isset($atts['html_attr'], 'data-wu-app')) {
|
||||
$atts['fields']['loading'] = array(
|
||||
$atts['fields']['loading'] = [
|
||||
'type' => 'note',
|
||||
'desc' => sprintf('<div class="wu-block wu-text-center wu-blinking-animation wu-text-gray-600 wu-my-1 wu-text-2xs wu-uppercase wu-font-semibold">%s</div>', __('Loading...', 'wp-ultimo')),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-if' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,14 +501,14 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
$atts['widget_id'],
|
||||
$atts['fields'],
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-widget-list wu-striped wu-m-0 wu--mt-2 wu--mb-3 wu--mx-3 ' . $atts['classes'],
|
||||
'field_wrapper_classes' => $atts['field_wrapper_classes'],
|
||||
'html_attr' => $atts['html_attr'],
|
||||
'before' => $atts['before'],
|
||||
'after' => $atts['after'],
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -529,30 +529,30 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array of attributes to pass to the form.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_tabs_widget($id, $atts = array()) {
|
||||
protected function add_tabs_widget($id, $atts = []) {
|
||||
|
||||
$atts = wp_parse_args(
|
||||
$atts,
|
||||
array(
|
||||
[
|
||||
'widget_id' => $id,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'title' => __('Tabs', 'wp-ultimo'),
|
||||
'position' => 'advanced',
|
||||
'screen' => get_current_screen(),
|
||||
'sections' => array(),
|
||||
'html_attr' => array(),
|
||||
)
|
||||
'sections' => [],
|
||||
'html_attr' => [],
|
||||
]
|
||||
);
|
||||
|
||||
$current_section = wu_request($id, current(array_keys($atts['sections'])));
|
||||
|
||||
$atts['html_attr']['data-wu-app'] = $id;
|
||||
|
||||
$atts['html_attr']['data-state'] = array(
|
||||
$atts['html_attr']['data-state'] = [
|
||||
'section' => $current_section,
|
||||
'display_all' => false,
|
||||
);
|
||||
];
|
||||
|
||||
add_meta_box(
|
||||
"wp-ultimo-{$id}-widget",
|
||||
@ -562,16 +562,16 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
foreach ($atts['sections'] as $section_id => &$section) {
|
||||
$section = wp_parse_args(
|
||||
$section,
|
||||
array(
|
||||
[
|
||||
'form' => '',
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'v-show' => '1',
|
||||
'fields' => array(),
|
||||
'html_attr' => array(),
|
||||
'state' => array(),
|
||||
'fields' => [],
|
||||
'html_attr' => [],
|
||||
'state' => [],
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
@ -579,25 +579,25 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
$atts['html_attr']['data-state'] = array_merge($atts['html_attr']['data-state'], $section['state']);
|
||||
|
||||
$section['html_attr'] = array(
|
||||
$section['html_attr'] = [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => "(section == '{$section_id}' || display_all) && " . $section['v-show'],
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Adds a header field
|
||||
*/
|
||||
$section['fields'] = array_merge(
|
||||
array(
|
||||
$section_id => array(
|
||||
[
|
||||
$section_id => [
|
||||
'title' => $section['title'],
|
||||
'desc' => $section['desc'],
|
||||
'type' => 'header',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'display_all',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
$section['fields']
|
||||
);
|
||||
|
||||
@ -609,25 +609,25 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
$section['form'] = new \WP_Ultimo\UI\Form(
|
||||
$section_id,
|
||||
$section['fields'],
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-widget-list wu-striped wu-m-0 wu-border-solid wu-border-gray-300 wu-border-0 wu-border-b',
|
||||
'field_wrapper_classes' => $section['field_wrapper_classes'],
|
||||
'html_attr' => $section['html_attr'],
|
||||
'before' => $section['before'],
|
||||
'after' => $section['after'],
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
wu_get_template(
|
||||
'base/edit/widget-tabs',
|
||||
array(
|
||||
[
|
||||
'sections' => $atts['sections'],
|
||||
'html_attr' => $atts['html_attr'],
|
||||
'before' => $atts['before'],
|
||||
'after' => $atts['after'],
|
||||
)
|
||||
]
|
||||
);
|
||||
},
|
||||
$atts['screen']->id,
|
||||
@ -645,11 +645,11 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Widget parameters.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_widget($id, $atts = array()) {
|
||||
protected function add_widget($id, $atts = []) {
|
||||
|
||||
$atts = wp_parse_args(
|
||||
$atts,
|
||||
array(
|
||||
[
|
||||
'widget_id' => $id,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
@ -657,7 +657,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
'screen' => get_current_screen(),
|
||||
'position' => 'side',
|
||||
'display' => '__return_empty_string',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box("wp-ultimo-{$id}-widget", $atts['title'], $atts['display'], $atts['screen']->id, $atts['position'], 'default');
|
||||
@ -672,7 +672,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array containing the attributes to be passed to the widget.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_save_widget($id, $atts = array()) {
|
||||
protected function add_save_widget($id, $atts = []) {
|
||||
|
||||
$labels = $this->get_labels();
|
||||
|
||||
@ -681,15 +681,15 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
/**
|
||||
* Adds Submit Button
|
||||
*/
|
||||
$atts['fields']['submit_save'] = array(
|
||||
$atts['fields']['submit_save'] = [
|
||||
'type' => 'submit',
|
||||
'title' => $labels['save_button_label'],
|
||||
'placeholder' => $labels['save_button_label'],
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'html_attr' => array(),
|
||||
'wrapper_html_attr' => array(),
|
||||
);
|
||||
'html_attr' => [],
|
||||
'wrapper_html_attr' => [],
|
||||
];
|
||||
|
||||
if (isset($atts['html_attr']['data-wu-app'])) {
|
||||
$atts['fields']['submit_save']['wrapper_html_attr']['v-cloak'] = 1;
|
||||
@ -713,28 +713,28 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array containing the attributes to be passed to the widget.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_delete_widget($id, $atts = array()) {
|
||||
protected function add_delete_widget($id, $atts = []) {
|
||||
|
||||
$labels = $this->get_labels();
|
||||
|
||||
$atts_default = array(
|
||||
$atts_default = [
|
||||
'title' => __('Delete', 'wp-ultimo'),
|
||||
'position' => 'side-bottom',
|
||||
);
|
||||
];
|
||||
$atts = array_merge($atts_default, $atts);
|
||||
|
||||
/**
|
||||
* Adds Note
|
||||
*/
|
||||
$atts['fields']['note'] = array(
|
||||
$atts['fields']['note'] = [
|
||||
'type' => 'note',
|
||||
'desc' => $labels['delete_description'],
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Adds Submit Button
|
||||
*/
|
||||
$default_delete_field_settings = array(
|
||||
$default_delete_field_settings = [
|
||||
'type' => 'link',
|
||||
'title' => '',
|
||||
'display_value' => $labels['delete_button_label'] ?? '',
|
||||
@ -742,19 +742,19 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
'value' => 'delete',
|
||||
'classes' => 'button wubox wu-w-full wu-text-center',
|
||||
'wrapper_classes' => 'wu-bg-gray-100',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'title' => $labels['delete_button_label'],
|
||||
'href' => wu_get_form_url(
|
||||
'delete_modal',
|
||||
array(
|
||||
[
|
||||
'id' => $this->get_object()->get_id(),
|
||||
'model' => $this->get_object()->model,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$custom_delete_field_settings = wu_get_isset($atts['fields'], 'delete', array());
|
||||
$custom_delete_field_settings = wu_get_isset($atts['fields'], 'delete', []);
|
||||
|
||||
$atts['fields']['delete'] = array_merge($default_delete_field_settings, $custom_delete_field_settings);
|
||||
|
||||
@ -767,18 +767,18 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/edit',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'labels' => $this->get_labels(),
|
||||
'object' => $this->get_object(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -846,9 +846,9 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$array_params = array(
|
||||
$array_params = [
|
||||
'updated' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->edit === false) {
|
||||
$array_params['id'] = $object->get_id();
|
||||
@ -870,7 +870,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_delete() {
|
||||
public function handle_delete(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
|
@ -78,9 +78,9 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_emails',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Initializes the class
|
||||
@ -88,14 +88,14 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
/**
|
||||
* Runs the parent init functions
|
||||
*/
|
||||
parent::init();
|
||||
|
||||
add_action('wu_page_edit_redirect_handlers', array($this, 'handle_page_redirect'), 10);
|
||||
add_action('wu_page_edit_redirect_handlers', [$this, 'handle_page_redirect'], 10);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,11 +104,11 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_enqueue_script('wu-email-edit-page', wu_get_asset('email-edit-page.js', 'js'), array('jquery', 'clipboard'));
|
||||
wp_enqueue_script('wu-email-edit-page', wu_get_asset('email-edit-page.js', 'js'), ['jquery', 'clipboard']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +117,7 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
@ -138,224 +138,224 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'email_edit_save',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'slug' => $this->edit ? $object->get_slug() : '',
|
||||
'target' => $this->edit ? $object->get_target() : 'admin',
|
||||
'schedule' => $this->edit ? $object->has_schedule() : false,
|
||||
'schedule_type' => $this->edit ? $object->get_schedule_type() : 'days',
|
||||
'days' => $this->edit ? $object->get_send_days() : 1,
|
||||
'hours' => $this->edit ? $object->get_send_hours() : '12:00',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
'slug' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'slug' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Slug', 'wp-ultimo'),
|
||||
'desc' => __('An unique identifier for this system email.', 'wp-ultimo'),
|
||||
'value' => $this->edit ? $object->get_slug() : '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'required' => 'required',
|
||||
'v-on:input' => 'slug = $event.target.value.toLowerCase().replace(/[^a-z0-9-_]+/g, "")',
|
||||
'v-bind:value' => 'slug',
|
||||
),
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
],
|
||||
'event' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Event', 'wp-ultimo'),
|
||||
'desc' => __('The event that will trigger the sending of this email.', 'wp-ultimo'),
|
||||
'placeholder' => __('Event', 'wp-ultimo'),
|
||||
'options' => 'wu_get_event_types_as_options',
|
||||
'value' => $this->edit ? $object->get_event() : 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'name' => '',
|
||||
),
|
||||
),
|
||||
'target' => array(
|
||||
],
|
||||
],
|
||||
'target' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Target', 'wp-ultimo'),
|
||||
'desc' => __('To whom this email should be sent.', 'wp-ultimo'),
|
||||
'placeholder' => __('Network Administrators', 'wp-ultimo'),
|
||||
'value' => $this->edit ? $object->get_target() : 'admin',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'admin' => __('Network Administrators', 'wp-ultimo'),
|
||||
'customer' => __('Customer', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'target',
|
||||
),
|
||||
),
|
||||
'send_copy_to_admin' => array(
|
||||
],
|
||||
],
|
||||
'send_copy_to_admin' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Send Copy to Admins?', 'wp-ultimo'),
|
||||
'desc' => __('Checking this options will add the network admins as bcc every time this email is sent to a customer.', 'wp-ultimo'),
|
||||
'value' => $this->edit ? $object->get_send_copy_to_admin() : false,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'target == "customer"',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
'schedule' => array(
|
||||
],
|
||||
],
|
||||
'schedule' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Schedule?', 'wp-ultimo'),
|
||||
'desc' => __('You can define when the email is sent after the event triggers.', 'wp-ultimo'),
|
||||
'value' => $this->edit ? $this->get_object()->has_schedule() : 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'schedule',
|
||||
),
|
||||
),
|
||||
'send_date' => array(
|
||||
],
|
||||
],
|
||||
'send_date' => [
|
||||
'type' => 'group',
|
||||
'title' => __('Scheduling Options', 'wp-ultimo'),
|
||||
'tooltip' => __('When this email will be sent after the event?', 'wp-ultimo'),
|
||||
'desc' => $desc,
|
||||
'desc_id' => 'send_date_desc',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'schedule',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'fields' => array(
|
||||
'schedule_type' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'schedule_type' => [
|
||||
'type' => 'select',
|
||||
'default' => 'days',
|
||||
'wrapper_classes' => 'wu-w-2/3',
|
||||
'value' => $this->edit ? $object->get_schedule_type() : 'days',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'hours' => __('Delay for hours', 'wp-ultimo'),
|
||||
'days' => __('Delay for days', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'schedule_type',
|
||||
),
|
||||
),
|
||||
'send_days' => array(
|
||||
],
|
||||
],
|
||||
'send_days' => [
|
||||
'type' => 'number',
|
||||
'value' => $this->edit && $object->get_send_days() ? $object->get_send_days() : 1,
|
||||
'placeholder' => 1,
|
||||
'min' => 0,
|
||||
'wrapper_classes' => 'wu-ml-2 wu-w-1/3',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "schedule_type == 'days'",
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'days',
|
||||
),
|
||||
),
|
||||
'send_hours' => array(
|
||||
],
|
||||
],
|
||||
'send_hours' => [
|
||||
'type' => 'text',
|
||||
'date' => true,
|
||||
'placeholder' => $this->edit ? $object->get_send_hours() : '12:00',
|
||||
'value' => $this->edit ? $object->get_send_hours() : '',
|
||||
'wrapper_classes' => 'wu-ml-2 wu-w-1/3',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-no-calendar' => 'true',
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'H:i',
|
||||
'data-allow-time' => 'true',
|
||||
'v-model' => 'hours',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "schedule_type == 'hours'",
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box('wp-ultimo-placeholders', __('Placeholders', 'wp-ultimo'), array($this, 'output_default_widget_placeholders'), get_current_screen()->id, 'normal', null, array());
|
||||
add_meta_box('wp-ultimo-placeholders', __('Placeholders', 'wp-ultimo'), [$this, 'output_default_widget_placeholders'], get_current_screen()->id, 'normal', null, []);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'active',
|
||||
array(
|
||||
[
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'active' => array(
|
||||
'fields' => [
|
||||
'active' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to manually enable or disable this email.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_active(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_tabs_widget(
|
||||
'email_edit_options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Advanced Options', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'sections' => array(
|
||||
'general' => array(
|
||||
'sections' => [
|
||||
'general' => [
|
||||
'title' => __('General', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-lock',
|
||||
'desc' => __('Rules and limitations to the applicability of this discount code.', 'wp-ultimo'),
|
||||
'state' => array(
|
||||
'state' => [
|
||||
'sender' => $this->edit ? $object->get_custom_sender() : 0,
|
||||
),
|
||||
'fields' => array(
|
||||
'style' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'style' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Email Style', 'wp-ultimo'),
|
||||
'desc' => __('Choose if email body will be sent using the HTML template or in plain text.', 'wp-ultimo'),
|
||||
'placeholder' => __('Style', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'default' => __('Use Default', 'wp-ultimo'),
|
||||
'html' => __('HTML Emails', 'wp-ultimo'),
|
||||
'plain' => __('Plain Emails', 'wp-ultimo'),
|
||||
),
|
||||
],
|
||||
'value' => $this->edit ? $object->get_style() : 'html',
|
||||
),
|
||||
),
|
||||
),
|
||||
'sender' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'sender' => [
|
||||
'title' => __('Custom Sender', 'wp-ultimo'),
|
||||
'icon' => 'dashicons-wu-mail',
|
||||
'desc' => __('You can define an email and a name that will only be used when this email is sent.', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'custom_sender' => array(
|
||||
'fields' => [
|
||||
'custom_sender' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Use a custom sender?', 'wp-ultimo'),
|
||||
'desc' => __('You can define an email and a name that will only be used when this email is sent.', 'wp-ultimo'),
|
||||
'value' => $this->edit ? $object->get_custom_sender() : 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'sender',
|
||||
),
|
||||
),
|
||||
'custom_sender_name' => array(
|
||||
],
|
||||
],
|
||||
'custom_sender_name' => [
|
||||
'type' => 'text',
|
||||
'title' => __('From "Name"', 'wp-ultimo'),
|
||||
'desc' => __('Override the global from name for this particular email.', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-full',
|
||||
'value' => $this->edit ? $object->get_custom_sender_name() : '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'sender',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
'custom_sender_email' => array(
|
||||
],
|
||||
],
|
||||
'custom_sender_email' => [
|
||||
'type' => 'email',
|
||||
'title' => __('From "Email"', 'wp-ultimo'),
|
||||
'desc' => __('Override the global from email for this particular email.', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-full',
|
||||
'value' => $this->edit ? $object->get_custom_sender_email() : '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'sender',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -368,14 +368,14 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @param array $data Arguments passed by add_meta_box.
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_placeholders($unused, $data) {
|
||||
public function output_default_widget_placeholders($unused, $data): void {
|
||||
|
||||
wu_get_template(
|
||||
'email/widget-placeholders',
|
||||
array(
|
||||
[
|
||||
'title' => __('Event Payload', 'wp-ultimo'),
|
||||
'loading_text' => __('Loading Payload', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -409,27 +409,27 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $this->get_object()->get_id(),
|
||||
'model' => 'email',
|
||||
'page' => 'edit',
|
||||
);
|
||||
];
|
||||
|
||||
$send_test_link = wu_get_form_url('send_new_test', $url_atts);
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-emails'),
|
||||
'label' => __('Go Back', 'wp-ultimo'),
|
||||
'icon' => 'wu-reply',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => $send_test_link,
|
||||
'label' => __('Send Test Email', 'wp-ultimo'),
|
||||
'icon' => 'wu-mail',
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -440,7 +440,7 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Email', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Email', 'wp-ultimo'),
|
||||
'updated_message' => __('Email updated with success!', 'wp-ultimo'),
|
||||
@ -450,7 +450,7 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Email', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -463,10 +463,10 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'system_email',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -477,7 +477,7 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
$_POST['schedule'] = wu_request('schedule');
|
||||
|
||||
@ -491,10 +491,10 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
/**
|
||||
* Handles the redirect notice from sent new test modal.
|
||||
*
|
||||
* @param WP_Ultimo\Admin_Pages\Base_Admin_Page $page The page object.
|
||||
* @param Base_Admin_Page $page The page object.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_page_redirect($page) {
|
||||
public function handle_page_redirect($page): void {
|
||||
|
||||
if ($page->get_id() === 'wp-ultimo-edit-email') {
|
||||
if (wu_request('test_notice')) {
|
||||
@ -567,10 +567,10 @@ class Email_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function events_query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'email',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_emails',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Initializes the class
|
||||
@ -76,14 +76,14 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
/**
|
||||
* Runs the parent init functions
|
||||
*/
|
||||
parent::init();
|
||||
|
||||
add_action('wu_page_list_redirect_handlers', array($this, 'handle_page_redirect'), 10);
|
||||
add_action('wu_page_list_redirect_handlers', [$this, 'handle_page_redirect'], 10);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,17 +133,17 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Send a email test
|
||||
*/
|
||||
wu_register_form(
|
||||
'send_new_test',
|
||||
array(
|
||||
'render' => array($this, 'render_send_new_test_modal'),
|
||||
'handler' => array($this, 'handle_send_new_test_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_send_new_test_modal'],
|
||||
'handler' => [$this, 'handle_send_new_test_modal'],
|
||||
'capability' => 'wu_add_broadcast',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -151,11 +151,11 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
wu_register_form(
|
||||
'reset_import',
|
||||
array(
|
||||
'render' => array($this, 'render_reset_import_modal'),
|
||||
'handler' => array($this, 'handle_reset_import_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_reset_import_modal'],
|
||||
'handler' => [$this, 'handle_reset_import_modal'],
|
||||
'capability' => 'wu_add_broadcasts',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -163,11 +163,11 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
wu_register_form(
|
||||
'reset_confirmation',
|
||||
array(
|
||||
'render' => array($this, 'render_reset_confirmation_modal'),
|
||||
'handler' => array($this, 'handle_reset_confirmation_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_reset_confirmation_modal'],
|
||||
'handler' => [$this, 'handle_reset_confirmation_modal'],
|
||||
'capability' => 'wu_add_broadcasts',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,47 +177,47 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_send_new_test_modal() {
|
||||
public function render_send_new_test_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'send_to' => array(
|
||||
$fields = [
|
||||
'send_to' => [
|
||||
'type' => 'email',
|
||||
'title' => __('Send To', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. network@email.com', 'wp-ultimo'),
|
||||
'desc' => __('The test email will be sent to the above email address.', 'wp-ultimo'),
|
||||
'value' => get_network_option(null, 'admin_email'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'required' => 'required',
|
||||
),
|
||||
),
|
||||
'email_id' => array(
|
||||
],
|
||||
],
|
||||
'email_id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => wu_request('id'),
|
||||
),
|
||||
'page' => array(
|
||||
],
|
||||
'page' => [
|
||||
'type' => 'hidden',
|
||||
'value' => wu_request('page'),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Send Test Email', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end wu-text-right',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'send_new_test',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'send_new_test',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -227,7 +227,7 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* Handles the modal to send tests with system emails.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
public function handle_send_new_test_modal() {
|
||||
|
||||
@ -238,20 +238,20 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
if ( ! $email_id || ! $send_to) {
|
||||
$error = new \WP_Error('error', __('Something wrong happened.', 'wp-ultimo'));
|
||||
|
||||
return wp_send_json_error($error);
|
||||
wp_send_json_error($error);
|
||||
}
|
||||
|
||||
$from = array(
|
||||
$from = [
|
||||
'name' => wu_get_setting('from_name'),
|
||||
'email' => wu_get_setting('from_email'),
|
||||
);
|
||||
];
|
||||
|
||||
$to = array(
|
||||
array(
|
||||
$to = [
|
||||
[
|
||||
'name' => wu_get_setting('from_name'),
|
||||
'email' => $send_to,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$email = wu_get_email($email_id);
|
||||
|
||||
@ -259,54 +259,54 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$event_type = wu_get_event_type($event_slug);
|
||||
|
||||
$payload = array();
|
||||
$payload = [];
|
||||
|
||||
if ($event_type) {
|
||||
$payload = wu_maybe_lazy_load_payload($event_type['payload']);
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'style' => $email->get_style(),
|
||||
'content' => $email->get_content(),
|
||||
'subject' => get_network_option(null, 'site_name') . ' - ' . $email->get_title(),
|
||||
'payload' => $payload,
|
||||
);
|
||||
];
|
||||
|
||||
$send_mail = wu_send_mail($from, $to, $args);
|
||||
|
||||
if ( ! $send_mail) {
|
||||
$error = new \WP_Error('error', __('Something wrong happened with your test.', 'wp-ultimo'));
|
||||
|
||||
return wp_send_json_error($error);
|
||||
wp_send_json_error($error);
|
||||
}
|
||||
|
||||
$page = wu_request('page', 'list');
|
||||
|
||||
if ($page === 'edit') {
|
||||
if ('edit' === $page) {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-email',
|
||||
array(
|
||||
[
|
||||
'id' => $email_id,
|
||||
'test_notice' => __('Test sent successfully', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-emails',
|
||||
array(
|
||||
[
|
||||
'notice' => __('Test sent successfully', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -317,36 +317,36 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_reset_import_modal() {
|
||||
public function render_reset_import_modal(): void {
|
||||
|
||||
$default_system_emails = wu_get_default_system_emails();
|
||||
|
||||
$created_emails = wu_get_all_system_emails();
|
||||
|
||||
$fields = array(
|
||||
'reset_emails' => array(
|
||||
$fields = [
|
||||
'reset_emails' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Reset System Emails ', 'wp-ultimo'),
|
||||
'desc' => __('Restore the system emails to their original content.'),
|
||||
'desc' => __('Restore the system emails to their original content.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'reset_emails',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['reset_note'] = array(
|
||||
$fields['reset_note'] = [
|
||||
'type' => 'note',
|
||||
'title' => '',
|
||||
'desc' => __('No emails to reset.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'reset_emails',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($created_emails as $system_email_key => $system_email_value) {
|
||||
$system_email_slug = $system_email_value->get_slug();
|
||||
@ -358,18 +358,18 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$field_title = '<div><strong class="wu-inline-block wu-pr-1">' . $system_email_value->get_title() . '</strong></div>';
|
||||
|
||||
$fields[ $field_name ] = array(
|
||||
$fields[ $field_name ] = [
|
||||
'type' => 'toggle',
|
||||
'title' => $field_title,
|
||||
'desc' => $system_email_value->get_event() . ' <span class="wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono">' . $system_email_target . '</span>',
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'wrapper_classes' => 'wu-bg-gray-100',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'reset_emails',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if (isset($fields['reset_note'])) {
|
||||
unset($fields['reset_note']);
|
||||
@ -377,28 +377,28 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
}
|
||||
|
||||
$fields['import_emails'] = array(
|
||||
$fields['import_emails'] = [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Import System Emails', 'wp-ultimo'),
|
||||
'desc' => __('Add new system emails based on WP Multisite WaaS presets.'),
|
||||
'desc' => __('Add new system emails based on WP Multisite WaaS presets.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'import_emails',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['import_note'] = array(
|
||||
$fields['import_note'] = [
|
||||
'type' => 'note',
|
||||
'title' => '',
|
||||
'desc' => __('All emails are already present.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'import_emails',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($default_system_emails as $default_email_key => $default_email_value) {
|
||||
$maybe_is_created = wu_get_email_by('slug', $default_email_key);
|
||||
@ -408,18 +408,18 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$field_title = '<div><strong class="wu-inline-block wu-pr-1">' . $default_email_value['title'] . '</strong> </div>';
|
||||
|
||||
$fields[ $field_name ] = array(
|
||||
$fields[ $field_name ] = [
|
||||
'type' => 'toggle',
|
||||
'title' => $field_title,
|
||||
'desc' => $default_email_value['event'] . ' <span class="wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono">' . $default_email_value['target'] . '</span>',
|
||||
'tooltip' => '',
|
||||
'value' => 0,
|
||||
'wrapper_classes' => 'wu-bg-gray-100',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'import_emails',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if (isset($fields['import_note'])) {
|
||||
unset($fields['import_note']);
|
||||
@ -427,31 +427,31 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
}
|
||||
|
||||
$fields['submit_button'] = array(
|
||||
$fields['submit_button'] = [
|
||||
'type' => 'submit',
|
||||
'title' => __('Reset and/or Import', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end wu-text-right',
|
||||
);
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'reset_import',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'reset_import',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
'data-state' => wp_json_encode(
|
||||
[
|
||||
'reset_emails' => false,
|
||||
'import_emails' => false,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -464,7 +464,7 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle_reset_import_modal() {
|
||||
public function handle_reset_import_modal(): void {
|
||||
|
||||
$reset = wu_request('reset_emails');
|
||||
|
||||
@ -501,19 +501,19 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-emails'),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the redirect notice from sent new test modal.
|
||||
*
|
||||
* @param WP_Ultimo\Admin_Pages\Base_Admin_Page $page The page object.
|
||||
* @param Base_Admin_Page $page The page object.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_page_redirect($page) {
|
||||
public function handle_page_redirect($page): void {
|
||||
|
||||
if ($page->get_id() === 'wp-ultimo-emails') {
|
||||
if (wu_request('notice')) {
|
||||
@ -528,7 +528,6 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -539,42 +538,42 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_reset_confirmation_modal() {
|
||||
public function render_reset_confirmation_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'single_reset' => array(
|
||||
$fields = [
|
||||
'single_reset' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Confirm Reset', 'wp-ultimo'),
|
||||
'desc' => __('This action can not be undone.', 'wp-ultimo'),
|
||||
'default' => 0,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'required' => 'required',
|
||||
),
|
||||
),
|
||||
'email_id' => array(
|
||||
],
|
||||
],
|
||||
'email_id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => wu_request('id'),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Reset Email', 'wp-ultimo'),
|
||||
'value' => 'reset',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end wu-text-right',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'reset_confirmation',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'reset_confirmation',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -585,7 +584,7 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
public function handle_reset_confirmation_modal() {
|
||||
|
||||
@ -596,7 +595,7 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
if ( ! $single_reset || ! $email_id) {
|
||||
$error = new \WP_Error('error', __('Something wrong happened.', 'wp-ultimo'));
|
||||
|
||||
return wp_send_json_error($error);
|
||||
wp_send_json_error($error);
|
||||
}
|
||||
|
||||
$email = wu_get_email($email_id);
|
||||
@ -615,18 +614,18 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
if ( ! $new_email) {
|
||||
$error = new \WP_Error('error', __('Something wrong happened.', 'wp-ultimo'));
|
||||
|
||||
return wp_send_json_error($error);
|
||||
wp_send_json_error($error);
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-email',
|
||||
array(
|
||||
[
|
||||
'id' => $new_email->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -641,24 +640,24 @@ class Email_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$email_template_default = get_network_option(null, 'wu_default_email_template');
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-email'),
|
||||
'label' => __('Add System Email'),
|
||||
'label' => __('Add System Email', 'wp-ultimo'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-customize-email-template&id=' . $email_template_default),
|
||||
'label' => __('Email Template'),
|
||||
'label' => __('Email Template', 'wp-ultimo'),
|
||||
'icon' => 'wu-mail',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => wu_get_form_url('reset_import'),
|
||||
'classes' => 'wubox',
|
||||
'label' => __('Reset or Import'),
|
||||
'label' => __('Reset or Import', 'wp-ultimo'),
|
||||
'icon' => 'wu-cycle',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,9 +66,9 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_customize_email_template',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Overrides the init method to add additional hooks.
|
||||
@ -76,11 +76,11 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
|
||||
add_action('wp_ajax_wu-email-template-preview', array($this, 'email_template_preview'));
|
||||
add_action('wp_ajax_wu-email-template-preview', [$this, 'email_template_preview']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function email_template_preview() {
|
||||
public function email_template_preview(): void {
|
||||
|
||||
$object = $this;
|
||||
|
||||
@ -151,14 +151,14 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
|
||||
wu_get_template(
|
||||
'broadcast/emails/base',
|
||||
array(
|
||||
[
|
||||
'site_name' => get_network_option(null, 'site_name'),
|
||||
'site_url' => get_site_url(),
|
||||
'logo_url' => wu_get_network_logo(),
|
||||
'content' => $content,
|
||||
'subject' => __('Sample Subject', 'wp-ultimo'),
|
||||
'is_editor' => true,
|
||||
'template_settings' => array(
|
||||
'template_settings' => [
|
||||
'use_custom_logo' => wu_string_to_bool(wu_request('use_custom_logo', $first_request ? $object->get_setting('use_custom_logo', false) : false)),
|
||||
'custom_logo' => wu_request('custom_logo', $object->get_setting('custom_logo', false)),
|
||||
'background_color' => wu_request('background_color', $object->get_setting('background_color', '#f9f9f9')),
|
||||
@ -174,8 +174,8 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
'footer_color' => wu_request('footer_color', $object->get_setting('footer_color', '#000000')),
|
||||
'footer_align' => wu_request('footer_align', $object->get_setting('footer_align', 'center')),
|
||||
'display_company_address' => wu_string_to_bool(wu_request('display_company_address', $first_request ? $object->get_setting('display_company_address', true) : false)),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
die;
|
||||
@ -192,10 +192,10 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
$url = get_admin_url(wu_get_main_site_id(), 'admin-ajax.php');
|
||||
|
||||
return add_query_arg(
|
||||
array(
|
||||
[
|
||||
'action' => 'wu-email-template-preview',
|
||||
'customizer' => 1,
|
||||
),
|
||||
],
|
||||
$url
|
||||
);
|
||||
}
|
||||
@ -206,22 +206,22 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'save',
|
||||
'data-state' => wu_convert_to_state(),
|
||||
),
|
||||
'fields' => array(
|
||||
'note' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('System emails and broadcasts will be sent using this template.', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$settings = $this->get_attributes();
|
||||
@ -232,273 +232,273 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
|
||||
$custom_logo_url = $custom_logo_args ? $custom_logo_args[0] : '';
|
||||
|
||||
$fields = array(
|
||||
'tab' => array(
|
||||
$fields = [
|
||||
'tab' => [
|
||||
'type' => 'tab-select',
|
||||
'wrapper_classes' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'tab',
|
||||
),
|
||||
'options' => array(
|
||||
],
|
||||
'options' => [
|
||||
'header' => __('Header', 'wp-ultimo'),
|
||||
'content' => __('Content', 'wp-ultimo'),
|
||||
'footer' => __('Footer', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
'use_custom_logo' => array(
|
||||
],
|
||||
],
|
||||
'use_custom_logo' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Use Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('You can set a different logo to be used on the system emails.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'use_custom_logo',
|
||||
),
|
||||
),
|
||||
'custom_logo' => array(
|
||||
],
|
||||
],
|
||||
'custom_logo' => [
|
||||
'type' => 'image',
|
||||
'stacked' => true,
|
||||
'title' => __('Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('The custom logo is used in the email header, if HTML emails are used.', 'wp-ultimo'),
|
||||
'value' => $custom_logo,
|
||||
'img' => $custom_logo_url,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header") && require("use_custom_logo", true)',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
// 'v-model' => 'custom_logo',
|
||||
),
|
||||
),
|
||||
'background_color' => array(
|
||||
],
|
||||
],
|
||||
'background_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Background Color', 'wp-ultimo'),
|
||||
'tooltip' => __('The cover background color of the email.', 'wp-ultimo'),
|
||||
'value' => '#00a1ff',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'background_color',
|
||||
),
|
||||
),
|
||||
'title_color' => array(
|
||||
],
|
||||
],
|
||||
'title_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Title Color', 'wp-ultimo'),
|
||||
'value' => '#00a1ff',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'title_color',
|
||||
),
|
||||
),
|
||||
'title_size' => array(
|
||||
],
|
||||
],
|
||||
'title_size' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Title Size', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'title_size'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'h1' => __('h1', 'wp-ultimo'),
|
||||
'h2' => __('h2', 'wp-ultimo'),
|
||||
'h3' => __('h3', 'wp-ultimo'),
|
||||
'h4' => __('h4', 'wp-ultimo'),
|
||||
'h5' => __('h5', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'title_size',
|
||||
),
|
||||
),
|
||||
'title_align' => array(
|
||||
],
|
||||
],
|
||||
'title_align' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Title Align', 'wp-ultimo'),
|
||||
'tooltip' => __('Aligment of the font in the title.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'title_align', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'left' => __('Left', 'wp-ultimo'),
|
||||
'center' => __('Center', 'wp-ultimo'),
|
||||
'right' => __('Right', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'title_align',
|
||||
),
|
||||
),
|
||||
'title_font' => array(
|
||||
],
|
||||
],
|
||||
'title_font' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Title Font-Family', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'title_font', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'Helvetica Neue, Helvetica, Helvetica, Arial, sans-serif' => __('Helvetica', 'wp-ultimo'),
|
||||
'Arial, Helvetica, sans-serif' => __('Arial', 'wp-ultimo'),
|
||||
'Times New Roman, Times, serif' => __('Times New Roman', 'wp-ultimo'),
|
||||
'Lucida Console, Courier, monospace' => __('Lucida', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "header")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'title_font',
|
||||
),
|
||||
),
|
||||
'content_color' => array(
|
||||
],
|
||||
],
|
||||
'content_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Content Color', 'wp-ultimo'),
|
||||
'value' => '#000000',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "content")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'content_color',
|
||||
),
|
||||
),
|
||||
'content_align' => array(
|
||||
],
|
||||
],
|
||||
'content_align' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Content Alignment', 'wp-ultimo'),
|
||||
'tooltip' => __('Alignment of the font in the main email content.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'content_align', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'left' => __('Left', 'wp-ultimo'),
|
||||
'center' => __('Center', 'wp-ultimo'),
|
||||
'right' => __('Right', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "content")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'content_align',
|
||||
),
|
||||
),
|
||||
'content_font' => array(
|
||||
],
|
||||
],
|
||||
'content_font' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Content Font-Family', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'content_font', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'Helvetica Neue, Helvetica, Helvetica, Arial, sans-serif' => __('Helvetica', 'wp-ultimo'),
|
||||
'Arial, Helvetica, sans-serif' => __('Arial', 'wp-ultimo'),
|
||||
'Times New Roman, Times, serif' => __('Times New Roman', 'wp-ultimo'),
|
||||
'Lucida Console, Courier, monospace' => __('Lucida', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "content")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'content_font',
|
||||
),
|
||||
),
|
||||
'display_company_address' => array(
|
||||
],
|
||||
],
|
||||
'display_company_address' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Company Address', 'wp-ultimo'),
|
||||
'desc' => __('Toggle to show/hide your company address.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "footer")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'display_company_address',
|
||||
),
|
||||
),
|
||||
'footer_text' => array(
|
||||
],
|
||||
],
|
||||
'footer_text' => [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Footer Content', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Extra info in the email footer.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'footer_text', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "footer")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'footer_text',
|
||||
),
|
||||
),
|
||||
'footer_font' => array(
|
||||
],
|
||||
],
|
||||
'footer_font' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Footer Font-Family', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'footer_font', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'Helvetica Neue, Helvetica, Helvetica, Arial, sans-serif' => __('Helvetica', 'wp-ultimo'),
|
||||
'Arial, Helvetica, sans-serif' => __('Arial', 'wp-ultimo'),
|
||||
'Times New Roman, Times, serif' => __('Times New Roman', 'wp-ultimo'),
|
||||
'Lucida Console, Courier, monospace' => __('Lucida', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "footer")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'footer_font',
|
||||
),
|
||||
),
|
||||
'footer_color' => array(
|
||||
],
|
||||
],
|
||||
'footer_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Footer Color', 'wp-ultimo'),
|
||||
'value' => '#000000',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "footer")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'footer_color',
|
||||
),
|
||||
),
|
||||
'footer_align' => array(
|
||||
],
|
||||
],
|
||||
'footer_align' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Footer Alignment', 'wp-ultimo'),
|
||||
'tooltip' => __('Alignment of the font in the main email footer.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'footer_align', ''),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'left' => __('Left', 'wp-ultimo'),
|
||||
'center' => __('Center', 'wp-ultimo'),
|
||||
'right' => __('Right', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "footer")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'footer_align',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$state = array_merge(
|
||||
$settings,
|
||||
array(
|
||||
[
|
||||
'tab' => 'header',
|
||||
'refresh' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'customizer',
|
||||
array(
|
||||
[
|
||||
'title' => __('Customizer', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'fields' => $fields,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'margin-top: -6px;',
|
||||
'data-wu-app' => 'email_template_customizer',
|
||||
'data-wu-customizer-panel' => true,
|
||||
'data-state' => json_encode($state),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -532,7 +532,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -543,7 +543,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'customize_label' => __('Customize Email Template', 'wp-ultimo'),
|
||||
'add_new_label' => __('Customize Email Template', 'wp-ultimo'),
|
||||
'edit_label' => __('Edit Email Template', 'wp-ultimo'),
|
||||
@ -554,7 +554,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Email Template', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -563,7 +563,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
$_POST['footer_text'] = stripslashes((string) $_POST['footer_text']);
|
||||
|
||||
@ -590,9 +590,9 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function get_attributes() {
|
||||
|
||||
$saved_atts = $this->get_settings();
|
||||
$saved_atts = static::get_settings();
|
||||
|
||||
$attributes = wp_parse_args($saved_atts, $this->get_default_settings());
|
||||
$attributes = wp_parse_args($saved_atts, static::get_default_settings());
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
@ -605,7 +605,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public static function get_default_settings() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'use_custom_logo' => false,
|
||||
'custom_logo' => false,
|
||||
'display_company_address' => true,
|
||||
@ -621,7 +621,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
'footer_text' => '',
|
||||
'footer_color' => '#000000',
|
||||
'footer_align' => 'center',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -633,7 +633,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public static function get_settings() {
|
||||
|
||||
return wu_get_option('email_template', array());
|
||||
return wu_get_option('email_template', []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -648,7 +648,7 @@ class Email_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
public function get_setting($setting, $default = false) {
|
||||
|
||||
if ($setting) {
|
||||
$return = wu_get_option('email_template', array());
|
||||
$return = wu_get_option('email_template', []);
|
||||
|
||||
if ($return && isset($return[ $setting ])) {
|
||||
$return = $return[ $setting ];
|
||||
|
@ -52,9 +52,9 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_events',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Instantiate the necessary hooks.
|
||||
@ -62,9 +62,9 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_action('init', array($this, 'set_badge_count'));
|
||||
add_action('init', [$this, 'set_badge_count']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,11 +73,11 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
parent::page_loaded();
|
||||
|
||||
add_action('in_admin_header', array($this, 'count_seen_events'));
|
||||
add_action('in_admin_header', [$this, 'count_seen_events']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function set_badge_count() {
|
||||
public function set_badge_count(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -119,19 +119,19 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function count_seen_events() {
|
||||
public function count_seen_events(): void {
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
delete_site_transient("wu_{$user_id}_unseen_events_count");
|
||||
|
||||
$last_event = wu_get_events(
|
||||
array(
|
||||
[
|
||||
'orderby' => 'id',
|
||||
'fields' => 'ids',
|
||||
'order' => 'DESC',
|
||||
'number' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! empty($last_event)) {
|
||||
@ -159,10 +159,10 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Event removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Event', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -206,13 +206,13 @@ class Event_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-view-logs'),
|
||||
'label' => __('View Logs'),
|
||||
'icon' => 'dashicons dashicons-editor-ol',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,9 +76,9 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_events',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register scripts and styles that can be loaded on the output function, for example.
|
||||
@ -86,11 +86,11 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-event-view', wu_get_asset('event-view-page.js', 'js'), array('jquery'));
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-event-view', wu_get_asset('event-view-page.js', 'js'), ['jquery']);
|
||||
|
||||
wp_enqueue_script('wu-event-view');
|
||||
|
||||
@ -105,16 +105,16 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Delete Event - Confirmation modal
|
||||
*/
|
||||
|
||||
add_filter(
|
||||
'wu_data_json_success_delete_event_modal',
|
||||
fn($data_json) => array(
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-events', array('deleted' => 1)),
|
||||
)
|
||||
fn($data_json) => [
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-events', ['deleted' => 1]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -124,23 +124,23 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
add_meta_box('wp-ultimo-message', __('Event Message', 'wp-ultimo'), array($this, 'output_default_widget_message'), get_current_screen()->id, 'normal', 'default');
|
||||
add_meta_box('wp-ultimo-message', __('Event Message', 'wp-ultimo'), [$this, 'output_default_widget_message'], get_current_screen()->id, 'normal', 'default');
|
||||
|
||||
add_meta_box('wp-ultimo-initiator', __('Event', 'wp-ultimo'), array($this, 'output_default_widget_initiator'), get_current_screen()->id, 'side', 'default');
|
||||
add_meta_box('wp-ultimo-initiator', __('Event', 'wp-ultimo'), [$this, 'output_default_widget_initiator'], get_current_screen()->id, 'side', 'default');
|
||||
|
||||
add_meta_box('wp-ultimo-payload', __('Event Payload', 'wp-ultimo'), array($this, 'output_default_widget_payload'), get_current_screen()->id, 'normal', 'default');
|
||||
add_meta_box('wp-ultimo-payload', __('Event Payload', 'wp-ultimo'), [$this, 'output_default_widget_payload'], get_current_screen()->id, 'normal', 'default');
|
||||
|
||||
$this->add_info_widget(
|
||||
'info',
|
||||
array(
|
||||
[
|
||||
'title' => __('Timestamps', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'modified' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -150,16 +150,16 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_message() {
|
||||
public function output_default_widget_message(): void {
|
||||
|
||||
wu_get_template(
|
||||
'events/widget-message',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'labels' => $this->get_labels(),
|
||||
'object' => $this->get_object(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -169,17 +169,17 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_payload() {
|
||||
public function output_default_widget_payload(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
wu_get_template(
|
||||
'events/widget-payload',
|
||||
array(
|
||||
[
|
||||
'title' => __('Event Payload', 'wp-ultimo'),
|
||||
'loading_text' => __('Loading Payload', 'wp-ultimo'),
|
||||
'payload' => json_encode($object->get_payload(), JSON_PRETTY_PRINT),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -189,13 +189,13 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_initiator() {
|
||||
public function output_default_widget_initiator(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'object' => $object,
|
||||
);
|
||||
];
|
||||
|
||||
wu_get_template('events/widget-initiator', $args);
|
||||
}
|
||||
@ -230,7 +230,7 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,7 +241,7 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Event', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Event', 'wp-ultimo'),
|
||||
'updated_message' => __('Event updated with success!', 'wp-ultimo'),
|
||||
@ -251,7 +251,7 @@ class Event_View_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Event', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,9 +66,9 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Current integration being setup.
|
||||
@ -84,7 +84,7 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
if (isset($_GET['integration'])) {
|
||||
$domain_manager = \WP_Ultimo\Managers\Domain_Manager::get_instance();
|
||||
@ -131,30 +131,30 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
$sections = array(
|
||||
'activation' => array(
|
||||
$sections = [
|
||||
'activation' => [
|
||||
'title' => __('Activation', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_activation'),
|
||||
'handler' => array($this, 'handle_activation'),
|
||||
),
|
||||
'instructions' => array(
|
||||
'view' => [$this, 'section_activation'],
|
||||
'handler' => [$this, 'handle_activation'],
|
||||
],
|
||||
'instructions' => [
|
||||
'title' => __('Instructions', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_instructions'),
|
||||
),
|
||||
'config' => array(
|
||||
'view' => [$this, 'section_instructions'],
|
||||
],
|
||||
'config' => [
|
||||
'title' => __('Configuration', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_configuration'),
|
||||
'handler' => array($this, 'handle_configuration'),
|
||||
),
|
||||
'testing' => array(
|
||||
'view' => [$this, 'section_configuration'],
|
||||
'handler' => [$this, 'handle_configuration'],
|
||||
],
|
||||
'testing' => [
|
||||
'title' => __('Testing Integration', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_test'),
|
||||
),
|
||||
'done' => array(
|
||||
'view' => [$this, 'section_test'],
|
||||
],
|
||||
'done' => [
|
||||
'title' => __('Ready!', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_ready'),
|
||||
),
|
||||
);
|
||||
'view' => [$this, 'section_ready'],
|
||||
],
|
||||
];
|
||||
|
||||
/*
|
||||
* Some host providers require no instructions.
|
||||
@ -179,19 +179,19 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_activation() {
|
||||
public function section_activation(): void {
|
||||
|
||||
$explainer_lines = $this->integration->get_explainer_lines();
|
||||
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/activation',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
'will' => $explainer_lines['will'],
|
||||
'will_not' => $explainer_lines['will_not'],
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -201,9 +201,9 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_instructions() {
|
||||
public function section_instructions(): void {
|
||||
|
||||
call_user_func(array($this->integration, 'get_instructions'));
|
||||
call_user_func([$this->integration, 'get_instructions']);
|
||||
|
||||
$this->render_submit_box();
|
||||
}
|
||||
@ -214,7 +214,7 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_configuration() {
|
||||
public function section_configuration(): void {
|
||||
|
||||
$fields = $this->integration->get_fields();
|
||||
|
||||
@ -225,23 +225,23 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
$this->get_current_section(),
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-widget-list wu-striped wu-m-0 wu--mt-2 wu--mb-3 wu--mx-3',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-px-6 wu-py-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (wu_request('manual')) {
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/configuration-results',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
'form' => $form,
|
||||
'post' => $_GET['post'],
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
@ -249,12 +249,12 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/configuration',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
'form' => $form,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -264,15 +264,15 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_ready() {
|
||||
public function section_ready(): void {
|
||||
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/ready',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_activation() {
|
||||
public function handle_activation(): void {
|
||||
|
||||
$is_enabled = $this->integration->is_enabled();
|
||||
|
||||
@ -305,15 +305,15 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_configuration() {
|
||||
public function handle_configuration(): void {
|
||||
|
||||
if (wu_request('submit') == '0') { // phpcs:ignore
|
||||
|
||||
$redirect_url = add_query_arg(
|
||||
array(
|
||||
[
|
||||
'manual' => '1',
|
||||
'post' => $_POST,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
@ -344,17 +344,17 @@ class Hosting_Integration_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_test() {
|
||||
public function section_test(): void {
|
||||
|
||||
wp_enqueue_script('wu-vue');
|
||||
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/test',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_customize_invoice_template',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Overrides the original init to add the required ajax endpoints.
|
||||
@ -78,11 +78,11 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
|
||||
add_action('wp_ajax_wu-preview-invoice', array($this, 'generate_invoice_preview'));
|
||||
add_action('wp_ajax_wu-preview-invoice', [$this, 'generate_invoice_preview']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,7 +91,7 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function generate_invoice_preview() {
|
||||
public function generate_invoice_preview(): void {
|
||||
|
||||
if ( ! current_user_can('wu_manage_invoice')) {
|
||||
return;
|
||||
@ -119,11 +119,11 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
$url = get_admin_url(wu_get_main_site_id(), 'admin-ajax.php');
|
||||
|
||||
return add_query_arg(
|
||||
array(
|
||||
[
|
||||
'action' => 'wu-preview-invoice',
|
||||
'customizer' => 1,
|
||||
'invoice-customize' => 1,
|
||||
),
|
||||
],
|
||||
$url
|
||||
);
|
||||
}
|
||||
@ -134,20 +134,20 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$settings = Invoice::get_settings();
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'fields' => array(
|
||||
'note' => array(
|
||||
[
|
||||
'fields' => [
|
||||
'note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('Changes to this template will be applied to all PDF invoices generated after the change. <br><br>Existing PDF Invoices will not be affected unless explicitly re-generated', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$custom_logo = wu_get_isset($settings, 'custom_logo');
|
||||
@ -156,139 +156,139 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
|
||||
$custom_logo_url = $custom_logo_args ? $custom_logo_args[0] : '';
|
||||
|
||||
$fields = array(
|
||||
'tab' => array(
|
||||
$fields = [
|
||||
'tab' => [
|
||||
'type' => 'tab-select',
|
||||
'wrapper_classes' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'tab',
|
||||
),
|
||||
'options' => array(
|
||||
],
|
||||
'options' => [
|
||||
'general' => __('General', 'wp-ultimo'),
|
||||
'colors' => __('Colors', 'wp-ultimo'),
|
||||
'images' => __('Images', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'paid_tag_text' => array(
|
||||
'paid_tag_text' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Paid Tag', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Paid.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'paid_tag_text', __('Paid', 'wp-ultimo')),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "general")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'paid_tag_text',
|
||||
),
|
||||
),
|
||||
'font' => array(
|
||||
],
|
||||
],
|
||||
'font' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Font-Family', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'font', ''),
|
||||
'options' => array(
|
||||
'DejaVuSansCondensed' => __('Sans-Serif', 'wp-ultimo'),
|
||||
'FreeSerif' => __('Serif', 'wp-ultimo'),
|
||||
'FreeMono' => __('Mono', 'wp-ultimo'),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
'options' => [
|
||||
'DejaVuSansCondensed' => __('Sans-Serif', 'wp-ultimo'),
|
||||
'DejaVuSerifCondensed' => __('Serif', 'wp-ultimo'),
|
||||
'FreeMono' => __('Mono', 'wp-ultimo'),
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "general")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'font',
|
||||
),
|
||||
),
|
||||
'footer_message' => array(
|
||||
],
|
||||
],
|
||||
'footer_message' => [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Footer Content', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Extra Info about the Invoice.', 'wp-ultimo'),
|
||||
'value' => wu_get_isset($settings, 'footer_message', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "general")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'footer_message',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'primary_color' => array(
|
||||
'primary_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Primary Color', 'wp-ultimo'),
|
||||
'value' => '#00a1ff',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "colors")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'primary_color',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'use_custom_logo' => array(
|
||||
'use_custom_logo' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Use Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('You can set a different logo to be used on the invoice.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "images")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'use_custom_logo',
|
||||
),
|
||||
),
|
||||
'custom_logo' => array(
|
||||
],
|
||||
],
|
||||
'custom_logo' => [
|
||||
'type' => 'image',
|
||||
'title' => __('Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('This will be added to the top of the generated PDF.', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'img' => $custom_logo_url,
|
||||
'stacked' => true,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "images") && require("use_custom_logo", true)',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'custom_logo',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$settings = array(
|
||||
$settings = [
|
||||
'footer_message' => wu_get_isset($settings, 'footer_message', ''),
|
||||
'paid_tag_text' => wu_get_isset($settings, 'paid_tag_text', __('Paid', 'wp-ultimo')),
|
||||
'primary_color' => wu_get_isset($settings, 'primary_color', '00a1ff'),
|
||||
'use_custom_logo' => wu_get_isset($settings, 'use_custom_logo'),
|
||||
'custom_logo' => wu_get_isset($settings, 'custom_logo'),
|
||||
'font' => wu_get_isset($settings, 'font', 'DejaVuSansCondensed'),
|
||||
);
|
||||
];
|
||||
|
||||
$state = array_merge(
|
||||
$settings,
|
||||
array(
|
||||
[
|
||||
'tab' => 'general',
|
||||
'refresh' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'customizer',
|
||||
array(
|
||||
[
|
||||
'title' => __('Customizer', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'fields' => $fields,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'margin-top: -6px;',
|
||||
'data-wu-app' => 'invoice_customizer',
|
||||
'data-wu-customizer-panel' => true,
|
||||
'data-state' => json_encode($state),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,7 +333,7 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'customize_label' => __('Customize Invoice Template', 'wp-ultimo'),
|
||||
'add_new_label' => __('Customize Invoice Template', 'wp-ultimo'),
|
||||
'edit_label' => __('Edit Invoice Template', 'wp-ultimo'),
|
||||
@ -342,7 +342,7 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
'title_description' => __('This name is used for internal reference only.', 'wp-ultimo'),
|
||||
'save_button_label' => __('Save Invoice Template', 'wp-ultimo'),
|
||||
'save_description' => __('Save Invoice Template', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -351,7 +351,7 @@ class Invoice_Template_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
Invoice::save_settings($_POST);
|
||||
|
||||
|
@ -66,9 +66,9 @@ class Jobs_List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_jobs',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Overrides the init method to add additional hooks.
|
||||
@ -76,11 +76,11 @@ class Jobs_List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
|
||||
add_filter('action_scheduler_admin_view_class', array($this, 'hide_as_admin_page'), 9999, 1);
|
||||
add_filter('action_scheduler_admin_view_class', [$this, 'hide_as_admin_page'], 9999, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ class Jobs_List_Admin_Page extends Base_Admin_Page {
|
||||
return $admin_view_class;
|
||||
}
|
||||
|
||||
return '\WP_Ultimo\Compat\AS_Admin_View';
|
||||
return \WP_Ultimo\Compat\AS_Admin_View::class;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +141,7 @@ class Jobs_List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.10
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
\ActionScheduler_AdminView::instance()->process_admin_ui();
|
||||
}
|
||||
@ -152,7 +152,7 @@ class Jobs_List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
\ActionScheduler_AdminView::instance()->render_admin_ui();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @var array
|
||||
*/
|
||||
protected $labels = array();
|
||||
protected $labels = [];
|
||||
|
||||
/**
|
||||
* Holds the WP_List_Table instance to be used on the list
|
||||
@ -56,7 +56,7 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
/**
|
||||
* Loads the list table
|
||||
@ -90,14 +90,14 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
/**
|
||||
* Runs the parent init functions
|
||||
*/
|
||||
parent::init();
|
||||
|
||||
add_filter('set-screen-option', array($this, 'save_screen_option'), 8, 3);
|
||||
add_filter('set-screen-option', [$this, 'save_screen_option'], 8, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function process_single_action() {
|
||||
public function process_single_action(): void {
|
||||
|
||||
if ($this->table) {
|
||||
$this->table->process_single_action();
|
||||
@ -121,10 +121,10 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Object removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Object', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +133,7 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
@ -152,18 +152,18 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
/**
|
||||
* Renders the base list page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/list',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
'table' => $this->get_table(),
|
||||
'classes' => $this->table->get_filters() ? 'wu-advanced-filters' : 'wu-no-advanced-filters',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -184,14 +184,14 @@ abstract class List_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function screen_options() {
|
||||
public function screen_options(): void {
|
||||
|
||||
if ($this->table) {
|
||||
$args = array(
|
||||
$args = [
|
||||
'default' => 20,
|
||||
'label' => $this->table->get_per_page_option_label(),
|
||||
'option' => $this->table->get_per_page_option_name(),
|
||||
);
|
||||
];
|
||||
|
||||
add_screen_option('per_page', $args);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,9 +53,9 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_memberships',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms to handle adding new memberships.
|
||||
@ -63,17 +63,17 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new Membership
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_membership',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_membership_modal'),
|
||||
'handler' => array($this, 'handle_add_new_membership_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_membership_modal'],
|
||||
'handler' => [$this, 'handle_add_new_membership_modal'],
|
||||
'capability' => 'wu_edit_memberships',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -83,37 +83,37 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_membership_modal() {
|
||||
public function render_add_new_membership_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'customer_id' => array(
|
||||
$fields = [
|
||||
'customer_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Customer', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Customer...', 'wp-ultimo'),
|
||||
'desc' => __('The customer to attach this membership to.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'customer',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'display_name',
|
||||
'data-search-field' => 'display_name',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
),
|
||||
'product_ids' => array(
|
||||
],
|
||||
],
|
||||
'product_ids' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Products', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Products...', 'wp-ultimo'),
|
||||
'desc' => __('You can add multiples products to this membership.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'product',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'name',
|
||||
'data-search-field' => 'name',
|
||||
'data-max-items' => 99,
|
||||
),
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Status', 'wp-ultimo'),
|
||||
'placeholder' => __('Status', 'wp-ultimo'),
|
||||
@ -121,59 +121,59 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
'tooltip' => '',
|
||||
'value' => Membership_Status::PENDING,
|
||||
'options' => Membership_Status::to_array(),
|
||||
),
|
||||
'lifetime' => array(
|
||||
],
|
||||
'lifetime' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Lifetime', 'wp-ultimo'),
|
||||
'desc' => __('Activate this toggle to mark the newly created membership as lifetime.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'lifetime',
|
||||
),
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
],
|
||||
'date_expiration' => [
|
||||
'title' => __('Expiration Date', 'wp-ultimo'),
|
||||
'desc' => __('Set the expiration date of the membership to be created.', 'wp-ultimo'),
|
||||
'type' => 'text',
|
||||
'date' => true,
|
||||
'value' => gmdate('Y-m-d', strtotime('+1 month')),
|
||||
'placeholder' => '2020-04-04',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'wu-datepicker' => 'true',
|
||||
'data-format' => 'Y-m-d',
|
||||
'data-allow-time' => 'false',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => '!lifetime',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Create Membership', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_membership',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_new_membership',
|
||||
'data-on-load' => 'wu_initialize_datepickers',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'lifetime' => 1,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -185,7 +185,7 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_membership_modal() {
|
||||
public function handle_add_new_membership_modal(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -214,10 +214,10 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
$cart = new \WP_Ultimo\Checkout\Cart(
|
||||
array(
|
||||
[
|
||||
'products' => $products,
|
||||
'country' => $customer->get_country(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$data = $cart->to_membership_data();
|
||||
@ -243,14 +243,14 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
[
|
||||
'id' => $membership->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -262,10 +262,10 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Membership removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Membership', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,14 +309,14 @@ class Membership_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Membership'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_membership'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,9 +66,9 @@ class Migration_Alert_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.24
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Overrides original construct method.
|
||||
@ -93,7 +93,7 @@ class Migration_Alert_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function get_logo() {
|
||||
|
||||
return wu_get_asset('logo.png', 'img');
|
||||
return wu_get_asset('logo.webp', 'img');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,13 +126,13 @@ class Migration_Alert_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
return array(
|
||||
'alert' => array(
|
||||
return [
|
||||
'alert' => [
|
||||
'title' => __('Alert!', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_alert'),
|
||||
'handler' => array($this, 'handle_proceed'),
|
||||
),
|
||||
);
|
||||
'view' => [$this, 'section_alert'],
|
||||
'handler' => [$this, 'handle_proceed'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,14 +141,14 @@ class Migration_Alert_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.24
|
||||
* @return void
|
||||
*/
|
||||
public function section_alert() {
|
||||
public function section_alert(): void {
|
||||
|
||||
wu_get_template(
|
||||
'wizards/setup/alert',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ class Migration_Alert_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.24
|
||||
* @return void
|
||||
*/
|
||||
public function handle_proceed() {
|
||||
public function handle_proceed(): void {
|
||||
|
||||
delete_network_option(null, 'wu_setup_finished');
|
||||
delete_network_option(null, 'wu_is_migration_done');
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,9 +52,9 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_payments',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms that we use for payments.
|
||||
@ -62,17 +62,17 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Edit/Add Line Item
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_payment',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_payment_modal'),
|
||||
'handler' => array($this, 'handle_add_new_payment_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_payment_modal'],
|
||||
'handler' => [$this, 'handle_add_new_payment_modal'],
|
||||
'capability' => 'wu_edit_payments',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -82,25 +82,25 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_payment_modal() {
|
||||
public function render_add_new_payment_modal(): void {
|
||||
|
||||
$fields = array(
|
||||
'products' => array(
|
||||
$fields = [
|
||||
'products' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Products', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Products...', 'wp-ultimo'),
|
||||
'desc' => __('Each product will be added as a line item.', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'tooltip' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'product',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'name',
|
||||
'data-search-field' => 'name',
|
||||
'data-max-items' => 10,
|
||||
),
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Status', 'wp-ultimo'),
|
||||
'placeholder' => __('Status', 'wp-ultimo'),
|
||||
@ -108,54 +108,54 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
'value' => Payment_Status::COMPLETED,
|
||||
'options' => Payment_Status::to_array(),
|
||||
'tooltip' => '',
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Membership', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Membership...', 'wp-ultimo'),
|
||||
'desc' => __('The membership associated with this payment.', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'tooltip' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'membership',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'reference_code',
|
||||
'data-max-items' => 1,
|
||||
'data-selected' => '',
|
||||
),
|
||||
),
|
||||
'add_setup_fees' => array(
|
||||
],
|
||||
],
|
||||
'add_setup_fees' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Include Setup Fees', 'wp-ultimo'),
|
||||
'desc' => __('Checking this box will include setup fees attached to the selected products as well.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Add Payment', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'wu-w-full button button-primary',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_payment',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_payment',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'taxable' => 0,
|
||||
'type' => 'product',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -178,19 +178,19 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
$cart = new \WP_Ultimo\Checkout\Cart(
|
||||
array(
|
||||
[
|
||||
'products' => explode(',', (string) wu_request('products')),
|
||||
'cart_type' => wu_request('add_setup_fees') ? 'new' : 'renewal',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$payment_data = array_merge(
|
||||
$cart->to_payment_data(),
|
||||
array(
|
||||
[
|
||||
'status' => wu_request('status'),
|
||||
'membership_id' => $membership->get_id(),
|
||||
'customer_id' => $membership->get_customer_id(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$payment = wu_create_payment($payment_data);
|
||||
@ -200,14 +200,14 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-payment',
|
||||
array(
|
||||
[
|
||||
'id' => $payment->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -227,10 +227,10 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Payment removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Payment', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,14 +274,14 @@ class Payment_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Payment', 'wp-ultimo'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_payment'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,9 +58,9 @@ class Placeholders_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
@ -101,24 +101,24 @@ class Placeholders_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
do_action('wu_load_edit_placeholders_list_page');
|
||||
|
||||
$columns = apply_filters(
|
||||
'wu_edit_placeholders_columns',
|
||||
array(
|
||||
[
|
||||
'placeholder' => __('Placeholder', 'wp-ultimo'),
|
||||
'content' => __('Content', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wu_get_template(
|
||||
'sites/edit-placeholders',
|
||||
array(
|
||||
[
|
||||
'columns' => $columns,
|
||||
'types' => array(),
|
||||
)
|
||||
'types' => [],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,20 +128,20 @@ class Placeholders_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_register_script('wu-edit-placeholders', wu_get_asset('edit-placeholders.js', 'js'), array('wu-admin', 'wu-vue', 'underscore'), wu_get_version(), false);
|
||||
wp_register_script('wu-edit-placeholders', wu_get_asset('edit-placeholders.js', 'js'), ['wu-admin', 'wu-vue', 'underscore'], wu_get_version(), false);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-edit-placeholders',
|
||||
'wu_placeholdersl10n',
|
||||
array(
|
||||
[
|
||||
'name' => __('Tax', 'wp-ultimo'),
|
||||
'confirm_message' => __('Are you sure you want to delete this rows?', 'wp-ultimo'),
|
||||
'confirm_delete_tax_category_message' => __('Are you sure you want to delete this tax category?', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-edit-placeholders');
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -50,9 +50,9 @@ class Product_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_products',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -70,10 +70,10 @@ class Product_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Product removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Product', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,13 +117,13 @@ class Product_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product'),
|
||||
'label' => __('Add Product'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,9 +62,9 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_settings',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
@ -104,7 +104,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
wp_enqueue_editor();
|
||||
|
||||
@ -130,56 +130,56 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'login-and-registration',
|
||||
array(
|
||||
[
|
||||
'title' => __('Checkout Forms', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_checkout_forms_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_checkout_forms_side_panel'],
|
||||
]
|
||||
);
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'sites',
|
||||
array(
|
||||
[
|
||||
'title' => __('Template Previewer', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_site_template_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_site_template_side_panel'],
|
||||
]
|
||||
);
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'sites',
|
||||
array(
|
||||
[
|
||||
'title' => __('Placeholder Editor', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_site_placeholders_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_site_placeholders_side_panel'],
|
||||
]
|
||||
);
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'payment-gateways',
|
||||
array(
|
||||
[
|
||||
'title' => __('Invoices', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_invoice_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_invoice_side_panel'],
|
||||
]
|
||||
);
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'emails',
|
||||
array(
|
||||
[
|
||||
'title' => __('System Emails', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_system_emails_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_system_emails_side_panel'],
|
||||
]
|
||||
);
|
||||
|
||||
wu_register_settings_side_panel(
|
||||
'emails',
|
||||
array(
|
||||
[
|
||||
'title' => __('Email Template', 'wp-ultimo'),
|
||||
'render' => array($this, 'render_email_template_side_panel'),
|
||||
)
|
||||
'render' => [$this, 'render_email_template_side_panel'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_checkout_forms_side_panel() {
|
||||
public function render_checkout_forms_side_panel(): void {
|
||||
?>
|
||||
|
||||
<div class="wu-widget-inset">
|
||||
@ -201,7 +201,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Checkout Forms', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/checkout-forms.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Checkout Forms', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/checkout-forms.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -231,7 +231,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_site_template_side_panel() {
|
||||
public function render_site_template_side_panel(): void {
|
||||
|
||||
?>
|
||||
|
||||
@ -244,7 +244,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Template Previewer', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/site-template.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Template Previewer', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/site-template.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -274,7 +274,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_site_placeholders_side_panel() {
|
||||
public function render_site_placeholders_side_panel(): void {
|
||||
|
||||
?>
|
||||
|
||||
@ -287,7 +287,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Template Placeholders', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/template-placeholders.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Template Placeholders', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/template-placeholders.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -317,7 +317,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_invoice_side_panel() {
|
||||
public function render_invoice_side_panel(): void {
|
||||
|
||||
?>
|
||||
|
||||
@ -330,7 +330,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Invoice Template', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/invoice-template.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize the Invoice Template', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/invoice-template.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -360,7 +360,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_system_emails_side_panel() {
|
||||
public function render_system_emails_side_panel(): void {
|
||||
|
||||
?>
|
||||
|
||||
@ -373,7 +373,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize System Emails', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/system-emails.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize System Emails', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/system-emails.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -403,7 +403,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_email_template_side_panel() {
|
||||
public function render_email_template_side_panel(): void {
|
||||
|
||||
?>
|
||||
|
||||
@ -416,7 +416,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
</span>
|
||||
|
||||
<div class="wu-py-2">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize Email Template', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/email-template.png'); ?>">
|
||||
<img class="wu-w-full" alt="<?php esc_attr_e('Customize Email Template', 'wp-ultimo'); ?>" src="<?php echo wu_get_asset('sidebar/email-template.webp'); ?>">
|
||||
</div>
|
||||
|
||||
<p class="wu-text-gray-600 wu-p-0 wu-m-0">
|
||||
@ -470,7 +470,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Enqueue the base Dashboard Scripts
|
||||
*/
|
||||
@ -486,14 +486,14 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wu_get_template(
|
||||
'base/settings',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'classes' => '',
|
||||
'sections' => $this->get_sections(),
|
||||
'current_section' => $this->get_current_section(),
|
||||
'clickable_navigation' => $this->clickable_navigation,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -514,14 +514,14 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function default_handler() {
|
||||
public function default_handler(): void {
|
||||
|
||||
if ( ! current_user_can('wu_edit_settings')) {
|
||||
wp_die(__('You do not have the permissions required to change settings.', 'wp-ultimo'));
|
||||
}
|
||||
|
||||
if ( ! isset($_POST['active_gateways']) && wu_request('tab') === 'payment-gateways') {
|
||||
$_POST['active_gateways'] = array();
|
||||
$_POST['active_gateways'] = [];
|
||||
}
|
||||
|
||||
WP_Ultimo()->settings->save_settings($_POST);
|
||||
@ -537,7 +537,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function default_view() {
|
||||
public function default_view(): void {
|
||||
|
||||
$sections = $this->get_sections();
|
||||
|
||||
@ -552,15 +552,15 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
/*
|
||||
* Get Field to save
|
||||
*/
|
||||
$fields['save'] = array(
|
||||
$fields['save'] = [
|
||||
'type' => 'submit',
|
||||
'title' => __('Save Settings', 'wp-ultimo'),
|
||||
'classes' => 'button button-primary button-large wu-ml-auto wu-w-full md:wu-w-auto',
|
||||
'wrapper_classes' => 'wu-sticky wu-bottom-0 wu-save-button wu-mr-px wu-w-full md:wu-w-auto',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-on:click' => 'send("window", "wu_block_ui", "#wpcontent")',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if ( ! current_user_can('wu_edit_settings')) {
|
||||
$fields['save']['html_attr']['disabled'] = 'disabled';
|
||||
@ -569,17 +569,17 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
|
||||
$form = new Form(
|
||||
$section_slug,
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu--mt-5 wu--mx-in wu--mb-in',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-py-5 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => '',
|
||||
'data-on-load' => 'remove_block_ui',
|
||||
'data-wu-app' => str_replace('-', '_', $section_slug),
|
||||
'data-state' => json_encode(wu_array_map_keys('wu_replace_dashes', Settings::get_instance()->get_all(true))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
|
@ -71,9 +71,9 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Is this an old install migrating.
|
||||
@ -119,29 +119,29 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
$this->menu_icon = 'dashicons-wu-wp-ultimo';
|
||||
|
||||
add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
|
||||
add_action('admin_enqueue_scripts', [$this, 'register_scripts']);
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
add_action('admin_action_download_migration_logs', array($this, 'download_migration_logs'));
|
||||
add_action('admin_action_download_migration_logs', [$this, 'download_migration_logs']);
|
||||
|
||||
/*
|
||||
* Serve the installers
|
||||
*/
|
||||
add_action('wp_ajax_wu_setup_install', array($this, 'setup_install'));
|
||||
add_action('wp_ajax_wu_setup_install', [$this, 'setup_install']);
|
||||
|
||||
/*
|
||||
* Load installers
|
||||
*/
|
||||
add_action('wu_handle_ajax_installers', array(Core_Installer::get_instance(), 'handle'), 10, 3);
|
||||
add_action('wu_handle_ajax_installers', array(Default_Content_Installer::get_instance(), 'handle'), 10, 3);
|
||||
add_action('wu_handle_ajax_installers', array(Migrator::get_instance(), 'handle'), 10, 3);
|
||||
add_action('wu_handle_ajax_installers', [Core_Installer::get_instance(), 'handle'], 10, 3);
|
||||
add_action('wu_handle_ajax_installers', [Default_Content_Installer::get_instance(), 'handle'], 10, 3);
|
||||
add_action('wu_handle_ajax_installers', [Migrator::get_instance(), 'handle'], 10, 3);
|
||||
|
||||
/*
|
||||
* Redirect on activation
|
||||
*/
|
||||
add_action('wu_activation', array($this, 'redirect_to_wizard'));
|
||||
add_action('wu_activation', [$this, 'redirect_to_wizard']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.7
|
||||
* @return void
|
||||
*/
|
||||
public function download_migration_logs() {
|
||||
public function download_migration_logs(): void {
|
||||
|
||||
check_admin_referer('download_migration_logs', 'nonce');
|
||||
|
||||
@ -177,7 +177,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
parent::page_loaded();
|
||||
|
||||
@ -205,7 +205,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function set_settings() {
|
||||
public function set_settings(): void {
|
||||
|
||||
WP_Ultimo()->settings->default_sections();
|
||||
}
|
||||
@ -216,7 +216,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function redirect_to_wizard() {
|
||||
public function redirect_to_wizard(): void {
|
||||
|
||||
if ( ! \WP_Ultimo\Requirements::run_setup() && wu_request('page') !== 'wp-ultimo-setup') {
|
||||
wp_redirect(wu_network_admin_url('wp-ultimo-setup'));
|
||||
@ -231,7 +231,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function setup_install() {
|
||||
public function setup_install(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -279,7 +279,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function get_logo() {
|
||||
|
||||
return wu_get_asset('logo.png', 'img');
|
||||
return wu_get_asset('logo.webp', 'img');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,45 +312,45 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
$sections = array(
|
||||
'welcome' => array(
|
||||
$sections = [
|
||||
'welcome' => [
|
||||
'title' => __('Welcome', 'wp-ultimo'),
|
||||
'description' => implode(
|
||||
'<br><br>',
|
||||
array(
|
||||
[
|
||||
__('...and thanks for choosing WP Multisite WaaS!', 'wp-ultimo'),
|
||||
__('This quick setup wizard will make sure your server is correctly setup, help you configure your new network, and migrate data from previous WP Multisite WaaS versions if necessary.', 'wp-ultimo'),
|
||||
__('You will also have the option of importing default content. It should take 10 minutes or less!', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
),
|
||||
'next_label' => __('Get Started →', 'wp-ultimo'),
|
||||
'back' => false,
|
||||
),
|
||||
'checks' => array(
|
||||
],
|
||||
'checks' => [
|
||||
'title' => __('Pre-install Checks', 'wp-ultimo'),
|
||||
'description' => __('Now it is time to see if this machine has what it takes to run WP Multisite WaaS well!', 'wp-ultimo'),
|
||||
'next_label' => \WP_Ultimo\Requirements::met() ? __('Go to the Next Step →', 'wp-ultimo') : __('Check Again', 'wp-ultimo'),
|
||||
'handler' => array($this, 'handle_checks'),
|
||||
'handler' => [$this, 'handle_checks'],
|
||||
'back' => false,
|
||||
'fields' => array(
|
||||
'requirements' => array(
|
||||
'fields' => [
|
||||
'requirements' => [
|
||||
'type' => 'note',
|
||||
'desc' => array($this, 'renders_requirements_table'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'installation' => array(
|
||||
'desc' => [$this, 'renders_requirements_table'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'installation' => [
|
||||
'title' => __('Installation', 'wp-ultimo'),
|
||||
'description' => __('Now, let\'s update your database and install the Sunrise.php file, which are necessary for the correct functioning of WP Multisite WaaS.', 'wp-ultimo'),
|
||||
'next_label' => Core_Installer::get_instance()->all_done() ? __('Go to the Next Step →', 'wp-ultimo') : __('Install', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'terms' => array(
|
||||
'fields' => [
|
||||
'terms' => [
|
||||
'type' => 'note',
|
||||
'desc' => fn() => $this->render_installation_steps(Core_Installer::get_instance()->get_steps(), false),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/*
|
||||
* In case of migrations, add different sections.
|
||||
@ -374,19 +374,19 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$description = __('It seems that you were running WP Multisite WaaS 1.X on this network. This migrator will convert the data from the old version to the new one.', 'wp-ultimo') . '<br><br>' . __('First, let\'s run a test migration to see if we can spot any potential errors.', 'wp-ultimo');
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'migration' => array(
|
||||
$fields = [
|
||||
'migration' => [
|
||||
'type' => 'note',
|
||||
'desc' => fn() => $this->render_installation_steps(Migrator::get_instance()->get_steps(), false),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if ($errors) {
|
||||
$subject = 'Errors on migrating my network';
|
||||
|
||||
$user = wp_get_current_user();
|
||||
|
||||
$message_lines = array(
|
||||
$message_lines = [
|
||||
'Hi there,',
|
||||
sprintf('My name is %s.', $user->display_name),
|
||||
'I tried to migrate my network from version 1 to version 2, but was not able to do it successfully...',
|
||||
@ -394,7 +394,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
sprintf('```%s%s%s```', PHP_EOL, implode(PHP_EOL, $errors), PHP_EOL),
|
||||
sprintf('```%s%s%s```', PHP_EOL, $back_traces ? implode(PHP_EOL, $back_traces) : 'No backtraces found.', PHP_EOL),
|
||||
'Kind regards.',
|
||||
);
|
||||
];
|
||||
|
||||
$message = implode(PHP_EOL . PHP_EOL, $message_lines);
|
||||
|
||||
@ -410,10 +410,10 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-download wu-mr-2"></span>%1$s</a>',
|
||||
__('Download migration error log', 'wp-ultimo'),
|
||||
add_query_arg(
|
||||
array(
|
||||
[
|
||||
'action' => 'download_migration_logs',
|
||||
'nonce' => wp_create_nonce('download_migration_logs'),
|
||||
),
|
||||
],
|
||||
network_admin_url('admin.php')
|
||||
)
|
||||
);
|
||||
@ -422,11 +422,11 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'<br><a href="%2$s" class="wu-no-underline wu-text-red-500 wu-font-bold"><span class="dashicons-wu-back-in-time wu-mr-2"></span>%1$s</a>',
|
||||
__('Rollback to version 1.10.13', 'wp-ultimo'),
|
||||
add_query_arg(
|
||||
array(
|
||||
[
|
||||
'page' => 'wp-ultimo-rollback',
|
||||
'version' => '1.10.13',
|
||||
'type' => 'select-version',
|
||||
),
|
||||
],
|
||||
network_admin_url('admin.php')
|
||||
)
|
||||
);
|
||||
@ -434,57 +434,57 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
$error_list .= implode('<br>', $errors);
|
||||
|
||||
$fields = array_merge(
|
||||
array(
|
||||
'errors' => array(
|
||||
[
|
||||
'errors' => [
|
||||
'type' => 'note',
|
||||
'classes' => 'wu-flex-grow',
|
||||
'desc' => function () use ($error_list) {
|
||||
|
||||
/** Reset errors */
|
||||
Migrator::get_instance()->session->set('errors', array());
|
||||
Migrator::get_instance()->session->set('errors', []);
|
||||
|
||||
return sprintf('<div class="wu-mt-0 wu-p-4 wu-bg-red-100 wu-border wu-border-solid wu-border-red-200 wu-rounded-sm wu-text-red-500">%s</div>', $error_list);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
$fields
|
||||
);
|
||||
}
|
||||
|
||||
$sections['migration'] = array(
|
||||
$sections['migration'] = [
|
||||
'title' => __('Migration', 'wp-ultimo'),
|
||||
'description' => $description,
|
||||
'next_label' => $next_label,
|
||||
'skip' => false,
|
||||
'next' => $next,
|
||||
'handler' => array($this, 'handle_migration'),
|
||||
'handler' => [$this, 'handle_migration'],
|
||||
'fields' => $fields,
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$sections['your-company'] = array(
|
||||
$sections['your-company'] = [
|
||||
'title' => __('Your Company', 'wp-ultimo'),
|
||||
'description' => __('Before we move on, let\'s configure the basic settings of your network, shall we?', 'wp-ultimo'),
|
||||
'handler' => array($this, 'handle_save_settings'),
|
||||
'fields' => array($this, 'get_general_settings'),
|
||||
);
|
||||
'handler' => [$this, 'handle_save_settings'],
|
||||
'fields' => [$this, 'get_general_settings'],
|
||||
];
|
||||
|
||||
$sections['defaults'] = array(
|
||||
$sections['defaults'] = [
|
||||
'title' => __('Default Content', 'wp-ultimo'),
|
||||
'description' => __('Starting from scratch can be scarry, specially when first starting out. In this step, you can create default content to have a starting point for your network. Everything can be customized later.', 'wp-ultimo'),
|
||||
'next_label' => Default_Content_Installer::get_instance()->all_done() ? __('Go to the Next Step →', 'wp-ultimo') : __('Install', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'terms' => array(
|
||||
'fields' => [
|
||||
'terms' => [
|
||||
'type' => 'note',
|
||||
'desc' => fn() => $this->render_installation_steps(Default_Content_Installer::get_instance()->get_steps()),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$sections['done'] = array(
|
||||
$sections['done'] = [
|
||||
'title' => __('Ready!', 'wp-ultimo'),
|
||||
'view' => array($this, 'section_ready'),
|
||||
);
|
||||
'view' => [$this, 'section_ready'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow developers to add additional setup wizard steps.
|
||||
@ -514,23 +514,23 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
/*
|
||||
* Unset a couple of undesired settings
|
||||
*/
|
||||
$fields_to_unset = array(
|
||||
$fields_to_unset = [
|
||||
'error_reporting_header',
|
||||
'enable_error_reporting',
|
||||
'advanced_header',
|
||||
'uninstall_wipe_tables',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($fields_to_unset as $field_to_unset) {
|
||||
unset($general_fields[ $field_to_unset ]);
|
||||
}
|
||||
|
||||
// Adds a fake first field to bypass some styling issues with the top-border
|
||||
$fake_field = array(
|
||||
array(
|
||||
$fake_field = [
|
||||
[
|
||||
'type' => 'hidden',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields = array_merge($fake_field, $general_fields);
|
||||
|
||||
@ -549,9 +549,9 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
$payment_fields = \WP_Ultimo\Settings::get_instance()->get_section('payment-gateways')['fields'];
|
||||
|
||||
$fields_to_unset = array(
|
||||
$fields_to_unset = [
|
||||
'main_header',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($fields_to_unset as $field_to_unset) {
|
||||
unset($payment_fields[ $field_to_unset ]);
|
||||
@ -578,21 +578,21 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
wp_localize_script(
|
||||
'wu-setup-wizard',
|
||||
'wu_setup_settings',
|
||||
array(
|
||||
[
|
||||
'dry_run' => wu_request('dry-run', true),
|
||||
'generic_error_message' => __('A server error happened while processing this item.', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-setup-wizard');
|
||||
|
||||
return wu_get_template_contents(
|
||||
'wizards/setup/installation_steps',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
'steps' => $steps,
|
||||
'checks' => $checks,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -617,8 +617,8 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
global $wp_version;
|
||||
|
||||
$requirements = array(
|
||||
'php' => array(
|
||||
$requirements = [
|
||||
'php' => [
|
||||
'name' => __('PHP', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('wp-ultimo-requirements'),
|
||||
'required_version' => \WP_Ultimo\Requirements::$php_version,
|
||||
@ -626,8 +626,8 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'installed_version' => phpversion(),
|
||||
'pass_requirements' => version_compare(phpversion(), \WP_Ultimo\Requirements::$php_version, '>='),
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$php_recommended_version, '>='),
|
||||
),
|
||||
'wordpress' => array(
|
||||
],
|
||||
'wordpress' => [
|
||||
'name' => __('WordPress', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('wp-ultimo-requirements'),
|
||||
'required_version' => \WP_Ultimo\Requirements::$wp_version,
|
||||
@ -635,36 +635,36 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'installed_version' => $wp_version,
|
||||
'pass_requirements' => version_compare(phpversion(), \WP_Ultimo\Requirements::$wp_version, '>='),
|
||||
'pass_recommendation' => version_compare(phpversion(), \WP_Ultimo\Requirements::$wp_recommended_version, '>='),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$plugin_requirements = array(
|
||||
'multisite' => array(
|
||||
$plugin_requirements = [
|
||||
'multisite' => [
|
||||
'name' => __('WordPress Multisite', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('wp-ultimo-requirements'),
|
||||
'condition' => __('Installed & Activated', 'wp-ultimo'),
|
||||
'pass_requirements' => is_multisite(),
|
||||
),
|
||||
'wp-ultimo' => array(
|
||||
],
|
||||
'wp-ultimo' => [
|
||||
'name' => __('WP Multisite WaaS', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('wp-ultimo-requirements'),
|
||||
'condition' => apply_filters('wp_ultimo_skip_network_active_check', false) ? __('Bypassed via filter', 'wp-ultimo') : __('Network Activated', 'wp-ultimo'),
|
||||
'pass_requirements' => \WP_Ultimo\Requirements::is_network_active(),
|
||||
),
|
||||
'wp-cron' => array(
|
||||
],
|
||||
'wp-cron' => [
|
||||
'name' => __('WordPress Cron', 'wp-ultimo'),
|
||||
'help' => wu_get_documentation_url('wp-ultimo-requirements'),
|
||||
'condition' => __('Activated', 'wp-ultimo'),
|
||||
'pass_requirements' => \WP_Ultimo\Requirements::check_wp_cron(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return wu_get_template_contents(
|
||||
'wizards/setup/requirements_table',
|
||||
array(
|
||||
[
|
||||
'requirements' => $requirements,
|
||||
'plugin_requirements' => $plugin_requirements,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -674,7 +674,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_ready() {
|
||||
public function section_ready(): void {
|
||||
|
||||
update_network_option(null, 'wu_setup_finished', true);
|
||||
|
||||
@ -689,18 +689,18 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
|
||||
wu_enqueue_async_action(
|
||||
'wu_async_take_screenshot',
|
||||
array(
|
||||
[
|
||||
'site_id' => wu_get_main_site_id(),
|
||||
),
|
||||
],
|
||||
'site'
|
||||
);
|
||||
|
||||
wu_get_template(
|
||||
'wizards/setup/ready',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -710,7 +710,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_checks() {
|
||||
public function handle_checks(): void {
|
||||
|
||||
if (\WP_Ultimo\Requirements::met() === false) {
|
||||
wp_redirect(add_query_arg());
|
||||
@ -729,7 +729,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save_settings() {
|
||||
public function handle_save_settings(): void {
|
||||
|
||||
$this->set_settings();
|
||||
|
||||
@ -758,7 +758,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_migration() {
|
||||
public function handle_migration(): void {
|
||||
|
||||
$dry_run = wu_request('dry-run', true);
|
||||
|
||||
@ -783,7 +783,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_configuration() {
|
||||
public function handle_configuration(): void {
|
||||
|
||||
if ($_POST['submit'] === '1') {
|
||||
$this->integration->setup_constants($_POST);
|
||||
@ -803,17 +803,17 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function section_test() {
|
||||
public function section_test(): void {
|
||||
|
||||
wp_enqueue_script('wu-vue');
|
||||
|
||||
wu_get_template(
|
||||
'wizards/host-integrations/test',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'integration' => $this->integration,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -823,12 +823,12 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
if (WP_Ultimo()->is_loaded() === false) {
|
||||
wp_enqueue_style('wu-styling', wu_get_asset('framework.css', 'css'), false, wu_get_version());
|
||||
|
||||
wp_enqueue_style('wu-admin', wu_get_asset('admin.css', 'css'), array('wu-styling'), wu_get_version());
|
||||
wp_enqueue_style('wu-admin', wu_get_asset('admin.css', 'css'), ['wu-styling'], wu_get_version());
|
||||
|
||||
/*
|
||||
* Adds tipTip
|
||||
@ -838,9 +838,9 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
/*
|
||||
* Adds jQueryBlockUI
|
||||
*/
|
||||
wp_enqueue_script('wu-block-ui', wu_get_asset('lib/jquery.blockUI.js', 'js'), array('jquery'));
|
||||
wp_enqueue_script('wu-block-ui', wu_get_asset('lib/jquery.blockUI.js', 'js'), ['jquery']);
|
||||
|
||||
wp_register_script('wu-fields', wu_get_asset('fields.js', 'js'), array('jquery'));
|
||||
wp_register_script('wu-fields', wu_get_asset('fields.js', 'js'), ['jquery']);
|
||||
|
||||
/*
|
||||
* Localize components
|
||||
@ -848,22 +848,22 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
wp_localize_script(
|
||||
'wu-fields',
|
||||
'wu_fields',
|
||||
array(
|
||||
'l10n' => array(
|
||||
[
|
||||
'l10n' => [
|
||||
'image_picker_title' => __('Select an Image.', 'wp-ultimo'),
|
||||
'image_picker_button_text' => __('Use this image', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_register_script('wu-functions', wu_get_asset('functions.js', 'js'), array('jquery'));
|
||||
wp_register_script('wu-functions', wu_get_asset('functions.js', 'js'), ['jquery']);
|
||||
|
||||
wp_register_script('wubox', wu_get_asset('wubox.js', 'js'), array('wu-functions'));
|
||||
wp_register_script('wubox', wu_get_asset('wubox.js', 'js'), ['wu-functions']);
|
||||
|
||||
wp_localize_script(
|
||||
'wubox',
|
||||
'wuboxL10n',
|
||||
array(
|
||||
[
|
||||
'next' => __('Next >'),
|
||||
'prev' => __('< Prev'),
|
||||
'image' => __('Image'),
|
||||
@ -871,17 +871,17 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
'close' => __('Close'),
|
||||
'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
|
||||
'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_add_inline_script('wu-setup-wizard-polyfill', 'document.addEventListener("DOMContentLoaded", () => wu_initialize_imagepicker());', 'after');
|
||||
}
|
||||
|
||||
wp_enqueue_script('wu-setup-wizard-polyfill', wu_get_asset('setup-wizard-polyfill.js', 'js'), array('jquery', 'wu-fields', 'wu-functions', 'wubox'), wu_get_version());
|
||||
wp_enqueue_script('wu-setup-wizard-polyfill', wu_get_asset('setup-wizard-polyfill.js', 'js'), ['jquery', 'wu-fields', 'wu-functions', 'wubox'], wu_get_version());
|
||||
|
||||
wp_enqueue_media();
|
||||
|
||||
wp_register_script('wu-setup-wizard', wu_get_asset('setup-wizard.js', 'js'), array('jquery'), wu_get_version());
|
||||
wp_register_script('wu-setup-wizard', wu_get_asset('setup-wizard.js', 'js'), ['jquery'], wu_get_version());
|
||||
|
||||
wp_add_inline_style(
|
||||
'wu-admin',
|
||||
@ -891,7 +891,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
background: url("%s") right bottom no-repeat;
|
||||
background-size: 90%%;
|
||||
}',
|
||||
wu_get_asset('bg-setup.png', 'img')
|
||||
wu_get_asset('bg-setup.webp', 'img')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to add further initializations.
|
||||
@ -78,7 +78,7 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
parent::init();
|
||||
}
|
||||
@ -122,16 +122,16 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
wu_get_template(
|
||||
'shortcodes/shortcodes',
|
||||
array(
|
||||
[
|
||||
'screen' => $screen,
|
||||
'data' => $this->get_data(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$elements = Base_Element::get_public_elements();
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$defaults = $element->defaults();
|
||||
@ -162,7 +162,7 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
$params[ $key ]['options'] = '0 | 1';
|
||||
break;
|
||||
case 'select':
|
||||
$params[ $key ]['options'] = implode(' | ', array_keys(wu_get_isset($value, 'options', array())));
|
||||
$params[ $key ]['options'] = implode(' | ', array_keys(wu_get_isset($value, 'options', [])));
|
||||
break;
|
||||
case 'int':
|
||||
$params[ $key ]['options'] = __('integer', 'wp-ultimo');
|
||||
@ -184,17 +184,17 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$id = $element->get_id();
|
||||
|
||||
if (strncmp((string) $id, 'wp-ultimo/', strlen('wp-ultimo/')) === 0) {
|
||||
if (str_starts_with((string) $id, 'wp-ultimo/')) {
|
||||
$id = substr((string) $element->get_id(), strlen('wp-ultimo/'));
|
||||
}
|
||||
|
||||
$data[] = array(
|
||||
$data[] = [
|
||||
'generator_form_url' => wu_get_form_url("shortcode_{$id}"),
|
||||
'title' => $element->get_title(),
|
||||
'shortcode' => $element->get_shortcode_id(),
|
||||
'description' => $element->get_description(),
|
||||
'params' => $params,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -77,9 +77,9 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_sites',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Registers the necessary scripts and styles for this admin page.
|
||||
@ -87,11 +87,11 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
WP_Ultimo()->scripts->register_script('wu-screenshot-scraper', wu_get_asset('screenshot-scraper.js', 'js'), array('jquery'));
|
||||
WP_Ultimo()->scripts->register_script('wu-screenshot-scraper', wu_get_asset('screenshot-scraper.js', 'js'), ['jquery']);
|
||||
|
||||
wp_enqueue_script('wu-screenshot-scraper');
|
||||
|
||||
@ -106,17 +106,17 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Transfer site - Confirmation modal
|
||||
*/
|
||||
wu_register_form(
|
||||
'transfer_site',
|
||||
array(
|
||||
'render' => array($this, 'render_transfer_site_modal'),
|
||||
'handler' => array($this, 'handle_transfer_site_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_transfer_site_modal'],
|
||||
'handler' => [$this, 'handle_transfer_site_modal'],
|
||||
'capability' => 'wu_transfer_sites',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -125,12 +125,12 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
add_filter(
|
||||
'wu_data_json_success_delete_site_modal',
|
||||
fn($data_json) => array(
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-sites', array('deleted' => 1)),
|
||||
)
|
||||
fn($data_json) => [
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-sites', ['deleted' => 1]),
|
||||
]
|
||||
);
|
||||
|
||||
add_filter("wu_page_{$this->id}_load", array($this, 'add_new_site_template_warning_message'));
|
||||
add_filter("wu_page_{$this->id}_load", [$this, 'add_new_site_template_warning_message']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_new_site_template_warning_message() {
|
||||
public function add_new_site_template_warning_message(): void {
|
||||
|
||||
if (wu_request('wu-new-model')) {
|
||||
if ( ! $this->get_object() || $this->get_object()->get_type() !== Site_Type::SITE_TEMPLATE) {
|
||||
@ -148,28 +148,28 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
\WP_Ultimo\UI\Tours::get_instance()->create_tour(
|
||||
'new_site_template_warning',
|
||||
array(
|
||||
array(
|
||||
[
|
||||
[
|
||||
'id' => 'new-site-template-warning',
|
||||
'title' => __('On adding a new Site Template...', 'wp-ultimo'),
|
||||
'text' => array(
|
||||
'text' => [
|
||||
__("You just successfully added a new site template to your WP Multisite WaaS network and that's awesome!", 'wp-ultimo'),
|
||||
__('Keep in mind that newly created site templates do not appear automatically in your checkout forms.', 'wp-ultimo'),
|
||||
__('To make a site template available on registration, you will need to manually add it to the template selection field of your checkout forms.', 'wp-ultimo'),
|
||||
),
|
||||
'buttons' => array(
|
||||
array(
|
||||
],
|
||||
'buttons' => [
|
||||
[
|
||||
'classes' => 'button wu-text-xs sm:wu-normal-case wu-float-left',
|
||||
'text' => __('Go to Checkout Forms', 'wp-ultimo'),
|
||||
'url' => wu_network_admin_url('wp-ultimo-checkout-forms'),
|
||||
),
|
||||
),
|
||||
'attachTo' => array(
|
||||
],
|
||||
],
|
||||
'attachTo' => [
|
||||
'element' => '#message.updated',
|
||||
'on' => 'top',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
function render_transfer_site_modal() {
|
||||
function render_transfer_site_modal(): void {
|
||||
|
||||
$site = wu_get_site(wu_request('id'));
|
||||
|
||||
@ -188,52 +188,52 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'confirm' => array(
|
||||
$fields = [
|
||||
'confirm' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Confirm Transfer', 'wp-ultimo'),
|
||||
'desc' => __('This will start the transfer of assets from one membership to another.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'confirmed',
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Start Transfer', 'wp-ultimo'),
|
||||
'placeholder' => __('Start Transfer', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => '!confirmed',
|
||||
),
|
||||
),
|
||||
'id' => array(
|
||||
],
|
||||
],
|
||||
'id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => $site->get_id(),
|
||||
),
|
||||
'target_membership_id' => array(
|
||||
],
|
||||
'target_membership_id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => wu_request('target_membership_id'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'total-actions',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'transfer_site',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'confirmed' => false,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -245,7 +245,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_transfer_site_modal() {
|
||||
public function handle_transfer_site_modal(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -274,15 +274,15 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-site',
|
||||
array(
|
||||
[
|
||||
'id' => $site->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
@ -304,73 +304,73 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$this->add_fields_widget(
|
||||
'at_a_glance',
|
||||
array(
|
||||
[
|
||||
'title' => __('At a Glance', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'classes' => 'wu-overflow-hidden wu-m-0 wu--mt-1 wu--mx-3 wu--mb-3',
|
||||
'field_wrapper_classes' => 'wu-w-1/4 wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t-0 wu-border-l-0 wu-border-r wu-border-b-0 wu-border-gray-300 wu-border-solid wu-float-left wu-relative',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'margin-top: -6px;',
|
||||
),
|
||||
'fields' => array(
|
||||
'type' => array(
|
||||
],
|
||||
'fields' => [
|
||||
'type' => [
|
||||
'type' => 'text-display',
|
||||
'title' => __('Site Type', 'wp-ultimo'),
|
||||
'display_value' => $tag,
|
||||
'tooltip' => '',
|
||||
),
|
||||
'id' => array(
|
||||
],
|
||||
'id' => [
|
||||
'type' => 'text-display',
|
||||
'copy' => true,
|
||||
'title' => __('Site ID', 'wp-ultimo'),
|
||||
'display_value' => $this->get_object()->get_id(),
|
||||
'tooltip' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'description',
|
||||
array(
|
||||
[
|
||||
'title' => __('Description', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'fields' => array(
|
||||
'description' => array(
|
||||
'fields' => [
|
||||
'description' => [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Site Description', 'wp-ultimo'),
|
||||
'placeholder' => __('Tell your customers what this site is about.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_option_blogdescription(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'rows' => 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_tabs_widget(
|
||||
'options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Site Options', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'sections' => $this->get_site_option_sections(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'domains',
|
||||
array(
|
||||
[
|
||||
'title' => __('Mapped Domains', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Sites_Domain_List_Table(),
|
||||
'query_filter' => array($this, 'domain_query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'domain_query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($this->get_object()->get_type() === 'customer_owned') {
|
||||
$this->add_list_table_widget(
|
||||
'membership',
|
||||
array(
|
||||
[
|
||||
'title' => __('Linked Membership', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Customers_Membership_List_Table(),
|
||||
'query_filter' => function ($query) {
|
||||
@ -379,12 +379,12 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
return $query;
|
||||
},
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'customer',
|
||||
array(
|
||||
[
|
||||
'title' => __('Linked Customer', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Site_Customer_List_Table(),
|
||||
'query_filter' => function ($query) {
|
||||
@ -393,17 +393,17 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
return $query;
|
||||
},
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'events',
|
||||
array(
|
||||
[
|
||||
'title' => __('Events', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Inside_Events_List_Table(),
|
||||
'query_filter' => array($this, 'query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
$membership_selected = $this->get_object()->get_membership() ? $this->get_object()->get_membership()->to_search_results() : '';
|
||||
@ -411,180 +411,180 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$this->add_fields_widget(
|
||||
'save',
|
||||
array(
|
||||
'html_attr' => array(
|
||||
[
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'site_type',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'type' => $this->get_object()->get_type(),
|
||||
'original_membership_id' => $this->get_object()->get_membership_id(),
|
||||
'membership_id' => $this->get_object()->get_membership_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
'fields' => array(
|
||||
],
|
||||
'fields' => [
|
||||
// Fields for price
|
||||
'type_main' => array(
|
||||
'type_main' => [
|
||||
'type' => 'text-display',
|
||||
'title' => __('Site Type', 'wp-ultimo'),
|
||||
'display_value' => __('Main Site', 'wp-ultimo'),
|
||||
'tooltip' => __('You can\'t change the main site type.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
'v-show' => 'type === "main"',
|
||||
),
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Site Type', 'wp-ultimo'),
|
||||
'placeholder' => __('Select Site Type', 'wp-ultimo'),
|
||||
'desc' => __('Different site types have different options and settings.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_type(),
|
||||
'tooltip' => '',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'default' => __('Regular WordPress', 'wp-ultimo'),
|
||||
'site_template' => __('Site Template', 'wp-ultimo'),
|
||||
'customer_owned' => __('Customer-owned', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => '1',
|
||||
'v-show' => 'type !== "main"',
|
||||
),
|
||||
),
|
||||
'categories' => array(
|
||||
],
|
||||
],
|
||||
'categories' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Template Categories', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g.: Landing Page, Health...', 'wp-ultimo'),
|
||||
'desc' => __('Customers will be able to filter by categories during signup.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_categories(),
|
||||
'options' => Site::get_all_categories(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-selectize-categories' => 1,
|
||||
'multiple' => 1,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "type === 'site_template'",
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
],
|
||||
'membership_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Associated Membership', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Membership...', 'wp-ultimo'),
|
||||
'desc' => __('The membership that owns this site.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_membership_id(),
|
||||
'tooltip' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "type === 'customer_owned'",
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'data-model' => 'membership',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'reference_code',
|
||||
'data-search-field' => 'reference_code',
|
||||
'data-max-items' => 1,
|
||||
'data-selected' => json_encode($membership_selected),
|
||||
),
|
||||
),
|
||||
'transfer_note' => array(
|
||||
],
|
||||
],
|
||||
'transfer_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('Changing the membership will transfer the site and all its assets to the new membership.', 'wp-ultimo'),
|
||||
'classes' => 'wu-p-2 wu-bg-red-100 wu-text-red-600 wu-rounded wu-w-full',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => '(original_membership_id != membership_id) && membership_id',
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
),
|
||||
'submit_save' => array(
|
||||
],
|
||||
],
|
||||
'submit_save' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Save Site', 'wp-ultimo'),
|
||||
'placeholder' => __('Save Site', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'original_membership_id == membership_id || !membership_id',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
'transfer' => array(
|
||||
],
|
||||
],
|
||||
'transfer' => [
|
||||
'type' => 'link',
|
||||
'display_value' => __('Transfer Site', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-bg-gray-200',
|
||||
'classes' => 'button wubox wu-w-full wu-text-center',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'original_membership_id != membership_id && membership_id',
|
||||
'v-cloak' => '1',
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-bind:href' => "'" . wu_get_form_url(
|
||||
'transfer_site',
|
||||
array(
|
||||
[
|
||||
'id' => $this->get_object()->get_id(),
|
||||
'target_membership_id' => '',
|
||||
)
|
||||
]
|
||||
) . "=' + membership_id",
|
||||
'title' => __('Transfer Site', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'active',
|
||||
array(
|
||||
[
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'active' => array(
|
||||
'fields' => [
|
||||
'active' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to manually enable or disable this site.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_active(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'image',
|
||||
array(
|
||||
[
|
||||
'title' => __('Site Image', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'featured_image_id' => array(
|
||||
'fields' => [
|
||||
'featured_image_id' => [
|
||||
'type' => 'image',
|
||||
'stacked' => true,
|
||||
'title' => __('Site Image', 'wp-ultimo'),
|
||||
'desc' => __('This image is used on lists of sites and other places. It can be automatically generated by the screenshot scraper.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_featured_image_id(),
|
||||
'img' => $this->get_object()->get_featured_image(),
|
||||
),
|
||||
'scraper_note' => array(
|
||||
],
|
||||
'scraper_note' => [
|
||||
'type' => 'note',
|
||||
'desc' => __('You need to save the site for the change to take effect.', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-hidden wu-scraper-note',
|
||||
),
|
||||
'scraper_error' => array(
|
||||
],
|
||||
'scraper_error' => [
|
||||
'type' => 'note',
|
||||
'desc' => '<span class="wu-scraper-error-message wu-p-2 wu-bg-red-100 wu-text-red-600 wu-rounded wu-block"></span>',
|
||||
'wrapper_classes' => 'wu-hidden wu-scraper-error',
|
||||
),
|
||||
'scraper_message' => array(
|
||||
],
|
||||
'scraper_message' => [
|
||||
'type' => 'note',
|
||||
'desc' => sprintf('<span class="wu-p-2 wu-bg-red-100 wu-text-red-600 wu-rounded wu-block">%s</span>', __('We detected that this network might be running locally. If that\'s the case, WP Multisite WaaS will not be able to take a screenshot of the site. A site needs to be publicly available to the outside world in order for this feature to work.', 'wp-ultimo')),
|
||||
'wrapper_classes' => \WP_Ultimo\Domain_Mapping\Helper::is_development_mode() ? '' : 'wu-hidden',
|
||||
),
|
||||
'scraper' => array(
|
||||
],
|
||||
'scraper' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Take Screenshot', 'wp-ultimo'),
|
||||
'title' => __('Take Screenshot', 'wp-ultimo'),
|
||||
'classes' => 'button wu-w-full',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -600,7 +600,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
protected function get_site_option_sections() {
|
||||
|
||||
$sections = array();
|
||||
$sections = [];
|
||||
|
||||
$sections = apply_filters('wu_site_options_sections', $sections, $this->get_object());
|
||||
|
||||
@ -637,23 +637,23 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'url' => network_admin_url('site-settings.php?id=' . $this->get_object()->get_id()),
|
||||
'label' => __('Go to the Default Edit Screen', 'wp-ultimo'),
|
||||
'icon' => 'wu-cog',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => get_site_url($this->get_object()->get_id()),
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'icon' => 'wu-link',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'url' => get_admin_url($this->get_object()->get_id()),
|
||||
'label' => __('Dashboard', 'wp-ultimo'),
|
||||
'icon' => 'dashboard',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -664,7 +664,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Site', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Site', 'wp-ultimo'),
|
||||
'updated_message' => __('Site updated with success!', 'wp-ultimo'),
|
||||
@ -674,7 +674,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Site', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -687,9 +687,9 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function domain_query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'blog_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -704,10 +704,10 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'site',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -756,7 +756,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function handle_save() {
|
||||
|
||||
$_POST['categories'] = wu_get_isset($_POST, 'categories', array());
|
||||
$_POST['categories'] = wu_get_isset($_POST, 'categories', []);
|
||||
|
||||
if ($_POST['type'] !== Site_Type::CUSTOMER_OWNED) {
|
||||
$_POST['membership_id'] = false;
|
||||
|
@ -50,9 +50,9 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_sites',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Register ajax forms that we use for sites.
|
||||
@ -60,17 +60,17 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Edit/Add New Site
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_site',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_site_modal'),
|
||||
'handler' => array($this, 'handle_add_new_site_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_site_modal'],
|
||||
'handler' => [$this, 'handle_add_new_site_modal'],
|
||||
'capability' => 'wu_add_sites',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -78,14 +78,14 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
wu_register_form(
|
||||
'publish_pending_site',
|
||||
array(
|
||||
'render' => array($this, 'render_publish_pending_site_modal'),
|
||||
'handler' => array($this, 'handle_publish_pending_site_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_publish_pending_site_modal'],
|
||||
'handler' => [$this, 'handle_publish_pending_site_modal'],
|
||||
'capability' => 'wu_publish_sites',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
add_action('wu_handle_bulk_action_form_site_screenshot', array($this, 'handle_bulk_screenshots'), 10, 3);
|
||||
add_action('wu_handle_bulk_action_form_site_screenshot', [$this, 'handle_bulk_screenshots'], 10, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,16 +98,16 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @param array $ids The ids list.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_bulk_screenshots($action, $model, $ids) {
|
||||
public function handle_bulk_screenshots($action, $model, $ids): void {
|
||||
|
||||
$item_ids = array_filter($ids);
|
||||
|
||||
foreach ($item_ids as $item_id) {
|
||||
wu_enqueue_async_action(
|
||||
'wu_async_take_screenshot',
|
||||
array(
|
||||
[
|
||||
'site_id' => $item_id,
|
||||
),
|
||||
],
|
||||
'site'
|
||||
);
|
||||
}
|
||||
@ -119,7 +119,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_publish_pending_site_modal() {
|
||||
public function render_publish_pending_site_modal(): void {
|
||||
|
||||
$membership = wu_get_membership(wu_request('membership_id'));
|
||||
|
||||
@ -127,52 +127,52 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'confirm' => array(
|
||||
$fields = [
|
||||
'confirm' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Confirm Publication', 'wp-ultimo'),
|
||||
'desc' => __('This action can not be undone.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'confirmed',
|
||||
),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Publish', 'wp-ultimo'),
|
||||
'placeholder' => __('Publish', 'wp-ultimo'),
|
||||
'value' => 'publish',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => '!confirmed',
|
||||
),
|
||||
),
|
||||
'wu-when' => array(
|
||||
],
|
||||
],
|
||||
'wu-when' => [
|
||||
'type' => 'hidden',
|
||||
'value' => base64_encode('init'),
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'type' => 'hidden',
|
||||
'value' => $membership->get_id(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'total-actions',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'true',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'confirmed' => false,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -184,7 +184,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_publish_pending_site_modal() {
|
||||
public function handle_publish_pending_site_modal(): void {
|
||||
|
||||
$membership = wu_get_membership(wu_request('membership_id'));
|
||||
|
||||
@ -216,14 +216,14 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
[
|
||||
'id' => $pending_site->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -248,17 +248,17 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
$path = $d->path;
|
||||
}
|
||||
|
||||
$atts = array(
|
||||
$atts = [
|
||||
'domain' => $domain,
|
||||
'path' => $path,
|
||||
'title' => wu_request('title'),
|
||||
'type' => wu_request('type'),
|
||||
'template_id' => wu_request('template_site', 0),
|
||||
'membership_id' => wu_request('membership_id', false),
|
||||
'duplication_arguments' => array(
|
||||
'duplication_arguments' => [
|
||||
'copy_media' => wu_request('copy_media'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$site = wu_create_site($atts);
|
||||
|
||||
@ -275,16 +275,16 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
[
|
||||
'id' => $site->get_id(),
|
||||
'wu-new-model' => 1,
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_add_new_site_modal() {
|
||||
public function render_add_new_site_modal(): void {
|
||||
|
||||
global $current_site;
|
||||
|
||||
@ -323,11 +323,11 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
|
||||
$save_label = $duplicate_id ? __('Duplicate Site', 'wp-ultimo') : __('Add new Site', 'wp-ultimo');
|
||||
|
||||
$options = array(
|
||||
$options = [
|
||||
'sub-domain' => __('Subdomain', 'wp-ultimo'),
|
||||
'sub-directory' => __('Subdirectory', 'wp-ultimo'),
|
||||
'domain' => __('Domain', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Only keep the tab that correspond to the install type.
|
||||
@ -338,137 +338,137 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
unset($options['sub-domain']);
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'tab' => array(
|
||||
$fields = [
|
||||
'tab' => [
|
||||
'type' => 'tab-select',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'tab',
|
||||
),
|
||||
],
|
||||
'options' => $options,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Site Title', 'wp-ultimo'),
|
||||
'placeholder' => __('New Network Site', 'wp-ultimo'),
|
||||
'value' => $title,
|
||||
),
|
||||
'domain_group' => array(
|
||||
],
|
||||
'domain_group' => [
|
||||
'type' => 'group',
|
||||
// translators: the %s is the site preview url.
|
||||
'desc' => sprintf(__('The site URL will be: %s', 'wp-ultimo'), '<span class="wu-font-mono">{{ tab === "domain" ? domain : ( tab === "sub-directory" ? scheme + base_url + domain : scheme + domain + "." + base_url ) }}</span>'),
|
||||
'fields' => array(
|
||||
'domain' => array(
|
||||
'fields' => [
|
||||
'domain' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Site Domain/Path', 'wp-ultimo'),
|
||||
'tooltip' => __('Enter the complete domain for the site', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-w-full',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:placeholder' => 'tab === "domain" ? "mysite.com" : "mysite"',
|
||||
'v-on:input' => 'domain = tab === "domain" ? $event.target.value.toLowerCase().replace(/[^a-z0-9-.-]+/g, "") : $event.target.value.toLowerCase().replace(/[^a-z0-9-]+/g, "")',
|
||||
'v-bind:value' => 'domain',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Site Type', 'wp-ultimo'),
|
||||
'value' => $type,
|
||||
'placeholder' => '',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'default' => __('Regular WP Site', 'wp-ultimo'),
|
||||
'site_template' => __('Site Template', 'wp-ultimo'),
|
||||
'customer_owned' => __('Customer-Owned', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'type',
|
||||
),
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
],
|
||||
'membership_id' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Associated Membership', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Membership...', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'tooltip' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => "type === 'customer_owned'",
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'data-model' => 'membership',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'reference_code',
|
||||
'data-search-field' => 'reference_code',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
),
|
||||
'copy' => array(
|
||||
],
|
||||
],
|
||||
'copy' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Copy Site', 'wp-ultimo'),
|
||||
'desc' => __('Select an existing site to use as a starting point.', 'wp-ultimo'),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'copy',
|
||||
),
|
||||
),
|
||||
'template_site' => array(
|
||||
],
|
||||
],
|
||||
'template_site' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Template Site', 'wp-ultimo'),
|
||||
'placeholder' => __('Search Sites...', 'wp-ultimo'),
|
||||
'desc' => __('The site selected will be copied and used as a starting point.', 'wp-ultimo'),
|
||||
'value' => $template_id,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'site',
|
||||
'data-selected' => $site ? json_encode($site->to_search_results()) : '',
|
||||
'data-value-field' => 'blog_id',
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'copy',
|
||||
),
|
||||
),
|
||||
'copy_media' => array(
|
||||
],
|
||||
],
|
||||
'copy_media' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Copy Media on Duplication', 'wp-ultimo'),
|
||||
'desc' => __('Copy media files from the template site on duplication. Disabling this can lead to broken images on the new site.', 'wp-ultimo'),
|
||||
'value' => true,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'copy',
|
||||
),
|
||||
),
|
||||
'wu-when' => array(
|
||||
],
|
||||
],
|
||||
'wu-when' => [
|
||||
'type' => 'hidden',
|
||||
'value' => base64_encode('init'),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => $save_label,
|
||||
'placeholder' => $save_label,
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end wu-text-right',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-bind:disabled' => 'install_type !== tab && tab !== "domain"',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$d = wu_get_site_domain_and_path('replace');
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'add_new_site',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'add_new_site',
|
||||
'data-state' => wu_convert_to_state(
|
||||
array(
|
||||
[
|
||||
'tab' => is_subdomain_install() ? 'sub-domain' : 'sub-directory',
|
||||
'install_type' => is_subdomain_install() ? 'sub-domain' : 'sub-directory',
|
||||
'membership' => $membership_id,
|
||||
@ -477,10 +477,10 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
'base_url' => str_replace('replace.', '', (string) $d->domain) . '/',
|
||||
'scheme' => is_ssl() ? 'https://' : 'http://',
|
||||
'domain' => $path,
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -502,10 +502,10 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Site removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Site', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,14 +549,14 @@ class Site_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add Site'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_site'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,9 +68,9 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to add further initializations.
|
||||
@ -78,9 +78,9 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_action('wp_ajax_wu_generate_text_file_system_info', array($this, 'generate_text_file_system_info'));
|
||||
add_action('wp_ajax_wu_generate_text_file_system_info', [$this, 'generate_text_file_system_info']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
wp_enqueue_script('dashboard');
|
||||
|
||||
@ -102,7 +102,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
@ -129,16 +129,16 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $data Data.
|
||||
* @return void
|
||||
*/
|
||||
public function output_table_system_info($data) {
|
||||
public function output_table_system_info($data): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
wu_get_template(
|
||||
'system-info/system-info-table',
|
||||
array(
|
||||
[
|
||||
'data' => $data,
|
||||
'screen' => $screen,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -181,16 +181,16 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
wu_get_template(
|
||||
'system-info/system-info',
|
||||
array(
|
||||
[
|
||||
'data' => $this->get_data(),
|
||||
'screen' => $screen,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -224,9 +224,9 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$all_options_bytes = round(mb_strlen($all_options_serialized, '8bit') / 1024, 2);
|
||||
$all_options_transients = $this->get_transients_in_options($all_options);
|
||||
|
||||
$array_active_plugins = array();
|
||||
$array_active_plugins = [];
|
||||
|
||||
$array_constants_options = array(
|
||||
$array_constants_options = [
|
||||
'SAVEQUERIES',
|
||||
'WP_DEBUG',
|
||||
'WP_DEBUG_DISPLAY',
|
||||
@ -235,16 +235,16 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
'SCRIPT_DEBUG',
|
||||
'WP_ENV',
|
||||
'NOBLOGREDIRECT',
|
||||
);
|
||||
];
|
||||
|
||||
$array_constants = array();
|
||||
$array_constants = [];
|
||||
|
||||
foreach ($array_constants_options as $constant) {
|
||||
$array_constants[] = array(
|
||||
$array_constants[] = [
|
||||
'tooltip' => '',
|
||||
'title' => $constant,
|
||||
'value' => defined($constant) ? (is_bool(constant($constant)) ? __('Enabled', 'wp-ultimo') : constant($constant)) : __('Disabled', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($plugins as $plugin_path => $plugin) {
|
||||
@ -255,15 +255,15 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$plugin_uri = ' (' . $plugin['PluginURI'] . ')';
|
||||
}
|
||||
|
||||
$array_active_plugins[] = array(
|
||||
$array_active_plugins[] = [
|
||||
'tooltip' => '',
|
||||
'title' => $plugin['Name'],
|
||||
'value' => $plugin['Version'] . $plugin_uri,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$array_active_plugins_main_site = array();
|
||||
$array_active_plugins_main_site = [];
|
||||
|
||||
foreach ($plugins as $plugin_path => $plugin) {
|
||||
if (in_array($plugin_path, $active_plugins_main_site, true)) {
|
||||
@ -273,263 +273,263 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$plugin_uri = ' (' . $plugin['PluginURI'] . ')';
|
||||
}
|
||||
|
||||
$array_active_plugins_main_site[] = array(
|
||||
$array_active_plugins_main_site[] = [
|
||||
'tooltip' => '',
|
||||
'title' => $plugin['Name'],
|
||||
'value' => $plugin['Version'] . $plugin_uri,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$wpultimo_settings = array();
|
||||
$wpultimo_settings = [];
|
||||
|
||||
foreach ($this->get_all_wp_ultimo_settings() as $setting => $value) {
|
||||
if (is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$wpultimo_settings[ $setting ] = array(
|
||||
$wpultimo_settings[ $setting ] = [
|
||||
'tooltip' => '',
|
||||
'title' => $setting,
|
||||
'value' => $value,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$array_wu_tables = array();
|
||||
$array_wu_tables = [];
|
||||
|
||||
foreach ($wpdb->ms_global_tables as $key => $value) {
|
||||
if (strncmp((string) $value, 'wu_', strlen('wu_')) === 0 && ! array_key_exists($value, $array_wu_tables)) {
|
||||
$array_wu_tables[ $value ] = array(
|
||||
if (str_starts_with((string) $value, 'wu_') && ! array_key_exists($value, $array_wu_tables)) {
|
||||
$array_wu_tables[ $value ] = [
|
||||
'tooltip' => '',
|
||||
'title' => $value,
|
||||
'value' => get_network_option(null, "wpdb_{$value}_version"),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters(
|
||||
'wu_system_info_data',
|
||||
array(
|
||||
'WordPress and System Settings' => array(
|
||||
'wp-ultimo-version' => array(
|
||||
[
|
||||
'WordPress and System Settings' => [
|
||||
'wp-ultimo-version' => [
|
||||
'tooltip' => 'WP Multisite WaaS current version installed locally',
|
||||
'title' => 'WP Multisite WaaS Version',
|
||||
'value' => wu_get_version(),
|
||||
),
|
||||
'wordpress-version' => array(
|
||||
],
|
||||
'wordpress-version' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WordPress Version',
|
||||
'value' => get_bloginfo('version'),
|
||||
),
|
||||
'php-version' => array(
|
||||
],
|
||||
'php-version' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Version',
|
||||
'value' => PHP_VERSION,
|
||||
),
|
||||
'mysql-version' => array(
|
||||
],
|
||||
'mysql-version' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'MySQL Version ',
|
||||
'value' => $wpdb->db_version(),
|
||||
),
|
||||
'web-server' => array(
|
||||
],
|
||||
'web-server' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Web Server',
|
||||
'value' => $_SERVER['SERVER_SOFTWARE'],
|
||||
),
|
||||
'wordpress-url' => array(
|
||||
],
|
||||
'wordpress-url' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WordPress URL',
|
||||
'value' => get_bloginfo('wpurl'),
|
||||
),
|
||||
'home-url' => array(
|
||||
],
|
||||
'home-url' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Home URL',
|
||||
'value' => get_bloginfo('url'),
|
||||
),
|
||||
'content-directory' => array(
|
||||
],
|
||||
'content-directory' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Content Directory',
|
||||
'value' => WP_CONTENT_DIR,
|
||||
),
|
||||
'content-url' => array(
|
||||
],
|
||||
'content-url' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Content URL',
|
||||
'value' => WP_CONTENT_URL,
|
||||
),
|
||||
'plugins-directory' => array(
|
||||
],
|
||||
'plugins-directory' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins Directory',
|
||||
'value' => WP_PLUGIN_DIR,
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
],
|
||||
'pluguins-url' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins URL',
|
||||
'value' => WP_PLUGIN_URL,
|
||||
),
|
||||
'uploads-directory' => array(
|
||||
],
|
||||
'uploads-directory' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Uploads Directory',
|
||||
'value' => (defined('UPLOADS') ? UPLOADS : WP_CONTENT_DIR . '/uploads'),
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
],
|
||||
'pluguins-url' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Cookie Domain',
|
||||
'value' => defined('COOKIE_DOMAIN') ? COOKIE_DOMAIN ? COOKIE_DOMAIN : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'multisite-active' => array(
|
||||
'value' => defined('COOKIE_DOMAIN') ? COOKIE_DOMAIN ?: __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
],
|
||||
'multisite-active' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Multi-Site Active',
|
||||
'value' => is_multisite() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-current-time-gmt' => array(
|
||||
],
|
||||
'php-current-time-gmt' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - GMT',
|
||||
'value' => wu_get_current_time('mysql', true),
|
||||
),
|
||||
'timezone' => array(
|
||||
],
|
||||
'timezone' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Timezone',
|
||||
'value' => wp_timezone_string(),
|
||||
),
|
||||
'php-current-time' => array(
|
||||
],
|
||||
'php-current-time' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - with Timezone',
|
||||
'value' => wu_get_current_time(),
|
||||
),
|
||||
'database-current-time' => array(
|
||||
],
|
||||
'database-current-time' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Database Current Time',
|
||||
'value' => gmdate('Y-m-d H:i:s', strtotime((string) $wpdb->get_row('SELECT NOW() as time;')->time)),
|
||||
),
|
||||
'php-curl-support' => array(
|
||||
],
|
||||
'php-curl-support' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP cURL Support',
|
||||
'value' => function_exists('curl_init') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-gd-time' => array(
|
||||
],
|
||||
'php-gd-time' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP GD Support',
|
||||
'value' => function_exists('gd_info') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-memory-limit' => array(
|
||||
],
|
||||
'php-memory-limit' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Limit',
|
||||
'value' => $memory_limit . 'M',
|
||||
),
|
||||
'php-memory-usage' => array(
|
||||
],
|
||||
'php-memory-usage' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Usage',
|
||||
'value' => $memory_usage . 'M (' . round($memory_usage / $memory_limit * $pad_spaces, 0) . '%)',
|
||||
),
|
||||
'php-post-max-size' => array(
|
||||
],
|
||||
'php-post-max-size' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Post Max Size',
|
||||
'value' => ini_get('post_max_size'),
|
||||
),
|
||||
'php-upload-max-size' => array(
|
||||
],
|
||||
'php-upload-max-size' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Upload Max Size',
|
||||
'value' => ini_get('upload_max_filesize'),
|
||||
),
|
||||
'php-max-execution-time' => array(
|
||||
],
|
||||
'php-max-execution-time' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max Execution Time',
|
||||
'value' => $max_execution_time,
|
||||
),
|
||||
'php-allow-url-fopen' => array(
|
||||
],
|
||||
'php-allow-url-fopen' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Allow URL Fopen',
|
||||
'value' => ini_get('allow_url_fopen'),
|
||||
),
|
||||
'php-max-file-uploads' => array(
|
||||
],
|
||||
'php-max-file-uploads' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max File Uploads',
|
||||
'value' => ini_get('max_file_uploads'),
|
||||
),
|
||||
'wp-options-count' => array(
|
||||
],
|
||||
'wp-options-count' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Count',
|
||||
'value' => count($all_options),
|
||||
),
|
||||
'wp-options-size' => array(
|
||||
],
|
||||
'wp-options-size' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Size',
|
||||
'value' => $all_options_bytes . 'kb',
|
||||
),
|
||||
'wp-options-transients' => array(
|
||||
],
|
||||
'wp-options-transients' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => count($all_options_transients),
|
||||
),
|
||||
'wp-debug' => array(
|
||||
],
|
||||
'wp-debug' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_DEBUG') ? WP_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'script-debug' => array(
|
||||
],
|
||||
'script-debug' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SCRIPT_DEBUG') ? SCRIPT_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'save-queries' => array(
|
||||
],
|
||||
'save-queries' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SAVEQUERIES') ? SAVEQUERIES ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'autosave-interval' => array(
|
||||
],
|
||||
'autosave-interval' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('AUTOSAVE_INTERVAL') ? AUTOSAVE_INTERVAL ? AUTOSAVE_INTERVAL : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'wp_post_revisions' => array(
|
||||
'value' => defined('AUTOSAVE_INTERVAL') ? AUTOSAVE_INTERVAL ?: __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
],
|
||||
'wp_post_revisions' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_POST_REVISIONS') ? WP_POST_REVISIONS ? WP_POST_REVISIONS : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'disable_wp_cron' => array(
|
||||
'value' => defined('WP_POST_REVISIONS') ? WP_POST_REVISIONS ?: __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
],
|
||||
'disable_wp_cron' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'DISABLE_WP_CRON',
|
||||
'value' => defined('DISABLE_WP_CRON') ? DISABLE_WP_CRON ? DISABLE_WP_CRON : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'wp_lang' => array(
|
||||
'value' => defined('DISABLE_WP_CRON') ? DISABLE_WP_CRON ?: __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
],
|
||||
'wp_lang' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WPLANG',
|
||||
'value' => defined('WPLANG') ? WPLANG ? WPLANG : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'wp_memory_limit' => array(
|
||||
'value' => defined('WPLANG') ? WPLANG ?: __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
],
|
||||
'wp_memory_limit' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MEMORY_LIMIT') && WP_MEMORY_LIMIT) ? WP_MEMORY_LIMIT : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'wp_max_memory_limit' => array(
|
||||
],
|
||||
'wp_max_memory_limit' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MAX_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MAX_MEMORY_LIMIT') && WP_MAX_MEMORY_LIMIT) ? WP_MAX_MEMORY_LIMIT : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'operating-system' => array(
|
||||
],
|
||||
'operating-system' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Operating System',
|
||||
'value' => $browser['platform'],
|
||||
),
|
||||
'browser' => array(
|
||||
],
|
||||
'browser' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Browser',
|
||||
'value' => $browser['name'] . ' ' . $browser['version'],
|
||||
),
|
||||
'user-agent' => array(
|
||||
],
|
||||
'user-agent' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'User Agent',
|
||||
'value' => $browser['user_agent'],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'Active Theme' => array(
|
||||
'active-theme' => array(
|
||||
'Active Theme' => [
|
||||
'active-theme' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Active Theme',
|
||||
'value' => $theme->get('Name') . ' - ' . $theme->get('Version') . '(' . $theme->get('ThemeURI') . ')',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'Active Plugins' => $array_active_plugins,
|
||||
'Active Plugins on Main Site' => $array_active_plugins_main_site,
|
||||
@ -537,17 +537,17 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
'WP Multisite WaaS Database Status' => $array_wu_tables,
|
||||
|
||||
'WP Multisite WaaS Core Settings' => array_merge(
|
||||
array(
|
||||
'logs-directory' => array(
|
||||
[
|
||||
'logs-directory' => [
|
||||
'tooltip' => '',
|
||||
'title' => 'Logs Directory',
|
||||
'value' => is_writable(Logger::get_logs_folder()) ? __('Writable', 'wp-ultimo') : __('Not Writable', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
$wpultimo_settings
|
||||
),
|
||||
'Defined Constants' => $array_constants,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function generate_text_file_system_info() {
|
||||
public function generate_text_file_system_info(): void {
|
||||
|
||||
$file_name = sprintf("$this->id-%s.txt", gmdate('Y-m-d'));
|
||||
$txt = fopen($file_name, 'w') or die('Unable to open file!');
|
||||
@ -629,7 +629,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
}
|
||||
|
||||
// Finally get the correct version number
|
||||
$known = array('Version', $browser_name_short, 'other');
|
||||
$known = ['Version', $browser_name_short, 'other'];
|
||||
$pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
|
||||
|
||||
if ( ! preg_match_all($pattern, (string) $user_agent, $matches)) {
|
||||
@ -657,13 +657,13 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$version = '?';
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'user_agent' => $user_agent,
|
||||
'name' => $browser_name,
|
||||
'version' => $version,
|
||||
'platform' => $platform,
|
||||
'pattern' => $pattern,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -683,7 +683,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_active_plugins() {
|
||||
|
||||
return (array) get_site_option('active_sitewide_plugins', array());
|
||||
return (array) get_site_option('active_sitewide_plugins', []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -693,7 +693,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_active_plugins_on_main_site() {
|
||||
|
||||
return (array) get_option('active_plugins', array());
|
||||
return (array) get_option('active_plugins', []);
|
||||
}
|
||||
/**
|
||||
* Get memory usage
|
||||
@ -722,7 +722,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_all_wp_ultimo_settings() {
|
||||
|
||||
$exclude = array(
|
||||
$exclude = [
|
||||
'email',
|
||||
'logo',
|
||||
'color',
|
||||
@ -734,11 +734,11 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
'license_key',
|
||||
'api-',
|
||||
'manual_payment_instructions',
|
||||
);
|
||||
];
|
||||
|
||||
$include = array('enable');
|
||||
$include = ['enable'];
|
||||
|
||||
$return_settings = array();
|
||||
$return_settings = [];
|
||||
|
||||
$settings = new \WP_Ultimo\Settings();
|
||||
|
||||
@ -769,7 +769,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_transients_in_options($options) {
|
||||
|
||||
$transients = array();
|
||||
$transients = [];
|
||||
|
||||
foreach ($options as $name => $value) {
|
||||
if (stristr($name, 'transient')) {
|
||||
|
@ -60,9 +60,9 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
@ -103,29 +103,29 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
do_action('wu_load_tax_rates_list_page');
|
||||
|
||||
$columns = apply_filters(
|
||||
'wu_tax_rates_columns',
|
||||
array(
|
||||
[
|
||||
'title' => __('Label', 'wp-ultimo'),
|
||||
'country' => __('Country', 'wp-ultimo'),
|
||||
'state' => __('State / Province', 'wp-ultimo'),
|
||||
'city' => __('City', 'wp-ultimo'),
|
||||
'tax_rate' => __('Tax Rate (%)', 'wp-ultimo'),
|
||||
'move' => '',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wu_get_template(
|
||||
'taxes/list',
|
||||
array(
|
||||
[
|
||||
'columns' => $columns,
|
||||
'screen' => get_current_screen(),
|
||||
'types' => Tax::get_instance()->get_tax_rate_types(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -135,25 +135,25 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_register_script('wu-tax-rates', wu_get_asset('tax-rates.js', 'js'), array('wu-admin', 'wu-vue', 'underscore', 'wu-selectizer'), wu_get_version(), false);
|
||||
wp_register_script('wu-tax-rates', wu_get_asset('tax-rates.js', 'js'), ['wu-admin', 'wu-vue', 'underscore', 'wu-selectizer'], wu_get_version(), false);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-tax-rates',
|
||||
'wu_tax_ratesl10n',
|
||||
array(
|
||||
[
|
||||
'name' => __('Tax', 'wp-ultimo'),
|
||||
'confirm_message' => __('Are you sure you want to delete this rows?', 'wp-ultimo'),
|
||||
'confirm_delete_tax_category_message' => __('Are you sure you want to delete this tax category?', 'wp-ultimo'),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-vue-sortable', '//cdn.jsdelivr.net/npm/sortablejs@1.8.4/Sortable.min.js', array(), wu_get_version());
|
||||
wp_enqueue_script('wu-vue-sortable', '//cdn.jsdelivr.net/npm/sortablejs@1.8.4/Sortable.min.js', [], wu_get_version());
|
||||
|
||||
wp_enqueue_script('wu-vue-draggable', '//cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js', array(), wu_get_version());
|
||||
wp_enqueue_script('wu-vue-draggable', '//cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js', [], wu_get_version());
|
||||
|
||||
wp_enqueue_script('wu-tax-rates');
|
||||
}
|
||||
@ -168,22 +168,22 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
* @param array $atts Array of attributes to pass to the form.
|
||||
* @return void
|
||||
*/
|
||||
protected function add_fields_widget($id, $atts = array()) {
|
||||
protected function add_fields_widget($id, $atts = []) {
|
||||
|
||||
$atts = wp_parse_args(
|
||||
$atts,
|
||||
array(
|
||||
[
|
||||
'widget_id' => $id,
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'title' => __('Fields', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'screen' => get_current_screen(),
|
||||
'fields' => array(),
|
||||
'html_attr' => array(),
|
||||
'fields' => [],
|
||||
'html_attr' => [],
|
||||
'classes' => '',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box(
|
||||
@ -192,13 +192,13 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
function () use ($atts) {
|
||||
|
||||
if (wu_get_isset($atts['html_attr'], 'data-wu-app')) {
|
||||
$atts['fields']['loading'] = array(
|
||||
$atts['fields']['loading'] = [
|
||||
'type' => 'note',
|
||||
'desc' => sprintf('<div class="wu-block wu-text-center wu-blinking-animation wu-text-gray-600 wu-my-1 wu-text-2xs wu-uppercase wu-font-semibold">%s</div>', __('Loading...', 'wp-ultimo')),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-if' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,14 +209,14 @@ class Tax_Rates_Admin_Page extends Base_Admin_Page {
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
$atts['widget_id'],
|
||||
$atts['fields'],
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-widget-list wu-striped wu-m-0 wu--mt-2 wu--mb-3 wu--mx-3 ' . $atts['classes'],
|
||||
'field_wrapper_classes' => $atts['field_wrapper_classes'],
|
||||
'html_attr' => $atts['html_attr'],
|
||||
'before' => $atts['before'],
|
||||
'after' => $atts['after'],
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
|
@ -60,9 +60,9 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_customize_invoice_template',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the preview URL. This is then added to the iframe.
|
||||
@ -75,10 +75,10 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
$url = get_site_url(null);
|
||||
|
||||
return add_query_arg(
|
||||
array(
|
||||
[
|
||||
'customizer' => 1,
|
||||
Template_Previewer::get_instance()->get_preview_parameter() => 1,
|
||||
),
|
||||
],
|
||||
$url
|
||||
);
|
||||
}
|
||||
@ -89,27 +89,27 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'fields' => array(
|
||||
'preview_url_parameter' => array(
|
||||
[
|
||||
'fields' => [
|
||||
'preview_url_parameter' => [
|
||||
'type' => 'text',
|
||||
'title' => __('URL Parameter', 'wp-ultimo'),
|
||||
'desc' => __('This is the URL parameter WP Multisite WaaS will use to generate the template preview URLs.', 'wp-ultimo'),
|
||||
'value' => Template_Previewer::get_instance()->get_setting('preview_url_parameter', 'template-preview'),
|
||||
),
|
||||
'enabled' => array(
|
||||
],
|
||||
'enabled' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'desc' => __('If your site templates are not loading, you can disable the top-bar using this setting.', 'wp-ultimo'),
|
||||
'value' => Template_Previewer::get_instance()->get_setting('enabled', true),
|
||||
'html_attr' => array(),
|
||||
),
|
||||
),
|
||||
)
|
||||
'html_attr' => [],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$custom_logo_id = Template_Previewer::get_instance()->get_setting('custom_logo');
|
||||
@ -118,124 +118,124 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
|
||||
$custom_logo = $custom_logo ? $custom_logo[0] : false;
|
||||
|
||||
$fields = array(
|
||||
'tab' => array(
|
||||
$fields = [
|
||||
'tab' => [
|
||||
'type' => 'tab-select',
|
||||
'wrapper_classes' => '',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'tab',
|
||||
),
|
||||
'options' => array(
|
||||
],
|
||||
'options' => [
|
||||
'general' => __('General', 'wp-ultimo'),
|
||||
'colors' => __('Colors', 'wp-ultimo'),
|
||||
'images' => __('Images', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'display_responsive_controls' => array(
|
||||
'display_responsive_controls' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Show Responsive Controls', 'wp-ultimo'),
|
||||
'desc' => __('Toggle to show or hide the responsive controls.', 'wp-ultimo'),
|
||||
'value' => true,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "general")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'display_responsive_controls',
|
||||
),
|
||||
),
|
||||
'button_text' => array(
|
||||
],
|
||||
],
|
||||
'button_text' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Button Text', 'wp-ultimo'),
|
||||
'value' => __('Use this Template', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "general")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'button_text',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'bg_color' => array(
|
||||
'bg_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Background Color', 'wp-ultimo'),
|
||||
'desc' => __('Choose the background color for the top-bar.', 'wp-ultimo'),
|
||||
'value' => '#f9f9f9',
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "colors")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'bg_color',
|
||||
),
|
||||
),
|
||||
'button_bg_color' => array(
|
||||
],
|
||||
],
|
||||
'button_bg_color' => [
|
||||
'type' => 'color-picker',
|
||||
'title' => __('Button BG Color', 'wp-ultimo'),
|
||||
'desc' => __('Pick the background color for the button.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "colors")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'button_bg_color',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
'use_custom_logo' => array(
|
||||
'use_custom_logo' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Use Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('You can set a different logo to be used on the top-bar.', 'wp-ultimo'),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "images")',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'use_custom_logo',
|
||||
),
|
||||
),
|
||||
'custom_logo' => array(
|
||||
],
|
||||
],
|
||||
'custom_logo' => [
|
||||
'type' => 'image',
|
||||
'stacked' => true,
|
||||
'title' => __('Custom Logo', 'wp-ultimo'),
|
||||
'desc' => __('The logo is displayed on the preview page top-bar.', 'wp-ultimo'),
|
||||
'value' => $custom_logo_id,
|
||||
'img' => $custom_logo,
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'require("tab", "images") && require("use_custom_logo", true)',
|
||||
'v-cloak' => 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$settings = Template_Previewer::get_instance()->get_settings();
|
||||
|
||||
$state = array_merge(
|
||||
$settings,
|
||||
array(
|
||||
[
|
||||
'tab' => 'general',
|
||||
'refresh' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'customizer',
|
||||
array(
|
||||
[
|
||||
'title' => __('Customizer', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'fields' => $fields,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'margin-top: -6px;',
|
||||
'data-wu-app' => 'site_template_customizer',
|
||||
'data-wu-customizer-panel' => true,
|
||||
'data-state' => json_encode($state),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -280,7 +280,7 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'customize_label' => __('Customize Template Previewer', 'wp-ultimo'),
|
||||
'add_new_label' => __('Customize Template Previewer', 'wp-ultimo'),
|
||||
'edit_label' => __('Edit Template Previewer', 'wp-ultimo'),
|
||||
@ -289,7 +289,7 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
'title_description' => __('This name is used for internal reference only.', 'wp-ultimo'),
|
||||
'save_button_label' => __('Save Changes', 'wp-ultimo'),
|
||||
'save_description' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,13 +298,13 @@ class Template_Previewer_Customize_Admin_Page extends Customizer_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
$settings = Template_Previewer::get_instance()->save_settings($_POST);
|
||||
|
||||
$array_params = array(
|
||||
$array_params = [
|
||||
'updated' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
$url = add_query_arg($array_params);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Top_Admin_Nav_Menu {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
add_action('admin_bar_menu', array($this, 'add_top_bar_menus'), 50);
|
||||
add_action('admin_bar_menu', [$this, 'add_top_bar_menus'], 50);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ class Top_Admin_Nav_Menu {
|
||||
* @param \WP_Admin_Bar $wp_admin_bar The admin bar identifier.
|
||||
* @return void
|
||||
*/
|
||||
public function add_top_bar_menus($wp_admin_bar) {
|
||||
public function add_top_bar_menus($wp_admin_bar): void {
|
||||
|
||||
// Only for super admins
|
||||
if ( ! current_user_can('manage_network')) {
|
||||
@ -50,111 +50,111 @@ class Top_Admin_Nav_Menu {
|
||||
}
|
||||
|
||||
// Add Parent element
|
||||
$parent = array(
|
||||
$parent = [
|
||||
'id' => 'wp-ultimo',
|
||||
'title' => __('Multisite Waas', 'wp-ultimo'),
|
||||
'href' => current_user_can('wu_read_dashboard') ? network_admin_url('admin.php?page=wp-ultimo') : '#',
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the dashboard', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Site
|
||||
$sites = array(
|
||||
$sites = [
|
||||
'id' => 'wp-ultimo-sites',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Manage Sites', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-sites'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the sites page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Memberships
|
||||
$memberships = array(
|
||||
$memberships = [
|
||||
'id' => 'wp-ultimo-memberships',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Manage Memberships', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-memberships'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the memberships page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Customers
|
||||
$customers = array(
|
||||
$customers = [
|
||||
'id' => 'wp-ultimo-customers',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Customers', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-customers'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the customers page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Products
|
||||
$products = array(
|
||||
$products = [
|
||||
'id' => 'wp-ultimo-products',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Products', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-products'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the products page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Payments
|
||||
$payments = array(
|
||||
$payments = [
|
||||
'id' => 'wp-ultimo-payments',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Payments', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-payments'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the payments page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Discount Codes
|
||||
$discount_codes = array(
|
||||
$discount_codes = [
|
||||
'id' => 'wp-ultimo-discount-codes',
|
||||
'parent' => 'wp-ultimo',
|
||||
'title' => __('Discount Codes', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-discount-codes'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the discount codes page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$container = array(
|
||||
$container = [
|
||||
'id' => 'wp-ultimo-settings-group',
|
||||
'parent' => 'wp-ultimo',
|
||||
'group' => true,
|
||||
'title' => __('Settings Container', 'wp-ultimo'),
|
||||
'href' => '#',
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu ab-sub-secondary',
|
||||
'title' => __('Go to the settings page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// Settings
|
||||
$settings = array(
|
||||
$settings = [
|
||||
'id' => 'wp-ultimo-settings',
|
||||
'parent' => 'wp-ultimo-settings-group',
|
||||
'title' => __('Settings', 'wp-ultimo'),
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-settings'),
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu ab-sub-secondary',
|
||||
'title' => __('Go to the settings page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Add items to the top bar.
|
||||
@ -208,16 +208,16 @@ class Top_Admin_Nav_Menu {
|
||||
$parent = 'wp-ultimo-settings-addons';
|
||||
}
|
||||
|
||||
$settings_tab = array(
|
||||
$settings_tab = [
|
||||
'id' => 'wp-ultimo-settings-' . $tab,
|
||||
'parent' => $parent,
|
||||
'title' => $tab_info['title'],
|
||||
'href' => network_admin_url('admin.php?page=wp-ultimo-settings&tab=') . $tab,
|
||||
'meta' => array(
|
||||
'meta' => [
|
||||
'class' => 'wp-ultimo-top-menu',
|
||||
'title' => __('Go to the settings page', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$wp_admin_bar->add_node($settings_tab);
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'manage_network',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to add further initializations.
|
||||
@ -78,9 +78,9 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_action('wp_ajax_wu_handle_view_logs', array($this, 'handle_view_logs'));
|
||||
add_action('wp_ajax_wu_handle_view_logs', [$this, 'handle_view_logs']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,20 +89,20 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-view-log', wu_get_asset('view-logs.js', 'js'), array('jquery'));
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-view-log', wu_get_asset('view-logs.js', 'js'), ['jquery']);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-view-log',
|
||||
'wu_view_logs',
|
||||
array(
|
||||
'i18n' => array(
|
||||
[
|
||||
'i18n' => [
|
||||
'copied' => __('Copied!', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-view-log');
|
||||
@ -144,9 +144,9 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
$logs_list = list_files(
|
||||
Logger::get_logs_folder(),
|
||||
2,
|
||||
array(
|
||||
[
|
||||
'index.html',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$logs_list = array_combine(array_values($logs_list), array_map(fn($file) => str_replace(Logger::get_logs_folder(), '', (string) $file), $logs_list));
|
||||
@ -176,12 +176,12 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$contents = $file && file_exists($file) ? file_get_contents($file) : $default_content;
|
||||
|
||||
$response = array(
|
||||
$response = [
|
||||
'file' => $file,
|
||||
'file_name' => $file_name,
|
||||
'contents' => $contents,
|
||||
'logs_list' => $logs_list,
|
||||
);
|
||||
];
|
||||
|
||||
if (wp_doing_ajax()) {
|
||||
wp_send_json_success($response);
|
||||
@ -196,50 +196,50 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$info = $this->handle_view_logs();
|
||||
|
||||
add_meta_box('wp-ultimo-log-contents', __('Log Contents', 'wp-ultimo'), array($this, 'output_default_widget_payload'), get_current_screen()->id, 'normal', null, $info);
|
||||
add_meta_box('wp-ultimo-log-contents', __('Log Contents', 'wp-ultimo'), [$this, 'output_default_widget_payload'], get_current_screen()->id, 'normal', null, $info);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'file-selector',
|
||||
array(
|
||||
[
|
||||
'title' => __('Log Files', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'log_file' => array(
|
||||
'fields' => [
|
||||
'log_file' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Select Log File', 'wp-ultimo'),
|
||||
'placeholder' => __('Select Log File', 'wp-ultimo'),
|
||||
'value' => wu_request('file'),
|
||||
'tooltip' => '',
|
||||
'options' => $info['logs_list'],
|
||||
),
|
||||
'download' => array(
|
||||
],
|
||||
'download' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Download Log', 'wp-ultimo'),
|
||||
'value' => 'download',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'info',
|
||||
array(
|
||||
[
|
||||
'title' => __('Timestamps', 'wp-ultimo'),
|
||||
'position' => 'side',
|
||||
'fields' => array(
|
||||
'date_modified' => array(
|
||||
'fields' => [
|
||||
'date_modified' => [
|
||||
'title' => __('Last Modified at', 'wp-ultimo'),
|
||||
'type' => 'text-edit',
|
||||
'date' => true,
|
||||
'value' => date_i18n('Y-m-d H:i:s', filemtime($info['file'])),
|
||||
'display_value' => date_i18n('Y-m-d H:i:s', filemtime($info['file'])),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -252,15 +252,15 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @param array $data Arguments passed by add_meta_box.
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_payload($unused, $data) {
|
||||
public function output_default_widget_payload($unused, $data): void {
|
||||
|
||||
wu_get_template(
|
||||
'events/widget-payload',
|
||||
array(
|
||||
[
|
||||
'title' => __('Event Payload', 'wp-ultimo'),
|
||||
'loading_text' => __('Loading Payload', 'wp-ultimo'),
|
||||
'payload' => $data['args']['contents'],
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -272,14 +272,14 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('View Log', 'wp-ultimo'),
|
||||
'add_new_label' => __('View Log', 'wp-ultimo'),
|
||||
'title_placeholder' => __('Enter Customer', 'wp-ultimo'),
|
||||
'title_description' => __('Viewing file: ', 'wp-ultimo'),
|
||||
'delete_button_label' => __('Delete Log File', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,7 +290,7 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,7 +299,7 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
/**
|
||||
* Get the action links
|
||||
@ -318,7 +318,7 @@ class View_Logs_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
$action = wu_request('submit_button', 'none');
|
||||
|
||||
|
@ -76,9 +76,9 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_edit_webhooks',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Registers the necessary scripts and styles for this admin page.
|
||||
@ -86,22 +86,22 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_register_script('wu-webhook-page', wu_get_asset('webhook-page.js', 'js'), array('jquery', 'wu-sweet-alert'));
|
||||
wp_register_script('wu-webhook-page', wu_get_asset('webhook-page.js', 'js'), ['jquery', 'wu-sweet-alert']);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-webhook-page',
|
||||
'wu_webhook_page',
|
||||
array(
|
||||
'i18n' => array(
|
||||
[
|
||||
'i18n' => [
|
||||
'error_title' => __('Webhook Test', 'wp-ultimo'),
|
||||
'error_message' => __('An error occurred when sending the test webhook, please try again.', 'wp-ultimo'),
|
||||
'copied' => __('Copied!', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-webhook-page');
|
||||
@ -113,15 +113,15 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Delete Webhook - Confirmation modal
|
||||
*/
|
||||
add_filter(
|
||||
'wu_data_json_success_delete_webhook_modal',
|
||||
fn($data_json) => array(
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-webhooks', array('deleted' => 1)),
|
||||
)
|
||||
fn($data_json) => [
|
||||
'redirect_url' => wu_network_admin_url('wp-ultimo-webhooks', ['deleted' => 1]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -131,55 +131,55 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
parent::register_widgets();
|
||||
|
||||
$this->add_fields_widget(
|
||||
'domain-url',
|
||||
array(
|
||||
[
|
||||
'title' => __('Webhook URL', 'wp-ultimo'),
|
||||
'position' => 'normal',
|
||||
'fields' => array(
|
||||
'webhook_url' => array(
|
||||
'fields' => [
|
||||
'webhook_url' => [
|
||||
'type' => 'url',
|
||||
'title' => __('Webhook URL', 'wp-ultimo'),
|
||||
'desc' => __('The URL where we will send the payload when the event triggers.', 'wp-ultimo'),
|
||||
'placeholder' => __('https://example.com', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->get_webhook_url(),
|
||||
),
|
||||
'actions' => array(
|
||||
],
|
||||
'actions' => [
|
||||
'type' => 'actions',
|
||||
'tooltip' => __('The event .', 'wp-ultimo'),
|
||||
'actions' => array(
|
||||
'send_test_event' => array(
|
||||
'actions' => [
|
||||
'send_test_event' => [
|
||||
'title' => __('Send Test Event', 'wp-ultimo'),
|
||||
'action' => 'wu_send_test_event',
|
||||
'object_id' => $this->get_object()->get_id(),
|
||||
'loading_text' => 'Sending Test...',
|
||||
),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
],
|
||||
'html_attr' => [
|
||||
'data-page' => 'edit',
|
||||
),
|
||||
],
|
||||
'wrapper_classes' => 'wu-items-left wu-justify-start',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
add_meta_box('wp-ultimo-payload', __('Event Payload', 'wp-ultimo'), array($this, 'output_default_widget_payload'), get_current_screen()->id, 'normal');
|
||||
add_meta_box('wp-ultimo-payload', __('Event Payload', 'wp-ultimo'), [$this, 'output_default_widget_payload'], get_current_screen()->id, 'normal');
|
||||
|
||||
$this->add_list_table_widget(
|
||||
'events',
|
||||
array(
|
||||
[
|
||||
'title' => __('Events', 'wp-ultimo'),
|
||||
'table' => new \WP_Ultimo\List_Tables\Inside_Events_List_Table(),
|
||||
'query_filter' => array($this, 'query_filter'),
|
||||
)
|
||||
'query_filter' => [$this, 'query_filter'],
|
||||
]
|
||||
);
|
||||
|
||||
$event_list = array();
|
||||
$event_list = [];
|
||||
|
||||
foreach (wu_get_event_types() as $key => $value) {
|
||||
$event_list[ $key ] = $value['name'];
|
||||
@ -187,42 +187,42 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
$this->add_save_widget(
|
||||
'save',
|
||||
array(
|
||||
'fields' => array(
|
||||
'event' => array(
|
||||
[
|
||||
'fields' => [
|
||||
'event' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Event', 'wp-ultimo'),
|
||||
'desc' => __('The event that triggers this webhook.', 'wp-ultimo'),
|
||||
'placeholder' => __('Select Event', 'wp-ultimo'),
|
||||
'options' => $event_list,
|
||||
'value' => $this->get_object()->get_event(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'active',
|
||||
array(
|
||||
[
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'active' => array(
|
||||
'fields' => [
|
||||
'active' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Active', 'wp-ultimo'),
|
||||
'tooltip' => __('Deactivate will end the event trigger for this webhook.', 'wp-ultimo'),
|
||||
'desc' => __('Use this option to manually enable or disable this webhook.', 'wp-ultimo'),
|
||||
'value' => $this->get_object()->is_active(),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_fields_widget(
|
||||
'options',
|
||||
array(
|
||||
[
|
||||
'title' => __('Options', 'wp-ultimo'),
|
||||
'fields' => array(
|
||||
'integration' => array(
|
||||
'fields' => [
|
||||
'integration' => [
|
||||
'edit' => true,
|
||||
'title' => __('Integration', 'wp-ultimo'),
|
||||
'type' => 'text-edit',
|
||||
@ -230,8 +230,8 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'value' => $this->get_object()->get_integration(),
|
||||
'display_value' => ucwords((string) $this->get_object()->get_integration()),
|
||||
'tooltip' => __('Name of the service responsible for creating this webhook. If you are manually creating this webhook, use the value "manual".', 'wp-ultimo'),
|
||||
),
|
||||
'event_count' => array(
|
||||
],
|
||||
'event_count' => [
|
||||
'title' => __('Run Count', 'wp-ultimo'),
|
||||
'type' => 'text-edit',
|
||||
'min' => 0,
|
||||
@ -241,9 +241,9 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
// translators: %d is the number of times that this webhook was triggered.
|
||||
'display_value' => sprintf(__('This webhook was triggered %d time(s).', 'wp-ultimo'), $this->get_object()->get_event_count()),
|
||||
'tooltip' => __('The number of times that this webhook was triggered so far. It includes test runs.', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_payload() {
|
||||
public function output_default_widget_payload(): void {
|
||||
|
||||
$object_event_slug = $this->get_object()->get_event();
|
||||
|
||||
@ -263,11 +263,11 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
wu_get_template(
|
||||
'events/widget-payload',
|
||||
array(
|
||||
[
|
||||
'title' => __('Event Payload', 'wp-ultimo'),
|
||||
'loading_text' => __('Loading Payload', 'wp-ultimo'),
|
||||
'payload' => $payload,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -281,10 +281,10 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function query_filter($args) {
|
||||
|
||||
$extra_args = array(
|
||||
$extra_args = [
|
||||
'object_type' => 'webhook',
|
||||
'object_id' => absint($this->get_object()->get_id()),
|
||||
);
|
||||
];
|
||||
|
||||
return array_merge($args, $extra_args);
|
||||
}
|
||||
@ -319,7 +319,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,7 +330,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Webhook', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add new Webhook', 'wp-ultimo'),
|
||||
'updated_message' => __('Webhook updated successfully!', 'wp-ultimo'),
|
||||
@ -340,7 +340,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'save_description' => '',
|
||||
'delete_button_label' => __('Delete Webhook', 'wp-ultimo'),
|
||||
'delete_description' => __('Be careful. This action is irreversible.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -383,7 +383,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_save() {
|
||||
public function handle_save(): void {
|
||||
|
||||
$object = $this->get_object();
|
||||
|
||||
@ -396,9 +396,9 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
|
||||
return;
|
||||
} else {
|
||||
$array_params = array(
|
||||
$array_params = [
|
||||
'updated' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->edit === false) {
|
||||
$array_params['id'] = $object->get_id();
|
||||
|
@ -50,9 +50,9 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'wu_read_webhooks',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Registers the necessary scripts and styles for this admin page.
|
||||
@ -60,22 +60,22 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
|
||||
wp_register_script('wu-webhook-page', wu_get_asset('webhook-page.js', 'js'), array('jquery', 'wu-sweet-alert'));
|
||||
wp_register_script('wu-webhook-page', wu_get_asset('webhook-page.js', 'js'), ['jquery', 'wu-sweet-alert']);
|
||||
|
||||
wp_localize_script(
|
||||
'wu-webhook-page',
|
||||
'wu_webhook_page',
|
||||
array(
|
||||
'i18n' => array(
|
||||
[
|
||||
'i18n' => [
|
||||
'error_title' => __('Webhook Test', 'wp-ultimo'),
|
||||
'error_message' => __('An error occurred when sending the test webhook, please try again.', 'wp-ultimo'),
|
||||
'copied' => __('Copied!', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-webhook-page');
|
||||
@ -87,17 +87,17 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_forms() {
|
||||
public function register_forms(): void {
|
||||
/*
|
||||
* Add new webhook.
|
||||
*/
|
||||
wu_register_form(
|
||||
'add_new_webhook_modal',
|
||||
array(
|
||||
'render' => array($this, 'render_add_new_webhook_modal'),
|
||||
'handler' => array($this, 'handle_add_new_webhook_modal'),
|
||||
[
|
||||
'render' => [$this, 'render_add_new_webhook_modal'],
|
||||
'handler' => [$this, 'handle_add_new_webhook_modal'],
|
||||
'capability' => 'wu_edit_webhooks',
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -107,63 +107,63 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
function render_add_new_webhook_modal() {
|
||||
function render_add_new_webhook_modal(): void {
|
||||
|
||||
$events = wu_get_event_types();
|
||||
|
||||
$event_options = array();
|
||||
$event_options = [];
|
||||
|
||||
foreach ($events as $slug => $event) {
|
||||
$event_options[ $slug ] = $event['name'];
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'name' => array(
|
||||
$fields = [
|
||||
'name' => [
|
||||
'type' => 'text',
|
||||
'title' => __('Webhook Name', 'wp-ultimo'),
|
||||
'desc' => __('A name to easily identify your webhook.', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. Zapier Integration', 'wp-ultimo'),
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
'event' => [
|
||||
'title' => __('Event', 'wp-ultimo'),
|
||||
'type' => 'select',
|
||||
'desc' => __('The event that will trigger the webhook.', 'wp-ultimo'),
|
||||
'options' => $event_options,
|
||||
),
|
||||
'webhook_url' => array(
|
||||
],
|
||||
'webhook_url' => [
|
||||
'type' => 'url',
|
||||
'title' => __('Webhook Url', 'wp-ultimo'),
|
||||
'desc' => __('The url of your webhook.', 'wp-ultimo'),
|
||||
'placeholder' => __('E.g. https://example.com/', 'wp-ultimo'),
|
||||
),
|
||||
'submit_button' => array(
|
||||
],
|
||||
'submit_button' => [
|
||||
'type' => 'submit',
|
||||
'title' => __('Add New Webhook', 'wp-ultimo'),
|
||||
'value' => 'save',
|
||||
'classes' => 'button button-primary wu-w-full',
|
||||
'wrapper_classes' => 'wu-items-end',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
// 'v-bind:disabled' => '!confirmed',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
'edit_line_item',
|
||||
$fields,
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-modal-form wu-widget-list wu-striped wu-m-0 wu-mt-0',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-p-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-wu-app' => 'edit_line_item',
|
||||
'data-state' => json_encode(
|
||||
array(
|
||||
[
|
||||
'event' => '',
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$form->render();
|
||||
@ -175,7 +175,7 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_add_new_webhook_modal() {
|
||||
public function handle_add_new_webhook_modal(): void {
|
||||
|
||||
$status = wu_create_webhook($_POST);
|
||||
|
||||
@ -183,14 +183,14 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
wp_send_json_error($status);
|
||||
} else {
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'redirect_url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-webhook',
|
||||
array(
|
||||
[
|
||||
'id' => $status->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -211,10 +211,10 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'deleted_message' => __('Webhook removed successfully.', 'wp-ultimo'),
|
||||
'search_label' => __('Search Webhook', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -258,14 +258,14 @@ class Webhook_List_Admin_Page extends List_Admin_Page {
|
||||
*/
|
||||
public function action_links() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'label' => __('Add New Webhook', 'wp-ultimo'),
|
||||
'icon' => 'wu-circle-with-plus',
|
||||
'classes' => 'wubox',
|
||||
'url' => wu_get_form_url('add_new_webhook_modal'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
/*
|
||||
* Load sections to memory.
|
||||
*/
|
||||
@ -99,14 +99,14 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
final public function process_save() {
|
||||
final public function process_save(): void {
|
||||
|
||||
$saving_tag = sprintf('saving_%s', $this->get_current_section());
|
||||
|
||||
if (isset($_REQUEST[ $saving_tag ])) {
|
||||
check_admin_referer($saving_tag, '_wpultimo_nonce');
|
||||
|
||||
$handler = isset($this->current_section['handler']) ? $this->current_section['handler'] : array($this, 'default_handler');
|
||||
$handler = $this->current_section['handler'] ?? [$this, 'default_handler'];
|
||||
|
||||
/*
|
||||
* Calls the saving function
|
||||
@ -123,7 +123,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'edit_label' => __('Edit Object', 'wp-ultimo'),
|
||||
'add_new_label' => __('Add New Object', 'wp-ultimo'),
|
||||
'updated_message' => __('Object updated with success!', 'wp-ultimo'),
|
||||
@ -131,7 +131,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
'title_description' => '',
|
||||
'save_button_label' => __('Save', 'wp-ultimo'),
|
||||
'save_description' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
@ -152,7 +152,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
add_meta_box('wp-ultimo-wizard-body', wu_get_isset($this->current_section, 'title', __('Section', 'wp-ultimo')), array($this, 'output_default_widget_body'), $screen->id, 'normal', null);
|
||||
add_meta_box('wp-ultimo-wizard-body', wu_get_isset($this->current_section, 'title', __('Section', 'wp-ultimo')), [$this, 'output_default_widget_body'], $screen->id, 'normal', null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,11 +161,11 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output_default_widget_body() {
|
||||
public function output_default_widget_body(): void {
|
||||
|
||||
echo '<div class="wu-p-4">';
|
||||
|
||||
$view = isset($this->current_section['view']) ? $this->current_section['view'] : array($this, 'default_view');
|
||||
$view = $this->current_section['view'] ?? [$this, 'default_view'];
|
||||
|
||||
/*
|
||||
* Calls the view function.
|
||||
@ -192,13 +192,13 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/wizard',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'logo' => $this->get_logo(),
|
||||
@ -208,7 +208,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
'classes' => 'wu-w-full wu-mx-auto sm:wu-w-11/12 xl:wu-w-8/12 wu-mt-8 sm:wu-max-w-screen-lg',
|
||||
'clickable_navigation' => $this->clickable_navigation,
|
||||
'form_id' => $this->form_id,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function default_handler() {
|
||||
public function default_handler(): void {
|
||||
|
||||
wp_redirect($this->get_next_section_link());
|
||||
|
||||
@ -310,22 +310,22 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function default_view() {
|
||||
public function default_view(): void {
|
||||
|
||||
$section = wp_parse_args(
|
||||
$this->current_section,
|
||||
array(
|
||||
[
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'content' => '',
|
||||
'fields' => array(),
|
||||
'fields' => [],
|
||||
'next_label' => __('Continue →', 'wp-ultimo'),
|
||||
'back_label' => __('← Go Back', 'wp-ultimo'),
|
||||
'skip_label' => __('Skip this Step', 'wp-ultimo'),
|
||||
'back' => false,
|
||||
'skip' => false,
|
||||
'next' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -339,11 +339,11 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
$form = new \WP_Ultimo\UI\Form(
|
||||
$this->get_current_section(),
|
||||
$section['fields'],
|
||||
array(
|
||||
[
|
||||
'views' => 'admin-pages/fields',
|
||||
'classes' => 'wu-widget-list wu-striped wu-m-0 wu-mt-2 wu--mb-6 wu--mx-6',
|
||||
'field_wrapper_classes' => 'wu-w-full wu-box-border wu-items-center wu-flex wu-justify-between wu-px-6 wu-py-4 wu-m-0 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
ob_start();
|
||||
@ -357,9 +357,9 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
'wizards/setup/default',
|
||||
array_merge(
|
||||
$section,
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -370,15 +370,15 @@ abstract class Wizard_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_submit_box() {
|
||||
public function render_submit_box(): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/wizard/submit-box',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'labels' => $this->get_labels(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,10 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current site instance.
|
||||
@ -113,7 +113,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->current_site = wu_get_current_site();
|
||||
|
||||
@ -166,7 +166,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
|
||||
@ -186,7 +186,7 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
|
||||
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
|
||||
|
||||
\WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', array('show_admin_link' => false));
|
||||
\WP_Ultimo\UI\Current_Site_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes', ['show_admin_link' => false]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,17 +228,17 @@ class Account_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/dash',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'has_full_position' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current customer instance.
|
||||
@ -137,7 +137,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->customer = wu_get_current_customer();
|
||||
}
|
||||
@ -157,7 +157,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function force_screen_options() {
|
||||
public function force_screen_options(): void {
|
||||
|
||||
if (get_current_screen()->id !== 'toplevel_page_sites') {
|
||||
return;
|
||||
@ -166,10 +166,10 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
// Forces Screen options so we can add our links.
|
||||
add_screen_option(
|
||||
'wu_fix',
|
||||
array(
|
||||
[
|
||||
'option' => 'test',
|
||||
'value' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -187,17 +187,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Simple_Text_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
|
||||
|
||||
\WP_Ultimo\UI\Checkout_Element::get_instance()->as_inline_content(
|
||||
get_current_screen()->id,
|
||||
'wu_dash_before_metaboxes',
|
||||
array(
|
||||
[
|
||||
'slug' => 'wu-add-new-site',
|
||||
'membership_limitations' => array('sites'),
|
||||
)
|
||||
'membership_limitations' => ['sites'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -240,17 +240,17 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/dash',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'has_full_position' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'user_admin_menu' => 'read',
|
||||
'admin_menu' => 'read',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
@ -115,7 +115,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
do_action('wu_checkout_scripts', null, null);
|
||||
}
|
||||
@ -126,7 +126,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
do_action('wu_setup_checkout', null);
|
||||
|
||||
@ -141,12 +141,12 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
*/
|
||||
public function get_sections() {
|
||||
|
||||
$sections = array(
|
||||
'plan' => array(
|
||||
$sections = [
|
||||
'plan' => [
|
||||
'title' => __('Change Membership', 'wp-ultimo'),
|
||||
'view' => array($this, 'display_checkout_form'),
|
||||
),
|
||||
);
|
||||
'view' => [$this, 'display_checkout_form'],
|
||||
],
|
||||
];
|
||||
|
||||
return $sections;
|
||||
}
|
||||
@ -157,17 +157,17 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/centered',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'content' => do_shortcode('[wu_checkout slug="wu-checkout"]'),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ class Checkout_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer_Facing_Ad
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Current_Membership_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
|
||||
|
@ -68,10 +68,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'admin_menu' => 'exist',
|
||||
'user_admin_menu' => 'exist',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* The current customer instance.
|
||||
@ -113,11 +113,11 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
if ($this->current_site->get_type() === 'customer_owned') {
|
||||
parent::__construct();
|
||||
|
||||
add_action('admin_menu', array($this, 'unset_default_my_sites_menu'));
|
||||
add_action('admin_menu', [$this, 'unset_default_my_sites_menu']);
|
||||
|
||||
add_action('admin_bar_menu', array($this, 'change_my_sites_link'), 90);
|
||||
add_action('admin_bar_menu', [$this, 'change_my_sites_link'], 90);
|
||||
|
||||
add_action('current_screen', array($this, 'force_screen_options'));
|
||||
add_action('current_screen', [$this, 'force_screen_options']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
$this->customer = wu_get_current_customer();
|
||||
}
|
||||
@ -147,7 +147,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function unset_default_my_sites_menu() {
|
||||
public function unset_default_my_sites_menu(): void {
|
||||
|
||||
global $submenu;
|
||||
|
||||
@ -162,7 +162,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @param object $wp_admin_bar The admin bar object.
|
||||
* @return void
|
||||
*/
|
||||
public function change_my_sites_link($wp_admin_bar) {
|
||||
public function change_my_sites_link($wp_admin_bar): void {
|
||||
|
||||
$my_sites = $wp_admin_bar->get_node('my-sites');
|
||||
|
||||
@ -170,9 +170,9 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'page' => 'sites',
|
||||
);
|
||||
];
|
||||
|
||||
$my_sites->href = add_query_arg($args, admin_url('admin.php'));
|
||||
|
||||
@ -185,7 +185,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function force_screen_options() {
|
||||
public function force_screen_options(): void {
|
||||
|
||||
if (get_current_screen()->id !== 'toplevel_page_sites') {
|
||||
return;
|
||||
@ -194,10 +194,10 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
// Forces Screen options so we can add our links.
|
||||
add_screen_option(
|
||||
'wu_fix',
|
||||
array(
|
||||
[
|
||||
'option' => 'test',
|
||||
'value' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Login_Form_Element::get_instance()->as_inline_content(get_current_screen()->id, 'wu_dash_before_metaboxes');
|
||||
|
||||
@ -263,17 +263,17 @@ class My_Sites_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/dash',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'has_full_position' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'user_admin_menu' => 'read',
|
||||
'admin_menu' => 'read',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Should we hide admin notices on this page?
|
||||
@ -123,7 +123,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
do_action('wu_template_switching_admin_page_scripts', null, null);
|
||||
}
|
||||
@ -134,7 +134,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function page_loaded() {
|
||||
public function page_loaded(): void {
|
||||
|
||||
do_action('wu_template_switching_admin_page', null);
|
||||
|
||||
@ -147,20 +147,20 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
/*
|
||||
* Renders the base edit page layout, with the columns and everything else =)
|
||||
*/
|
||||
wu_get_template(
|
||||
'base/centered',
|
||||
array(
|
||||
[
|
||||
'screen' => get_current_screen(),
|
||||
'page' => $this,
|
||||
'content' => '',
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'updated_message' => __('Template switched successfully!', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ class Template_Switching_Admin_Page extends \WP_Ultimo\Admin_Pages\Base_Customer
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
\WP_Ultimo\UI\Template_Switching_Element::get_instance()->as_metabox(get_current_screen()->id);
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ class Debug_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_panels = array(
|
||||
protected $supported_panels = [
|
||||
'network_admin_menu' => 'capability_here',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -79,12 +79,12 @@ class Debug_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function register_widgets() {
|
||||
public function register_widgets(): void {
|
||||
|
||||
add_meta_box(
|
||||
'wp-ultimo-debug-pages',
|
||||
__('All Registered Pages', 'wp-ultimo'),
|
||||
array($this, 'render_debug_pages'),
|
||||
[$this, 'render_debug_pages'],
|
||||
get_current_screen()->id,
|
||||
'normal',
|
||||
null
|
||||
@ -97,7 +97,7 @@ class Debug_Admin_Page extends Base_Admin_Page {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_debug_pages() {
|
||||
public function render_debug_pages(): void {
|
||||
|
||||
$pages = Debug::get_instance()->get_pages();
|
||||
|
||||
@ -157,15 +157,15 @@ class Debug_Admin_Page extends Base_Admin_Page {
|
||||
* @since 1.8.2
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
public function output(): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/dash',
|
||||
array(
|
||||
[
|
||||
'page' => $this,
|
||||
'screen' => get_current_screen(),
|
||||
'has_full_position' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ class Register_Endpoint {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_action('wu_register_rest_routes', array($this, 'register_route'));
|
||||
add_action('wu_register_rest_routes', [$this, 'register_route']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,29 +46,29 @@ class Register_Endpoint {
|
||||
* @param \WP_Ultimo\API $api The API main singleton.
|
||||
* @return void
|
||||
*/
|
||||
public function register_route($api) {
|
||||
public function register_route($api): void {
|
||||
|
||||
$namespace = $api->get_namespace();
|
||||
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/register',
|
||||
array(
|
||||
[
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'handle_get'),
|
||||
'permission_callback' => \Closure::fromCallable(array($api, 'check_authorization')),
|
||||
)
|
||||
'callback' => [$this, 'handle_get'],
|
||||
'permission_callback' => \Closure::fromCallable([$api, 'check_authorization']),
|
||||
]
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
$namespace,
|
||||
'/register',
|
||||
array(
|
||||
[
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array($this, 'handle_endpoint'),
|
||||
'permission_callback' => \Closure::fromCallable(array($api, 'check_authorization')),
|
||||
'callback' => [$this, 'handle_endpoint'],
|
||||
'permission_callback' => \Closure::fromCallable([$api, 'check_authorization']),
|
||||
'args' => $this->get_rest_args(),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -82,9 +82,9 @@ class Register_Endpoint {
|
||||
*/
|
||||
public function handle_get($request) {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'registration_status' => wu_get_setting('enable_registration', true) ? 'open' : 'closed',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,9 +109,9 @@ class Register_Endpoint {
|
||||
|
||||
if (is_wp_error($validation_errors)) {
|
||||
$validation_errors->add_data(
|
||||
array(
|
||||
[
|
||||
'status' => 400,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $validation_errors;
|
||||
@ -129,10 +129,10 @@ class Register_Endpoint {
|
||||
$customer->update_last_login(true, true);
|
||||
|
||||
$customer->add_note(
|
||||
array(
|
||||
[
|
||||
'text' => __('Created via REST API', 'wp-ultimo'),
|
||||
'author_id' => $customer->get_user_id(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -140,12 +140,12 @@ class Register_Endpoint {
|
||||
*/
|
||||
$payment_method = wp_parse_args(
|
||||
wu_get_isset($params, 'payment_method'),
|
||||
array(
|
||||
[
|
||||
'gateway' => '',
|
||||
'gateway_customer_id' => '',
|
||||
'gateway_subscription_id' => '',
|
||||
'gateway_payment_id' => '',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -155,9 +155,9 @@ class Register_Endpoint {
|
||||
|
||||
$cart_params = wp_parse_args(
|
||||
$cart_params,
|
||||
array(
|
||||
[
|
||||
'type' => 'new',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$cart = new Cart($cart_params);
|
||||
@ -171,9 +171,9 @@ class Register_Endpoint {
|
||||
__('Products are required.', 'wp-ultimo'),
|
||||
array_merge(
|
||||
(array) $cart->done(),
|
||||
array(
|
||||
[
|
||||
'status' => 400,
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -188,9 +188,9 @@ class Register_Endpoint {
|
||||
wu_get_isset(
|
||||
$params,
|
||||
'membership',
|
||||
array(
|
||||
[
|
||||
'status' => Membership_Status::PENDING,
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
@ -214,10 +214,10 @@ class Register_Endpoint {
|
||||
}
|
||||
|
||||
$membership->add_note(
|
||||
array(
|
||||
[
|
||||
'text' => __('Created via REST API', 'wp-ultimo'),
|
||||
'author_id' => $customer->get_user_id(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$payment_data = $cart->to_payment_data();
|
||||
@ -227,9 +227,9 @@ class Register_Endpoint {
|
||||
wu_get_isset(
|
||||
$params,
|
||||
'payment',
|
||||
array(
|
||||
[
|
||||
'status' => Payment_Status::PENDING,
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
@ -252,10 +252,10 @@ class Register_Endpoint {
|
||||
}
|
||||
|
||||
$payment->add_note(
|
||||
array(
|
||||
[
|
||||
'text' => __('Created via REST API', 'wp-ultimo'),
|
||||
'author_id' => $customer->get_user_id(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$site = false;
|
||||
@ -301,7 +301,7 @@ class Register_Endpoint {
|
||||
} catch (\Throwable $e) {
|
||||
$wpdb->query('ROLLBACK');
|
||||
|
||||
return new \WP_Error('registration_error', $e->getMessage(), array('status' => 500));
|
||||
return new \WP_Error('registration_error', $e->getMessage(), ['status' => 500]);
|
||||
}
|
||||
|
||||
$wpdb->query('COMMIT');
|
||||
@ -309,12 +309,12 @@ class Register_Endpoint {
|
||||
/*
|
||||
* We have everything we need now.
|
||||
*/
|
||||
return array(
|
||||
return [
|
||||
'membership' => $membership->to_array(),
|
||||
'customer' => $customer->to_array(),
|
||||
'payment' => $payment->to_array(),
|
||||
'site' => $site ? $site : array('id' => 0),
|
||||
);
|
||||
'site' => $site ?: ['id' => 0],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -331,203 +331,203 @@ class Register_Endpoint {
|
||||
*/
|
||||
$billing_address_fields = Billing_Address::fields_for_rest(false);
|
||||
|
||||
$customer_args = array(
|
||||
'customer_id' => array(
|
||||
$customer_args = [
|
||||
'customer_id' => [
|
||||
'description' => __('The customer ID, if the customer already exists. If you also need to create a customer/wp user, use the "customer" property.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
),
|
||||
'customer' => array(
|
||||
],
|
||||
'customer' => [
|
||||
'description' => __('Customer data. Needs to be present when customer id is not.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'user_id' => array(
|
||||
'properties' => [
|
||||
'user_id' => [
|
||||
'description' => __('Existing WordPress user id to attach this customer to. If you also need to create a WordPress user, pass the properties "username", "password", and "email".', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
),
|
||||
'username' => array(
|
||||
],
|
||||
'username' => [
|
||||
'description' => __('The customer username. This is used to create the WordPress user.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'minLength' => 4,
|
||||
),
|
||||
'password' => array(
|
||||
],
|
||||
'password' => [
|
||||
'description' => __('The customer password. This is used to create the WordPress user. Note that no validation is performed here to enforce strength.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'minLength' => 6,
|
||||
),
|
||||
'email' => array(
|
||||
],
|
||||
'email' => [
|
||||
'description' => __('The customer email address. This is used to create the WordPress user.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'email',
|
||||
),
|
||||
'billing_address' => array(
|
||||
],
|
||||
'billing_address' => [
|
||||
'type' => 'object',
|
||||
'properties' => $billing_address_fields,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$membership_args = array(
|
||||
'membership' => array(
|
||||
$membership_args = [
|
||||
'membership' => [
|
||||
'description' => __('The membership data is automatically generated based on the cart info passed (e.g. products) but can be overridden with this property.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'status' => array(
|
||||
'properties' => [
|
||||
'status' => [
|
||||
'description' => __('The membership status.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'enum' => array_values(Membership_Status::get_allowed_list()),
|
||||
'default' => Membership_Status::PENDING,
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
'date_expiration' => [
|
||||
'description' => __('The membership expiration date. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
'date_trial_end' => array(
|
||||
],
|
||||
'date_trial_end' => [
|
||||
'description' => __('The membership trial end date. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
'date_activated' => array(
|
||||
],
|
||||
'date_activated' => [
|
||||
'description' => __('The membership activation date. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
'date_renewed' => array(
|
||||
],
|
||||
'date_renewed' => [
|
||||
'description' => __('The membership last renewed date. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
'date_cancellation' => array(
|
||||
],
|
||||
'date_cancellation' => [
|
||||
'description' => __('The membership cancellation date. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
'date_payment_plan_completed' => array(
|
||||
],
|
||||
'date_payment_plan_completed' => [
|
||||
'description' => __('The membership completion date. Used when the membership is limited to a limited number of billing cycles. Must be a valid PHP date format.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$payment_args = array(
|
||||
'payment' => array(
|
||||
$payment_args = [
|
||||
'payment' => [
|
||||
'description' => __('The payment data is automatically generated based on the cart info passed (e.g. products) but can be overridden with this property.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'status' => array(
|
||||
'properties' => [
|
||||
'status' => [
|
||||
'description' => __('The payment status.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'enum' => array_values(Payment_Status::get_allowed_list()),
|
||||
'default' => Payment_Status::PENDING,
|
||||
),
|
||||
),
|
||||
),
|
||||
'payment_method' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'payment_method' => [
|
||||
'description' => __('Payment method information. Useful when using the REST API to integrate other payment methods.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'gateway' => array(
|
||||
'properties' => [
|
||||
'gateway' => [
|
||||
'description' => __('The gateway name. E.g. stripe.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
'gateway_customer_id' => array(
|
||||
],
|
||||
'gateway_customer_id' => [
|
||||
'description' => __('The customer ID on the gateway system.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
'gateway_subscription_id' => array(
|
||||
],
|
||||
'gateway_subscription_id' => [
|
||||
'description' => __('The subscription ID on the gateway system.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
'gateway_payment_id' => array(
|
||||
],
|
||||
'gateway_payment_id' => [
|
||||
'description' => __('The payment ID on the gateway system.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$site_args = array(
|
||||
'site' => array(
|
||||
$site_args = [
|
||||
'site' => [
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'site_url' => array(
|
||||
'properties' => [
|
||||
'site_url' => [
|
||||
'type' => 'string',
|
||||
'description' => __('The site subdomain or subdirectory (depending on your Multisite install). This would be "test" in "test.your-network.com".', 'wp-ultimo'),
|
||||
'minLength' => 4,
|
||||
'required' => true,
|
||||
),
|
||||
'site_title' => array(
|
||||
],
|
||||
'site_title' => [
|
||||
'type' => 'string',
|
||||
'description' => __('The site title. E.g. My Amazing Site', 'wp-ultimo'),
|
||||
'minLength' => 4,
|
||||
'required' => true,
|
||||
),
|
||||
'publish' => array(
|
||||
],
|
||||
'publish' => [
|
||||
'description' => __('If we should publish this site regardless of membership/payment status. Sites are created as pending by default, and are only published when a payment is received or the status of the membership changes to "active". This flag allows you to bypass the pending state.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
),
|
||||
'template_id' => array(
|
||||
],
|
||||
'template_id' => [
|
||||
'description' => __('The template ID we should copy when creating this site. If left empty, the value dictated by the products will be used.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
),
|
||||
'site_meta' => array(
|
||||
],
|
||||
'site_meta' => [
|
||||
'description' => __('An associative array of key values to be saved as site_meta.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
),
|
||||
'site_option' => array(
|
||||
],
|
||||
'site_option' => [
|
||||
'description' => __('An associative array of key values to be saved as site_options. Useful for changing plugin settings and other site configurations.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$cart_args = array(
|
||||
'products' => array(
|
||||
$cart_args = [
|
||||
'products' => [
|
||||
'description' => __('The products to be added to this membership. Takes an array of product ids or slugs.', 'wp-ultimo'),
|
||||
'uniqueItems' => true,
|
||||
'type' => 'array',
|
||||
),
|
||||
'duration' => array(
|
||||
],
|
||||
'duration' => [
|
||||
'description' => __('The membership duration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'duration_unit' => array(
|
||||
],
|
||||
'duration_unit' => [
|
||||
'description' => __('The membership duration unit.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'default' => 'month',
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'week',
|
||||
'month',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'discount_code' => array(
|
||||
],
|
||||
],
|
||||
'discount_code' => [
|
||||
'description' => __('A discount code. E.g. PROMO10.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
'auto_renew' => array(
|
||||
],
|
||||
'auto_renew' => [
|
||||
'description' => __('The membership auto-renew status. Useful when integrating with other payment options via this REST API.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'required' => true,
|
||||
),
|
||||
'country' => array(
|
||||
],
|
||||
'country' => [
|
||||
'description' => __('The customer country. Used to calculate taxes and check if registration is allowed for that country.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __('The currency to be used.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$args = array_merge($customer_args, $membership_args, $cart_args, $payment_args, $site_args);
|
||||
|
||||
@ -616,13 +616,13 @@ class Register_Endpoint {
|
||||
* the site on WordPress.
|
||||
*/
|
||||
$transient = array_merge(
|
||||
wu_get_isset($site_data, 'site_meta', array()),
|
||||
wu_get_isset($site_data, 'site_option', array())
|
||||
wu_get_isset($site_data, 'site_meta', []),
|
||||
wu_get_isset($site_data, 'site_option', [])
|
||||
);
|
||||
|
||||
$template_id = apply_filters('wu_checkout_template_id', (int) wu_get_isset($site_data, 'template_id'), $membership, $this);
|
||||
|
||||
$site_data = array(
|
||||
$site_data = [
|
||||
'domain' => $d->domain,
|
||||
'path' => $d->path,
|
||||
'title' => wu_get_isset($site_data, 'site_title'),
|
||||
@ -630,10 +630,10 @@ class Register_Endpoint {
|
||||
'customer_id' => $membership->get_customer()->get_id(),
|
||||
'membership_id' => $membership->get_id(),
|
||||
'transient' => $transient,
|
||||
'signup_meta' => wu_get_isset($site_data, 'site_meta', array()),
|
||||
'signup_options' => wu_get_isset($site_data, 'site_option', array()),
|
||||
'signup_meta' => wu_get_isset($site_data, 'site_meta', []),
|
||||
'signup_options' => wu_get_isset($site_data, 'site_option', []),
|
||||
'type' => Site_Type::CUSTOMER_OWNED,
|
||||
);
|
||||
];
|
||||
|
||||
$membership->create_pending_site($site_data);
|
||||
|
||||
@ -664,7 +664,7 @@ class Register_Endpoint {
|
||||
*/
|
||||
public function validation_rules() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'customer_id' => 'required_without:customer',
|
||||
'customer' => 'required_without:customer_id',
|
||||
'customer.username' => 'required_without_all:customer_id,customer.user_id',
|
||||
@ -673,7 +673,7 @@ class Register_Endpoint {
|
||||
'customer.user_id' => 'required_without_all:customer_id,customer.username,customer.password,customer.email',
|
||||
'site.site_url' => 'required_with:site|alpha_num|min:4|lowercase|unique_site',
|
||||
'site.site_title' => 'required_with:site|min:4',
|
||||
);
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Validates the rules and make sure we only save models when necessary.
|
||||
|
@ -18,76 +18,76 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'migrated_from_id' => array(
|
||||
return [
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'notice_type' => array(
|
||||
],
|
||||
'notice_type' => [
|
||||
'description' => __('Can be info, success, warning or error.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'info',
|
||||
'success',
|
||||
'warning',
|
||||
'error',
|
||||
),
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('This broadcast name, which is used as broadcast title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __('The status being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'author_id' => array(
|
||||
],
|
||||
'author_id' => [
|
||||
'description' => __('The author ID.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('Post title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'content' => array(
|
||||
],
|
||||
'content' => [
|
||||
'description' => __('Post content.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'excerpt' => array(
|
||||
],
|
||||
'excerpt' => [
|
||||
'description' => __('Post excerpt.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Post creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Post last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The slug.', 'wp-ultimo'),
|
||||
'type' => 'mixed',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,76 +18,76 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'migrated_from_id' => array(
|
||||
return [
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'notice_type' => array(
|
||||
],
|
||||
'notice_type' => [
|
||||
'description' => __('Can be info, success, warning or error.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'info',
|
||||
'success',
|
||||
'warning',
|
||||
'error',
|
||||
),
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('This broadcast name, which is used as broadcast title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __('The status being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'author_id' => array(
|
||||
],
|
||||
'author_id' => [
|
||||
'description' => __('The author ID.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('Post title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'content' => array(
|
||||
],
|
||||
'content' => [
|
||||
'description' => __('Post content.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'excerpt' => array(
|
||||
],
|
||||
'excerpt' => [
|
||||
'description' => __('Post excerpt.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Post creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Post last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The slug.', 'wp-ultimo'),
|
||||
'type' => 'mixed',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,75 +18,75 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'slug' => array(
|
||||
return [
|
||||
'slug' => [
|
||||
'description' => __('The checkout form slug. It needs to be unique and preferably make it clear what it is about. E.g. my_checkout_form.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('Your checkout form name, which is used as checkout form title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this checkout form as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => true,
|
||||
),
|
||||
'custom_css' => array(
|
||||
],
|
||||
'custom_css' => [
|
||||
'description' => __('Custom CSS code for the checkout form.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'settings' => array(
|
||||
],
|
||||
'settings' => [
|
||||
'description' => __('The checkout form settings and configurations.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'required' => false,
|
||||
),
|
||||
'allowed_countries' => array(
|
||||
],
|
||||
'allowed_countries' => [
|
||||
'description' => __('The allowed countries that can access this checkout.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'thank_you_page_id' => array(
|
||||
],
|
||||
'thank_you_page_id' => [
|
||||
'description' => __('The thank you page ID. This page is shown after a successful purchase.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'conversion_snippets' => array(
|
||||
],
|
||||
'conversion_snippets' => [
|
||||
'description' => __('Snippets to run on thank you page.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'template' => array(
|
||||
],
|
||||
'template' => [
|
||||
'description' => __("Template mode. Can be either 'blank', 'single-step' or 'multi-step'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'blank',
|
||||
'single-step',
|
||||
'multi-step',
|
||||
),
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,75 +18,75 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'slug' => array(
|
||||
return [
|
||||
'slug' => [
|
||||
'description' => __('The checkout form slug. It needs to be unique and preferably make it clear what it is about. E.g. my_checkout_form.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('Your checkout form name, which is used as checkout form title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this checkout form as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_css' => array(
|
||||
],
|
||||
'custom_css' => [
|
||||
'description' => __('Custom CSS code for the checkout form.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'settings' => array(
|
||||
],
|
||||
'settings' => [
|
||||
'description' => __('The checkout form settings and configurations.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'allowed_countries' => array(
|
||||
],
|
||||
'allowed_countries' => [
|
||||
'description' => __('The allowed countries that can access this checkout.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'thank_you_page_id' => array(
|
||||
],
|
||||
'thank_you_page_id' => [
|
||||
'description' => __('The thank you page ID. This page is shown after a successful purchase.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'conversion_snippets' => array(
|
||||
],
|
||||
'conversion_snippets' => [
|
||||
'description' => __('Snippets to run on thank you page.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'template' => array(
|
||||
],
|
||||
'template' => [
|
||||
'description' => __("Template mode. Can be either 'blank', 'single-step' or 'multi-step'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'blank',
|
||||
'single-step',
|
||||
'multi-step',
|
||||
),
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,83 +18,83 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'user_id' => array(
|
||||
return [
|
||||
'user_id' => [
|
||||
'description' => __('The WordPress user ID attached to this customer.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'date_registered' => array(
|
||||
],
|
||||
'date_registered' => [
|
||||
'description' => __('Date when the customer was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'email_verification' => array(
|
||||
],
|
||||
'email_verification' => [
|
||||
'description' => __('Email verification status - either `none`, `pending`, or `verified`.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'verified',
|
||||
'pending',
|
||||
'none',
|
||||
),
|
||||
),
|
||||
'last_login' => array(
|
||||
],
|
||||
],
|
||||
'last_login' => [
|
||||
'description' => __('Date this customer last logged in.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'has_trialed' => array(
|
||||
],
|
||||
'has_trialed' => [
|
||||
'description' => __('Whether or not the customer has trialed before.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'vip' => array(
|
||||
],
|
||||
'vip' => [
|
||||
'description' => __('If this customer is a VIP customer or not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'ips' => array(
|
||||
],
|
||||
'ips' => [
|
||||
'description' => __('List of IP addresses used by this customer.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'extra_information' => array(
|
||||
],
|
||||
'extra_information' => [
|
||||
'description' => __('Any extra information related to this customer.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The customer type. Can be 'customer'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'customer',
|
||||
),
|
||||
),
|
||||
'signup_form' => array(
|
||||
],
|
||||
],
|
||||
'signup_form' => [
|
||||
'description' => __('The form used to signup.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,83 +18,83 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'user_id' => array(
|
||||
return [
|
||||
'user_id' => [
|
||||
'description' => __('The WordPress user ID attached to this customer.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_registered' => array(
|
||||
],
|
||||
'date_registered' => [
|
||||
'description' => __('Date when the customer was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'email_verification' => array(
|
||||
],
|
||||
'email_verification' => [
|
||||
'description' => __('Email verification status - either `none`, `pending`, or `verified`.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'verified',
|
||||
'pending',
|
||||
'none',
|
||||
),
|
||||
),
|
||||
'last_login' => array(
|
||||
],
|
||||
],
|
||||
'last_login' => [
|
||||
'description' => __('Date this customer last logged in.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'has_trialed' => array(
|
||||
],
|
||||
'has_trialed' => [
|
||||
'description' => __('Whether or not the customer has trialed before.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'vip' => array(
|
||||
],
|
||||
'vip' => [
|
||||
'description' => __('If this customer is a VIP customer or not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'ips' => array(
|
||||
],
|
||||
'ips' => [
|
||||
'description' => __('List of IP addresses used by this customer.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'extra_information' => array(
|
||||
],
|
||||
'extra_information' => [
|
||||
'description' => __('Any extra information related to this customer.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The customer type. Can be 'customer'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'customer',
|
||||
),
|
||||
),
|
||||
'signup_form' => array(
|
||||
],
|
||||
],
|
||||
'signup_form' => [
|
||||
'description' => __('The form used to signup.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,108 +18,108 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'name' => array(
|
||||
return [
|
||||
'name' => [
|
||||
'description' => __('Your discount code name, which is used as discount code title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'code' => array(
|
||||
],
|
||||
'code' => [
|
||||
'description' => __('A unique identification to redeem the discount code. E.g. PROMO10.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the discount code, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'uses' => array(
|
||||
],
|
||||
'uses' => [
|
||||
'description' => __('Number of times this discount was applied.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'max_uses' => array(
|
||||
],
|
||||
'max_uses' => [
|
||||
'description' => __('The number of times this discount can be used before becoming inactive.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'apply_to_renewals' => array(
|
||||
],
|
||||
'apply_to_renewals' => [
|
||||
'description' => __('Wether or not we should apply the discount to membership renewals.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The type of the discount code. Can be 'percentage' (e.g. 10%% OFF), 'absolute' (e.g. $10 OFF).", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'percentage',
|
||||
'absolute',
|
||||
),
|
||||
),
|
||||
'value' => array(
|
||||
],
|
||||
],
|
||||
'value' => [
|
||||
'description' => __('Amount discounted in cents.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'setup_fee_type' => array(
|
||||
],
|
||||
'setup_fee_type' => [
|
||||
'description' => __('Type of the discount for the setup fee value. Can be a percentage or absolute.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'percentage',
|
||||
'absolute',
|
||||
),
|
||||
),
|
||||
'setup_fee_value' => array(
|
||||
],
|
||||
],
|
||||
'setup_fee_value' => [
|
||||
'description' => __('Amount discounted for setup fees in cents.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this discount code as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_start' => array(
|
||||
],
|
||||
'date_start' => [
|
||||
'description' => __('Start date for the coupon code to be considered valid.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
'date_expiration' => [
|
||||
'description' => __('Expiration date for the coupon code.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this discount code was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'allowed_products' => array(
|
||||
],
|
||||
'allowed_products' => [
|
||||
'description' => __('The list of products that allows this discount code to be used. If empty, all products will accept this code.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'limit_products' => array(
|
||||
],
|
||||
'limit_products' => [
|
||||
'description' => __('This discount code will be limited to be used in certain products? If set to true, you must define a list of allowed products.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,108 +18,108 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'name' => array(
|
||||
return [
|
||||
'name' => [
|
||||
'description' => __('Your discount code name, which is used as discount code title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'code' => array(
|
||||
],
|
||||
'code' => [
|
||||
'description' => __('A unique identification to redeem the discount code. E.g. PROMO10.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the discount code, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'uses' => array(
|
||||
],
|
||||
'uses' => [
|
||||
'description' => __('Number of times this discount was applied.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'max_uses' => array(
|
||||
],
|
||||
'max_uses' => [
|
||||
'description' => __('The number of times this discount can be used before becoming inactive.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'apply_to_renewals' => array(
|
||||
],
|
||||
'apply_to_renewals' => [
|
||||
'description' => __('Wether or not we should apply the discount to membership renewals.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The type of the discount code. Can be 'percentage' (e.g. 10%% OFF), 'absolute' (e.g. $10 OFF).", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'percentage',
|
||||
'absolute',
|
||||
),
|
||||
),
|
||||
'value' => array(
|
||||
],
|
||||
],
|
||||
'value' => [
|
||||
'description' => __('Amount discounted in cents.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'setup_fee_type' => array(
|
||||
],
|
||||
'setup_fee_type' => [
|
||||
'description' => __('Type of the discount for the setup fee value. Can be a percentage or absolute.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'percentage',
|
||||
'absolute',
|
||||
),
|
||||
),
|
||||
'setup_fee_value' => array(
|
||||
],
|
||||
],
|
||||
'setup_fee_value' => [
|
||||
'description' => __('Amount discounted for setup fees in cents.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this discount code as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_start' => array(
|
||||
],
|
||||
'date_start' => [
|
||||
'description' => __('Start date for the coupon code to be considered valid.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
'date_expiration' => [
|
||||
'description' => __('Expiration date for the coupon code.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this discount code was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'allowed_products' => array(
|
||||
],
|
||||
'allowed_products' => [
|
||||
'description' => __('The list of products that allows this discount code to be used. If empty, all products will accept this code.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'limit_products' => array(
|
||||
],
|
||||
'limit_products' => [
|
||||
'description' => __('This discount code will be limited to be used in certain products? If set to true, you must define a list of allowed products.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,62 +18,62 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'domain' => array(
|
||||
return [
|
||||
'domain' => [
|
||||
'description' => __("Your Domain name. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'blog_id' => array(
|
||||
],
|
||||
'blog_id' => [
|
||||
'description' => __('The blog ID attached to this domain.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this domain as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'primary_domain' => array(
|
||||
],
|
||||
'primary_domain' => [
|
||||
'description' => __("Define true to set this as primary domain of a site, meaning it's the main url, or set false.", 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'secure' => array(
|
||||
],
|
||||
'secure' => [
|
||||
'description' => __('If this domain has some SSL security or not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'stage' => array(
|
||||
],
|
||||
'stage' => [
|
||||
'description' => __('The state of the domain model object. Can be one of this options: checking-dns, checking-ssl-cert, done-without-ssl, done and failed.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'checking-dns',
|
||||
'checking-ssl-cert',
|
||||
'done-without-ssl',
|
||||
'done',
|
||||
'failed',
|
||||
),
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when the domain was created. If no date is set, the current date and time will be used.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,62 +18,62 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'domain' => array(
|
||||
return [
|
||||
'domain' => [
|
||||
'description' => __("Your Domain name. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'blog_id' => array(
|
||||
],
|
||||
'blog_id' => [
|
||||
'description' => __('The blog ID attached to this domain.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this domain as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'primary_domain' => array(
|
||||
],
|
||||
'primary_domain' => [
|
||||
'description' => __("Define true to set this as primary domain of a site, meaning it's the main url, or set false.", 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'secure' => array(
|
||||
],
|
||||
'secure' => [
|
||||
'description' => __('If this domain has some SSL security or not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'stage' => array(
|
||||
],
|
||||
'stage' => [
|
||||
'description' => __('The state of the domain model object. Can be one of this options: checking-dns, checking-ssl-cert, done-without-ssl, done and failed.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'checking-dns',
|
||||
'checking-ssl-cert',
|
||||
'done-without-ssl',
|
||||
'done',
|
||||
'failed',
|
||||
),
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when the domain was created. If no date is set, the current date and time will be used.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,127 +18,127 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'style' => array(
|
||||
return [
|
||||
'style' => [
|
||||
'description' => __("The email style. Can be 'html' or 'plain-text'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'html',
|
||||
'plain-text',
|
||||
),
|
||||
),
|
||||
'schedule' => array(
|
||||
],
|
||||
],
|
||||
'schedule' => [
|
||||
'description' => __('Whether or not this is a scheduled email.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
'event' => [
|
||||
'description' => __('The event that needs to be fired for this email to be sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'send_hours' => array(
|
||||
],
|
||||
'send_hours' => [
|
||||
'description' => __('The amount of hours that the email will wait before is sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'send_days' => array(
|
||||
],
|
||||
'send_days' => [
|
||||
'description' => __('The amount of days that the email will wait before is sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'schedule_type' => array(
|
||||
],
|
||||
'schedule_type' => [
|
||||
'description' => __("The type of schedule. Can be 'days' or 'hours'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'days',
|
||||
'hours',
|
||||
),
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('The name being set as title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender' => array(
|
||||
],
|
||||
'custom_sender' => [
|
||||
'description' => __('If has a custom sender.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender_name' => array(
|
||||
],
|
||||
'custom_sender_name' => [
|
||||
'description' => __('The name of the custom sender. E.g. From: John Doe.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender_email' => array(
|
||||
],
|
||||
'custom_sender_email' => [
|
||||
'description' => __('The email of the custom sender. E.g. From: johndoe@gmail.com.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'target' => array(
|
||||
],
|
||||
'target' => [
|
||||
'description' => __("If we should send this to a customer or to the network admin. Can be 'customer' or 'admin'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'customer',
|
||||
'admin',
|
||||
),
|
||||
),
|
||||
'send_copy_to_admin' => array(
|
||||
],
|
||||
],
|
||||
'send_copy_to_admin' => [
|
||||
'description' => __('Checks if we should send a copy of the email to the admin.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this email as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'legacy' => array(
|
||||
],
|
||||
'legacy' => [
|
||||
'description' => __('Whether or not this is a legacy email.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('Post title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'content' => array(
|
||||
],
|
||||
'content' => [
|
||||
'description' => __('Post content.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'excerpt' => array(
|
||||
],
|
||||
'excerpt' => [
|
||||
'description' => __('Post excerpt.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Post creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Post last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,127 +18,127 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'style' => array(
|
||||
return [
|
||||
'style' => [
|
||||
'description' => __("The email style. Can be 'html' or 'plain-text'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'html',
|
||||
'plain-text',
|
||||
),
|
||||
),
|
||||
'schedule' => array(
|
||||
],
|
||||
],
|
||||
'schedule' => [
|
||||
'description' => __('Whether or not this is a scheduled email.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type being set.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
'event' => [
|
||||
'description' => __('The event that needs to be fired for this email to be sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'send_hours' => array(
|
||||
],
|
||||
'send_hours' => [
|
||||
'description' => __('The amount of hours that the email will wait before is sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'send_days' => array(
|
||||
],
|
||||
'send_days' => [
|
||||
'description' => __('The amount of days that the email will wait before is sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'schedule_type' => array(
|
||||
],
|
||||
'schedule_type' => [
|
||||
'description' => __("The type of schedule. Can be 'days' or 'hours'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'days',
|
||||
'hours',
|
||||
),
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('The name being set as title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender' => array(
|
||||
],
|
||||
'custom_sender' => [
|
||||
'description' => __('If has a custom sender.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender_name' => array(
|
||||
],
|
||||
'custom_sender_name' => [
|
||||
'description' => __('The name of the custom sender. E.g. From: John Doe.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'custom_sender_email' => array(
|
||||
],
|
||||
'custom_sender_email' => [
|
||||
'description' => __('The email of the custom sender. E.g. From: johndoe@gmail.com.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'target' => array(
|
||||
],
|
||||
'target' => [
|
||||
'description' => __("If we should send this to a customer or to the network admin. Can be 'customer' or 'admin'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'customer',
|
||||
'admin',
|
||||
),
|
||||
),
|
||||
'send_copy_to_admin' => array(
|
||||
],
|
||||
],
|
||||
'send_copy_to_admin' => [
|
||||
'description' => __('Checks if we should send a copy of the email to the admin.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this email as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'legacy' => array(
|
||||
],
|
||||
'legacy' => [
|
||||
'description' => __('Whether or not this is a legacy email.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('Post title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'content' => array(
|
||||
],
|
||||
'content' => [
|
||||
'description' => __('Post content.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'excerpt' => array(
|
||||
],
|
||||
'excerpt' => [
|
||||
'description' => __('Post excerpt.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Post creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Post last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,59 +18,59 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'severity' => array(
|
||||
return [
|
||||
'severity' => [
|
||||
'description' => __('Severity of the problem.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when the event was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'payload' => array(
|
||||
],
|
||||
'payload' => [
|
||||
'description' => __('Payload of the event.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'required' => true,
|
||||
),
|
||||
'initiator' => array(
|
||||
],
|
||||
'initiator' => [
|
||||
'description' => __('The type of user responsible for initiating the event. There are two options: Manual and System. By default, the event is saved as manual.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'system',
|
||||
'manual',
|
||||
),
|
||||
),
|
||||
'object_type' => array(
|
||||
],
|
||||
],
|
||||
'object_type' => [
|
||||
'description' => __("The type of object related to this event. It's usually the model name.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The event slug. It needs to be unique and preferably make it clear what it is about. Example: account_created is about creating an account.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'object_id' => array(
|
||||
],
|
||||
'object_id' => [
|
||||
'description' => __('The ID of the related objects.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,59 +18,59 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'severity' => array(
|
||||
return [
|
||||
'severity' => [
|
||||
'description' => __('Severity of the problem.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when the event was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'payload' => array(
|
||||
],
|
||||
'payload' => [
|
||||
'description' => __('Payload of the event.', 'wp-ultimo'),
|
||||
'type' => 'object',
|
||||
'required' => false,
|
||||
),
|
||||
'initiator' => array(
|
||||
],
|
||||
'initiator' => [
|
||||
'description' => __('The type of user responsible for initiating the event. There are two options: Manual and System. By default, the event is saved as manual.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'system',
|
||||
'manual',
|
||||
),
|
||||
),
|
||||
'object_type' => array(
|
||||
],
|
||||
],
|
||||
'object_type' => [
|
||||
'description' => __("The type of object related to this event. It's usually the model name.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The event slug. It needs to be unique and preferably make it clear what it is about. Example: account_created is about creating an account.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'object_id' => array(
|
||||
],
|
||||
'object_id' => [
|
||||
'description' => __('The ID of the related objects.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -20,162 +20,162 @@ use WP_Ultimo\Database\Memberships\Membership_Status;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'customer_id' => array(
|
||||
return [
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer attached to this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'user_id' => array(
|
||||
],
|
||||
'user_id' => [
|
||||
'description' => __('The user ID attached to this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'plan_id' => array(
|
||||
],
|
||||
'plan_id' => [
|
||||
'description' => __('The plan ID associated with the membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'addon_products' => array(
|
||||
],
|
||||
'addon_products' => [
|
||||
'description' => __('Additional products related to this membership. Services, Packages or other types of products.', 'wp-ultimo'),
|
||||
'type' => 'mixed',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency that this membership. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'duration' => array(
|
||||
],
|
||||
'duration' => [
|
||||
'description' => __('The interval period between a charge. Only the interval amount, the unit will be defined in another property.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'duration_unit' => array(
|
||||
],
|
||||
'duration_unit' => [
|
||||
'description' => __("The duration amount type. Can be 'day', 'week', 'month' or 'year'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'month',
|
||||
'week',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'amount' => array(
|
||||
],
|
||||
],
|
||||
'amount' => [
|
||||
'description' => __('The product amount.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'initial_amount' => array(
|
||||
],
|
||||
'initial_amount' => [
|
||||
'description' => __('The initial amount charged for this membership, including the setup fee.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date of creation of this membership.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_activated' => array(
|
||||
],
|
||||
'date_activated' => [
|
||||
'description' => __('Date when this membership was activated.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_trial_end' => array(
|
||||
],
|
||||
'date_trial_end' => [
|
||||
'description' => __('Date when the trial period ends, if this membership has or had a trial period.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_renewed' => array(
|
||||
],
|
||||
'date_renewed' => [
|
||||
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_cancellation' => array(
|
||||
],
|
||||
'date_cancellation' => [
|
||||
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
'date_expiration' => [
|
||||
'description' => __('Date when the membership will expiry.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_payment_plan_completed' => array(
|
||||
],
|
||||
'date_payment_plan_completed' => [
|
||||
'description' => __('Change of the payment completion for the plan value.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'auto_renew' => array(
|
||||
],
|
||||
'auto_renew' => [
|
||||
'description' => __('If this membership should auto-renewal.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'times_billed' => array(
|
||||
],
|
||||
'times_billed' => [
|
||||
'description' => __('Amount of times this membership got billed.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'billing_cycles' => array(
|
||||
],
|
||||
'billing_cycles' => [
|
||||
'description' => __('Maximum times we should charge this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __("The membership status. Can be 'pending', 'active', 'on-hold', 'expired', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => Membership_Status::get_allowed_list(),
|
||||
),
|
||||
'gateway_customer_id' => array(
|
||||
],
|
||||
'gateway_customer_id' => [
|
||||
'description' => __('The ID of the customer on the payment gateway database.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway_subscription_id' => array(
|
||||
],
|
||||
'gateway_subscription_id' => [
|
||||
'description' => __('The ID of the subscription on the payment gateway database.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'description' => __('ID of the gateway being used on this subscription.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'signup_method' => array(
|
||||
],
|
||||
'signup_method' => [
|
||||
'description' => __('Signup method used to create this membership.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'upgraded_from' => array(
|
||||
],
|
||||
'upgraded_from' => [
|
||||
'description' => __('Plan that this membership upgraded from.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Date this membership was last modified.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'disabled' => array(
|
||||
],
|
||||
'disabled' => [
|
||||
'description' => __('If this membership is a disabled one.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'recurring' => array(
|
||||
],
|
||||
'recurring' => [
|
||||
'description' => __('If this membership is recurring (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -20,162 +20,162 @@ use WP_Ultimo\Database\Memberships\Membership_Status;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'customer_id' => array(
|
||||
return [
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer attached to this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'user_id' => array(
|
||||
],
|
||||
'user_id' => [
|
||||
'description' => __('The user ID attached to this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'plan_id' => array(
|
||||
],
|
||||
'plan_id' => [
|
||||
'description' => __('The plan ID associated with the membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'addon_products' => array(
|
||||
],
|
||||
'addon_products' => [
|
||||
'description' => __('Additional products related to this membership. Services, Packages or other types of products.', 'wp-ultimo'),
|
||||
'type' => 'mixed',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency that this membership. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'duration' => array(
|
||||
],
|
||||
'duration' => [
|
||||
'description' => __('The interval period between a charge. Only the interval amount, the unit will be defined in another property.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'duration_unit' => array(
|
||||
],
|
||||
'duration_unit' => [
|
||||
'description' => __("The duration amount type. Can be 'day', 'week', 'month' or 'year'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'month',
|
||||
'week',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'amount' => array(
|
||||
],
|
||||
],
|
||||
'amount' => [
|
||||
'description' => __('The product amount.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'initial_amount' => array(
|
||||
],
|
||||
'initial_amount' => [
|
||||
'description' => __('The initial amount charged for this membership, including the setup fee.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date of creation of this membership.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_activated' => array(
|
||||
],
|
||||
'date_activated' => [
|
||||
'description' => __('Date when this membership was activated.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_trial_end' => array(
|
||||
],
|
||||
'date_trial_end' => [
|
||||
'description' => __('Date when the trial period ends, if this membership has or had a trial period.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_renewed' => array(
|
||||
],
|
||||
'date_renewed' => [
|
||||
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_cancellation' => array(
|
||||
],
|
||||
'date_cancellation' => [
|
||||
'description' => __('Date when the membership was cancelled.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_expiration' => array(
|
||||
],
|
||||
'date_expiration' => [
|
||||
'description' => __('Date when the membership will expiry.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_payment_plan_completed' => array(
|
||||
],
|
||||
'date_payment_plan_completed' => [
|
||||
'description' => __('Change of the payment completion for the plan value.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'auto_renew' => array(
|
||||
],
|
||||
'auto_renew' => [
|
||||
'description' => __('If this membership should auto-renewal.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'times_billed' => array(
|
||||
],
|
||||
'times_billed' => [
|
||||
'description' => __('Amount of times this membership got billed.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'billing_cycles' => array(
|
||||
],
|
||||
'billing_cycles' => [
|
||||
'description' => __('Maximum times we should charge this membership.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __("The membership status. Can be 'pending', 'active', 'on-hold', 'expired', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => Membership_Status::get_allowed_list(),
|
||||
),
|
||||
'gateway_customer_id' => array(
|
||||
],
|
||||
'gateway_customer_id' => [
|
||||
'description' => __('The ID of the customer on the payment gateway database.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway_subscription_id' => array(
|
||||
],
|
||||
'gateway_subscription_id' => [
|
||||
'description' => __('The ID of the subscription on the payment gateway database.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'description' => __('ID of the gateway being used on this subscription.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'signup_method' => array(
|
||||
],
|
||||
'signup_method' => [
|
||||
'description' => __('Signup method used to create this membership.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'upgraded_from' => array(
|
||||
],
|
||||
'upgraded_from' => [
|
||||
'description' => __('Plan that this membership upgraded from.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Date this membership was last modified.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'disabled' => array(
|
||||
],
|
||||
'disabled' => [
|
||||
'description' => __('If this membership is a disabled one.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'recurring' => array(
|
||||
],
|
||||
'recurring' => [
|
||||
'description' => __('If this membership is recurring (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -20,106 +20,106 @@ use WP_Ultimo\Database\Payments\Payment_Status;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'customer_id' => array(
|
||||
return [
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer attached to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'description' => __('The ID of the membership attached to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'parent_id' => array(
|
||||
],
|
||||
'parent_id' => [
|
||||
'description' => __('The ID from another payment that this payment is related to.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency of this payment. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'subtotal' => array(
|
||||
],
|
||||
'subtotal' => [
|
||||
'description' => __('Value before taxes, discounts, fees and other changes.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => true,
|
||||
),
|
||||
'refund_total' => array(
|
||||
],
|
||||
'refund_total' => [
|
||||
'description' => __('Total amount refunded.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'tax_total' => array(
|
||||
],
|
||||
'tax_total' => [
|
||||
'description' => __('The amount, in currency, of the tax.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'discount_code' => array(
|
||||
],
|
||||
'discount_code' => [
|
||||
'description' => __('Discount code used.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'total' => array(
|
||||
],
|
||||
'total' => [
|
||||
'description' => __('This takes into account fees, discounts and credits.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => true,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __("The payment status: Can be 'pending', 'completed', 'refunded', 'partially-refunded', 'partially-paid', 'failed', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => Payment_Status::get_allowed_list(),
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'description' => __('ID of the gateway being used on this payment.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'product_id' => array(
|
||||
],
|
||||
'product_id' => [
|
||||
'description' => __('The ID of the product of this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway_payment_id' => array(
|
||||
],
|
||||
'gateway_payment_id' => [
|
||||
'description' => __('The ID of the payment on the gateway, if it exists.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'discount_total' => array(
|
||||
],
|
||||
'discount_total' => [
|
||||
'description' => __('The total value of the discounts applied to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'invoice_number' => array(
|
||||
],
|
||||
'invoice_number' => [
|
||||
'description' => __('Sequential invoice number assigned to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'cancel_membership_on_refund' => array(
|
||||
],
|
||||
'cancel_membership_on_refund' => [
|
||||
'description' => __('Holds if we need to cancel the membership on refund.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -20,106 +20,106 @@ use WP_Ultimo\Database\Payments\Payment_Status;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'customer_id' => array(
|
||||
return [
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer attached to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'description' => __('The ID of the membership attached to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'parent_id' => array(
|
||||
],
|
||||
'parent_id' => [
|
||||
'description' => __('The ID from another payment that this payment is related to.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency of this payment. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'subtotal' => array(
|
||||
],
|
||||
'subtotal' => [
|
||||
'description' => __('Value before taxes, discounts, fees and other changes.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'refund_total' => array(
|
||||
],
|
||||
'refund_total' => [
|
||||
'description' => __('Total amount refunded.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'tax_total' => array(
|
||||
],
|
||||
'tax_total' => [
|
||||
'description' => __('The amount, in currency, of the tax.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'discount_code' => array(
|
||||
],
|
||||
'discount_code' => [
|
||||
'description' => __('Discount code used.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'total' => array(
|
||||
],
|
||||
'total' => [
|
||||
'description' => __('This takes into account fees, discounts and credits.', 'wp-ultimo'),
|
||||
'type' => 'number',
|
||||
'required' => false,
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
'status' => [
|
||||
'description' => __("The payment status: Can be 'pending', 'completed', 'refunded', 'partially-refunded', 'partially-paid', 'failed', 'cancelled' or other values added by third-party add-ons.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => Payment_Status::get_allowed_list(),
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'description' => __('ID of the gateway being used on this payment.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'product_id' => array(
|
||||
],
|
||||
'product_id' => [
|
||||
'description' => __('The ID of the product of this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'gateway_payment_id' => array(
|
||||
],
|
||||
'gateway_payment_id' => [
|
||||
'description' => __('The ID of the payment on the gateway, if it exists.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'discount_total' => array(
|
||||
],
|
||||
'discount_total' => [
|
||||
'description' => __('The total value of the discounts applied to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'invoice_number' => array(
|
||||
],
|
||||
'invoice_number' => [
|
||||
'description' => __('Sequential invoice number assigned to this payment.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'cancel_membership_on_refund' => array(
|
||||
],
|
||||
'cancel_membership_on_refund' => [
|
||||
'description' => __('Holds if we need to cancel the membership on refund.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,182 +18,182 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'featured_image_id' => array(
|
||||
return [
|
||||
'featured_image_id' => [
|
||||
'description' => __('The ID of the feature image of the product.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The product slug. It needs to be unique and preferably make it clear what it is about. Example: my_new_product.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('Your product name, which is used as product title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the product, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency that this product accepts. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'pricing_type' => array(
|
||||
],
|
||||
'pricing_type' => [
|
||||
'description' => __("The pricing type can be 'free', 'paid' or 'contact_us'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'free',
|
||||
'paid',
|
||||
'contact_us',
|
||||
),
|
||||
),
|
||||
'trial_duration' => array(
|
||||
],
|
||||
],
|
||||
'trial_duration' => [
|
||||
'description' => __('The duration of the trial period of this product, if the product has one.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'trial_duration_unit' => array(
|
||||
],
|
||||
'trial_duration_unit' => [
|
||||
'description' => __('The unit of the trial duration amount. Can be day, week, month or year.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'week',
|
||||
'month',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'duration' => array(
|
||||
],
|
||||
],
|
||||
'duration' => [
|
||||
'description' => __('Time interval between charges.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'duration_unit' => array(
|
||||
],
|
||||
'duration_unit' => [
|
||||
'description' => __('Time interval unit between charges.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'month',
|
||||
'week',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'amount' => array(
|
||||
],
|
||||
],
|
||||
'amount' => [
|
||||
'description' => __('The value of this product. E.g. 19.99.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'setup_fee' => array(
|
||||
],
|
||||
'setup_fee' => [
|
||||
'description' => __('The setup fee value, if the product has one. E.g. 159.99.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this product as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The default product types are 'product', 'service' and 'package'. More types can be add using the product type filter.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'plan',
|
||||
'service',
|
||||
'package',
|
||||
),
|
||||
),
|
||||
'parent_id' => array(
|
||||
],
|
||||
],
|
||||
'parent_id' => [
|
||||
'description' => __('The ID from another Product that this product is related to.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'recurring' => array(
|
||||
],
|
||||
'recurring' => [
|
||||
'description' => __('Set this product as a recurring one (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'billing_cycles' => array(
|
||||
],
|
||||
'billing_cycles' => [
|
||||
'description' => __('The number of times we should charge this product.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Date when this was last modified.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'taxable' => array(
|
||||
],
|
||||
'taxable' => [
|
||||
'description' => __('Set this product as a taxable one (true), which means tax rules are applied to, or not taxable (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'tax_category' => array(
|
||||
],
|
||||
'tax_category' => [
|
||||
'description' => __('Category of taxes applied to this product. You need to set this if taxable is set to true.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'contact_us_label' => array(
|
||||
],
|
||||
'contact_us_label' => [
|
||||
'description' => __("If the product is the 'contact_us' type, it will need a label for the contact us button.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'contact_us_link' => array(
|
||||
],
|
||||
'contact_us_link' => [
|
||||
'description' => __('The url where the contact us button will lead to.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'feature_list' => array(
|
||||
],
|
||||
'feature_list' => [
|
||||
'description' => __('A list (array) of features of the product.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'customer_role' => array(
|
||||
],
|
||||
'customer_role' => [
|
||||
'description' => __('The customer role of this product.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'available_addons' => array(
|
||||
],
|
||||
'available_addons' => [
|
||||
'description' => __('The available addons of this product.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'group' => array(
|
||||
],
|
||||
'group' => [
|
||||
'description' => __('The group of this product, if has any.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'legacy_options' => array(
|
||||
],
|
||||
'legacy_options' => [
|
||||
'description' => __('If the legacy options are enabled.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'featured_plan' => array(
|
||||
],
|
||||
'featured_plan' => [
|
||||
'description' => __('Feature list for pricing tables.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,182 +18,182 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'featured_image_id' => array(
|
||||
return [
|
||||
'featured_image_id' => [
|
||||
'description' => __('The ID of the feature image of the product.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __('The product slug. It needs to be unique and preferably make it clear what it is about. Example: my_new_product.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('Your product name, which is used as product title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the product, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'currency' => array(
|
||||
],
|
||||
'currency' => [
|
||||
'description' => __("The currency that this product accepts. It's a 3-letter code. E.g. 'USD'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'pricing_type' => array(
|
||||
],
|
||||
'pricing_type' => [
|
||||
'description' => __("The pricing type can be 'free', 'paid' or 'contact_us'.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'free',
|
||||
'paid',
|
||||
'contact_us',
|
||||
),
|
||||
),
|
||||
'trial_duration' => array(
|
||||
],
|
||||
],
|
||||
'trial_duration' => [
|
||||
'description' => __('The duration of the trial period of this product, if the product has one.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'trial_duration_unit' => array(
|
||||
],
|
||||
'trial_duration_unit' => [
|
||||
'description' => __('The unit of the trial duration amount. Can be day, week, month or year.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'week',
|
||||
'month',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'duration' => array(
|
||||
],
|
||||
],
|
||||
'duration' => [
|
||||
'description' => __('Time interval between charges.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'duration_unit' => array(
|
||||
],
|
||||
'duration_unit' => [
|
||||
'description' => __('Time interval unit between charges.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'day',
|
||||
'month',
|
||||
'week',
|
||||
'year',
|
||||
),
|
||||
),
|
||||
'amount' => array(
|
||||
],
|
||||
],
|
||||
'amount' => [
|
||||
'description' => __('The value of this product. E.g. 19.99.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'setup_fee' => array(
|
||||
],
|
||||
'setup_fee' => [
|
||||
'description' => __('The setup fee value, if the product has one. E.g. 159.99.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this product as active (true), which means available to be used, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __("The default product types are 'product', 'service' and 'package'. More types can be add using the product type filter.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'plan',
|
||||
'service',
|
||||
'package',
|
||||
),
|
||||
),
|
||||
'parent_id' => array(
|
||||
],
|
||||
],
|
||||
'parent_id' => [
|
||||
'description' => __('The ID from another Product that this product is related to.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'recurring' => array(
|
||||
],
|
||||
'recurring' => [
|
||||
'description' => __('Set this product as a recurring one (true), which means the customer paid a defined amount each period of time, or not recurring (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'billing_cycles' => array(
|
||||
],
|
||||
'billing_cycles' => [
|
||||
'description' => __('The number of times we should charge this product.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Date when this was last modified.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'taxable' => array(
|
||||
],
|
||||
'taxable' => [
|
||||
'description' => __('Set this product as a taxable one (true), which means tax rules are applied to, or not taxable (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'tax_category' => array(
|
||||
],
|
||||
'tax_category' => [
|
||||
'description' => __('Category of taxes applied to this product. You need to set this if taxable is set to true.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'contact_us_label' => array(
|
||||
],
|
||||
'contact_us_label' => [
|
||||
'description' => __("If the product is the 'contact_us' type, it will need a label for the contact us button.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'contact_us_link' => array(
|
||||
],
|
||||
'contact_us_link' => [
|
||||
'description' => __('The url where the contact us button will lead to.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'feature_list' => array(
|
||||
],
|
||||
'feature_list' => [
|
||||
'description' => __('A list (array) of features of the product.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'customer_role' => array(
|
||||
],
|
||||
'customer_role' => [
|
||||
'description' => __('The customer role of this product.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'available_addons' => array(
|
||||
],
|
||||
'available_addons' => [
|
||||
'description' => __('The available addons of this product.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'group' => array(
|
||||
],
|
||||
'group' => [
|
||||
'description' => __('The group of this product, if has any.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'legacy_options' => array(
|
||||
],
|
||||
'legacy_options' => [
|
||||
'description' => __('If the legacy options are enabled.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'featured_plan' => array(
|
||||
],
|
||||
'featured_plan' => [
|
||||
'description' => __('Feature list for pricing tables.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,148 +18,148 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'categories' => array(
|
||||
return [
|
||||
'categories' => [
|
||||
'description' => __('The categories this site belongs to.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'featured_image_id' => array(
|
||||
],
|
||||
'featured_image_id' => [
|
||||
'description' => __('The ID of the feature image of the site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'site_id' => array(
|
||||
],
|
||||
'site_id' => [
|
||||
'description' => __('The network ID for this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('The site title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('The site name.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the site, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'domain' => array(
|
||||
],
|
||||
'domain' => [
|
||||
'description' => __("The site domain. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'path' => array(
|
||||
],
|
||||
'path' => [
|
||||
'description' => __('Path of the site. Used when in sub-directory mode.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'registered' => array(
|
||||
],
|
||||
'registered' => [
|
||||
'description' => __('Date when the site was registered.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'last_updated' => array(
|
||||
],
|
||||
'last_updated' => [
|
||||
'description' => __('Date of the last update on this site.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Holds the ID of the customer that owns this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'public' => array(
|
||||
],
|
||||
'public' => [
|
||||
'description' => __('Set true if this site is a public one, false if not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'archived' => array(
|
||||
],
|
||||
'archived' => [
|
||||
'description' => __('Is this an archived site.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'mature' => array(
|
||||
],
|
||||
'mature' => [
|
||||
'description' => __('Is this a site with mature content.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'spam' => array(
|
||||
],
|
||||
'spam' => [
|
||||
'description' => __('Is this an spam site.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'deleted' => array(
|
||||
],
|
||||
'deleted' => [
|
||||
'description' => __('Is this site deleted.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'lang_id' => array(
|
||||
],
|
||||
'lang_id' => [
|
||||
'description' => __('The ID of the language being used on this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'customer_id' => array(
|
||||
],
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer that owns this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'description' => __('The ID of the membership associated with this site, if any.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
),
|
||||
'template_id' => array(
|
||||
],
|
||||
'template_id' => [
|
||||
'description' => __('The ID of the templated used to create this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type of this particular site. Can be default, site_template, customer_owned, pending, external, main or other values added by third-party add-ons.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'default',
|
||||
'site_template',
|
||||
'customer_owned',
|
||||
'pending',
|
||||
'external',
|
||||
'main',
|
||||
),
|
||||
),
|
||||
'signup_options' => array(
|
||||
],
|
||||
],
|
||||
'signup_options' => [
|
||||
'description' => __('Keeps signup options for the site.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'signup_meta' => array(
|
||||
],
|
||||
'signup_meta' => [
|
||||
'description' => __('Keeps signup meta for the site.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,148 +18,148 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'categories' => array(
|
||||
return [
|
||||
'categories' => [
|
||||
'description' => __('The categories this site belongs to.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'featured_image_id' => array(
|
||||
],
|
||||
'featured_image_id' => [
|
||||
'description' => __('The ID of the feature image of the site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'site_id' => array(
|
||||
],
|
||||
'site_id' => [
|
||||
'description' => __('The network ID for this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'title' => array(
|
||||
],
|
||||
'title' => [
|
||||
'description' => __('The site title.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'name' => array(
|
||||
],
|
||||
'name' => [
|
||||
'description' => __('The site name.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'description' => array(
|
||||
],
|
||||
'description' => [
|
||||
'description' => __('A description for the site, usually a short text.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'domain' => array(
|
||||
],
|
||||
'domain' => [
|
||||
'description' => __("The site domain. You don't need to put http or https in front of your domain in this field. e.g: example.com.", 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'path' => array(
|
||||
],
|
||||
'path' => [
|
||||
'description' => __('Path of the site. Used when in sub-directory mode.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'registered' => array(
|
||||
],
|
||||
'registered' => [
|
||||
'description' => __('Date when the site was registered.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'last_updated' => array(
|
||||
],
|
||||
'last_updated' => [
|
||||
'description' => __('Date of the last update on this site.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Holds the ID of the customer that owns this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'public' => array(
|
||||
],
|
||||
'public' => [
|
||||
'description' => __('Set true if this site is a public one, false if not.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'archived' => array(
|
||||
],
|
||||
'archived' => [
|
||||
'description' => __('Is this an archived site.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'mature' => array(
|
||||
],
|
||||
'mature' => [
|
||||
'description' => __('Is this a site with mature content.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'spam' => array(
|
||||
],
|
||||
'spam' => [
|
||||
'description' => __('Is this an spam site.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'deleted' => array(
|
||||
],
|
||||
'deleted' => [
|
||||
'description' => __('Is this site deleted.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'lang_id' => array(
|
||||
],
|
||||
'lang_id' => [
|
||||
'description' => __('The ID of the language being used on this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'customer_id' => array(
|
||||
],
|
||||
'customer_id' => [
|
||||
'description' => __('The ID of the customer that owns this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'membership_id' => array(
|
||||
],
|
||||
'membership_id' => [
|
||||
'description' => __('The ID of the membership associated with this site, if any.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'template_id' => array(
|
||||
],
|
||||
'template_id' => [
|
||||
'description' => __('The ID of the templated used to create this site.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'type' => array(
|
||||
],
|
||||
'type' => [
|
||||
'description' => __('The type of this particular site. Can be default, site_template, customer_owned, pending, external, main or other values added by third-party add-ons.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
'enum' => array(
|
||||
'enum' => [
|
||||
'default',
|
||||
'site_template',
|
||||
'customer_owned',
|
||||
'pending',
|
||||
'external',
|
||||
'main',
|
||||
),
|
||||
),
|
||||
'signup_options' => array(
|
||||
],
|
||||
],
|
||||
'signup_options' => [
|
||||
'description' => __('Keeps signup options for the site.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'signup_meta' => array(
|
||||
],
|
||||
'signup_meta' => [
|
||||
'description' => __('Keeps signup meta for the site.', 'wp-ultimo'),
|
||||
'type' => 'array',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Model creation date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,65 +18,65 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'name' => array(
|
||||
return [
|
||||
'name' => [
|
||||
'description' => __('Webhook name, which is used as product title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'webhook_url' => array(
|
||||
],
|
||||
'webhook_url' => [
|
||||
'description' => __('The URL used for the webhook call.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
'event' => [
|
||||
'description' => __('The event that needs to be fired for this webhook to be sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'event_count' => array(
|
||||
],
|
||||
'event_count' => [
|
||||
'description' => __('How many times this webhook was sent.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this webhook as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'hidden' => array(
|
||||
],
|
||||
'hidden' => [
|
||||
'description' => __('Is this webhook hidden.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'integration' => array(
|
||||
],
|
||||
'integration' => [
|
||||
'description' => __('The integration that created this webhook.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
),
|
||||
'date_last_failed' => array(
|
||||
],
|
||||
'date_last_failed' => [
|
||||
'description' => __('The date when this webhook last fail.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -18,65 +18,65 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
return array(
|
||||
'name' => array(
|
||||
return [
|
||||
'name' => [
|
||||
'description' => __('Webhook name, which is used as product title as well.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'webhook_url' => array(
|
||||
],
|
||||
'webhook_url' => [
|
||||
'description' => __('The URL used for the webhook call.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'event' => array(
|
||||
],
|
||||
'event' => [
|
||||
'description' => __('The event that needs to be fired for this webhook to be sent.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'event_count' => array(
|
||||
],
|
||||
'event_count' => [
|
||||
'description' => __('How many times this webhook was sent.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'description' => __('Set this webhook as active (true), which means available will fire when the event occur, or inactive (false).', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'hidden' => array(
|
||||
],
|
||||
'hidden' => [
|
||||
'description' => __('Is this webhook hidden.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __('Date when this was created.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'integration' => array(
|
||||
],
|
||||
'integration' => [
|
||||
'description' => __('The integration that created this webhook.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_last_failed' => array(
|
||||
],
|
||||
'date_last_failed' => [
|
||||
'description' => __('The date when this webhook last fail.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'date_modified' => array(
|
||||
],
|
||||
'date_modified' => [
|
||||
'description' => __('Model last modification date.', 'wp-ultimo'),
|
||||
'type' => 'string',
|
||||
'required' => false,
|
||||
),
|
||||
'migrated_from_id' => array(
|
||||
],
|
||||
'migrated_from_id' => [
|
||||
'description' => __('The ID of the original 1.X model that was used to generate this item on migration.', 'wp-ultimo'),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
),
|
||||
'skip_validation' => array(
|
||||
],
|
||||
'skip_validation' => [
|
||||
'description' => __('Set true to have field information validation bypassed when saving this event.', 'wp-ultimo'),
|
||||
'type' => 'boolean',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
@ -28,13 +28,13 @@ trait Rest_Api {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $enabled_rest_endpoints = array(
|
||||
protected $enabled_rest_endpoints = [
|
||||
'get_item',
|
||||
'get_items',
|
||||
'create_item',
|
||||
'update_item',
|
||||
'delete_item',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the base used right after the namespace.
|
||||
@ -54,14 +54,14 @@ trait Rest_Api {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function enable_rest_api() {
|
||||
public function enable_rest_api(): void {
|
||||
|
||||
$is_enabled = \WP_Ultimo\API::get_instance()->is_api_enabled();
|
||||
|
||||
if ($is_enabled) {
|
||||
add_action('rest_api_init', array($this, 'register_routes_general'));
|
||||
add_action('rest_api_init', [$this, 'register_routes_general']);
|
||||
|
||||
add_action('rest_api_init', array($this, 'register_routes_with_id'));
|
||||
add_action('rest_api_init', [$this, 'register_routes_with_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,27 +71,27 @@ trait Rest_Api {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function register_routes_general() {
|
||||
public function register_routes_general(): void {
|
||||
|
||||
$routes = array();
|
||||
$routes = [];
|
||||
|
||||
if (in_array('get_items', $this->enabled_rest_endpoints, true)) {
|
||||
$routes = array(
|
||||
array(
|
||||
$routes = [
|
||||
[
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items_rest'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
),
|
||||
);
|
||||
'callback' => [$this, 'get_items_rest'],
|
||||
'permission_callback' => [$this, 'get_items_permissions_check'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if (in_array('create_item', $this->enabled_rest_endpoints, true)) {
|
||||
$routes[] = array(
|
||||
$routes[] = [
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array($this, 'create_item_rest'),
|
||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||
'callback' => [$this, 'create_item_rest'],
|
||||
'permission_callback' => [$this, 'create_item_permissions_check'],
|
||||
'args' => $this->get_arguments_schema(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if ( ! empty($routes)) {
|
||||
@ -112,33 +112,33 @@ trait Rest_Api {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function register_routes_with_id() {
|
||||
public function register_routes_with_id(): void {
|
||||
|
||||
$routes = array();
|
||||
$routes = [];
|
||||
|
||||
if (in_array('get_item', $this->enabled_rest_endpoints, true)) {
|
||||
$routes[] = array(
|
||||
$routes[] = [
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item_rest'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
);
|
||||
'callback' => [$this, 'get_item_rest'],
|
||||
'permission_callback' => [$this, 'get_item_permissions_check'],
|
||||
];
|
||||
}
|
||||
|
||||
if (in_array('update_item', $this->enabled_rest_endpoints, true)) {
|
||||
$routes[] = array(
|
||||
$routes[] = [
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array($this, 'update_item_rest'),
|
||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||
'callback' => [$this, 'update_item_rest'],
|
||||
'permission_callback' => [$this, 'update_item_permissions_check'],
|
||||
'args' => $this->get_arguments_schema(true),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if (in_array('delete_item', $this->enabled_rest_endpoints, true)) {
|
||||
$routes[] = array(
|
||||
$routes[] = [
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item_rest'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
);
|
||||
'callback' => [$this, 'delete_item_rest'],
|
||||
'permission_callback' => [$this, 'delete_item_permissions_check'],
|
||||
];
|
||||
}
|
||||
|
||||
if ( ! empty($routes)) {
|
||||
@ -165,7 +165,7 @@ trait Rest_Api {
|
||||
$item = $this->model_class::get_by_id($request['id']);
|
||||
|
||||
if (empty($item)) {
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
|
||||
}
|
||||
|
||||
return rest_ensure_response($item);
|
||||
@ -196,7 +196,7 @@ trait Rest_Api {
|
||||
|
||||
$body = json_decode($request->get_body(), true);
|
||||
|
||||
$model_name = (new $this->model_class(array()))->model;
|
||||
$model_name = (new $this->model_class([]))->model;
|
||||
|
||||
$saver_function = "wu_create_{$model_name}";
|
||||
|
||||
@ -215,7 +215,7 @@ trait Rest_Api {
|
||||
}
|
||||
|
||||
if ( ! $saved) {
|
||||
return new \WP_Error("wu_rest_{$this->slug}", __('Something went wrong (Code 1).', 'wp-ultimo'), array('status' => 400));
|
||||
return new \WP_Error("wu_rest_{$this->slug}", __('Something went wrong (Code 1).', 'wp-ultimo'), ['status' => 400]);
|
||||
}
|
||||
|
||||
return rest_ensure_response($item);
|
||||
@ -235,12 +235,12 @@ trait Rest_Api {
|
||||
$item = $this->model_class::get_by_id($id);
|
||||
|
||||
if (empty($item)) {
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
|
||||
}
|
||||
|
||||
$params = array_filter(
|
||||
json_decode($request->get_body(), true),
|
||||
array($this, 'is_not_credential_key'),
|
||||
[$this, 'is_not_credential_key'],
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
|
||||
@ -250,7 +250,7 @@ trait Rest_Api {
|
||||
if ($param === 'meta') {
|
||||
$item->update_meta_batch($value);
|
||||
} elseif (method_exists($item, $set_method)) {
|
||||
call_user_func(array($item, $set_method), $value);
|
||||
call_user_func([$item, $set_method], $value);
|
||||
} else {
|
||||
$error_message = sprintf(
|
||||
/* translators: 1. Object class name; 2. Set method name */
|
||||
@ -262,7 +262,7 @@ trait Rest_Api {
|
||||
return new \WP_Error(
|
||||
"wu_rest_{$this->slug}_invalid_set_method",
|
||||
$error_message,
|
||||
array('status' => 400)
|
||||
['status' => 400]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -292,7 +292,7 @@ trait Rest_Api {
|
||||
$item = $this->model_class::get_by_id($request['id']);
|
||||
|
||||
if (empty($item)) {
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), array('status' => 404));
|
||||
return new \WP_Error("wu_rest_{$this->slug}_invalid_id", __('Item not found.', 'wp-ultimo'), ['status' => 404]);
|
||||
}
|
||||
|
||||
$result = $item->delete();
|
||||
@ -440,12 +440,12 @@ trait Rest_Api {
|
||||
*/
|
||||
private function is_not_credential_key($value) {
|
||||
|
||||
$credentials_keys = array(
|
||||
$credentials_keys = [
|
||||
'api_key',
|
||||
'api_secret',
|
||||
'api-key',
|
||||
'api-secret',
|
||||
);
|
||||
];
|
||||
|
||||
return ! in_array($value, $credentials_keys, true);
|
||||
}
|
||||
@ -460,15 +460,15 @@ trait Rest_Api {
|
||||
*/
|
||||
private function is_not_id_key($value) {
|
||||
|
||||
$arr = array(
|
||||
$arr = [
|
||||
'id',
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->slug === 'site') {
|
||||
$arr = array(
|
||||
$arr = [
|
||||
'id',
|
||||
'blog_id',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return ! in_array($value, $arr, true);
|
||||
@ -486,7 +486,7 @@ trait Rest_Api {
|
||||
|
||||
$schema = wu_rest_get_endpoint_schema($this->model_class, $edit ? 'update' : 'create', true);
|
||||
|
||||
$args = array_filter($schema, array($this, 'is_not_id_key'), ARRAY_FILTER_USE_KEY);
|
||||
$args = array_filter($schema, [$this, 'is_not_id_key'], ARRAY_FILTER_USE_KEY);
|
||||
|
||||
return $this->filter_schema_arguments($args);
|
||||
}
|
||||
@ -521,12 +521,12 @@ trait Rest_Api {
|
||||
|
||||
$remove_status = apply_filters(
|
||||
"wu_api_{$this->slug}_remove_status",
|
||||
array(
|
||||
[
|
||||
'broadcast',
|
||||
'membership',
|
||||
'product',
|
||||
'payment',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! in_array($this->slug, $remove_status, true) && isset($args['status'])) {
|
||||
@ -535,12 +535,12 @@ trait Rest_Api {
|
||||
|
||||
$remove_slug = apply_filters(
|
||||
"wu_api_{$this->slug}_remove_slug",
|
||||
array(
|
||||
[
|
||||
'broadcast',
|
||||
'product',
|
||||
'checkout_form',
|
||||
'event',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! in_array($this->slug, $remove_slug, true) && isset($args['slug'])) {
|
||||
|
@ -28,7 +28,7 @@ trait WP_CLI {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $wp_cli_enabled_sub_commands = array();
|
||||
protected $wp_cli_enabled_sub_commands = [];
|
||||
|
||||
/**
|
||||
* Returns the base used right after the root.
|
||||
@ -48,7 +48,7 @@ trait WP_CLI {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function enable_wp_cli() {
|
||||
public function enable_wp_cli(): void {
|
||||
|
||||
if ( ! defined('WP_CLI')) {
|
||||
return;
|
||||
@ -62,9 +62,9 @@ trait WP_CLI {
|
||||
\WP_CLI::add_command(
|
||||
"{$wp_cli_root} {$this->get_wp_cli_command_base()} {$sub_command}",
|
||||
$sub_command_data['callback'],
|
||||
array(
|
||||
[
|
||||
'synopsis' => $sub_command_data['synopsis'],
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -72,25 +72,25 @@ trait WP_CLI {
|
||||
/**
|
||||
* Set wP-CLI Sub-command enabled for this entity.
|
||||
*/
|
||||
public function set_wp_cli_enabled_sub_commands() {
|
||||
public function set_wp_cli_enabled_sub_commands(): void {
|
||||
|
||||
$sub_commands = array(
|
||||
'get' => array(
|
||||
'callback' => array($this, 'wp_cli_get_item'),
|
||||
),
|
||||
'list' => array(
|
||||
'callback' => array($this, 'wp_cli_get_items'),
|
||||
),
|
||||
'create' => array(
|
||||
'callback' => array($this, 'wp_cli_create_item'),
|
||||
),
|
||||
'update' => array(
|
||||
'callback' => array($this, 'wp_cli_update_item'),
|
||||
),
|
||||
'delete' => array(
|
||||
'callback' => array($this, 'wp_cli_delete_item'),
|
||||
),
|
||||
);
|
||||
$sub_commands = [
|
||||
'get' => [
|
||||
'callback' => [$this, 'wp_cli_get_item'],
|
||||
],
|
||||
'list' => [
|
||||
'callback' => [$this, 'wp_cli_get_items'],
|
||||
],
|
||||
'create' => [
|
||||
'callback' => [$this, 'wp_cli_create_item'],
|
||||
],
|
||||
'update' => [
|
||||
'callback' => [$this, 'wp_cli_update_item'],
|
||||
],
|
||||
'delete' => [
|
||||
'callback' => [$this, 'wp_cli_delete_item'],
|
||||
],
|
||||
];
|
||||
|
||||
$params = array_merge($this->wp_cli_get_fields(), $this->wp_cli_extra_parameters());
|
||||
|
||||
@ -101,42 +101,42 @@ trait WP_CLI {
|
||||
*/
|
||||
$params_to_remove = apply_filters(
|
||||
'wu_cli_params_to_remove',
|
||||
array(
|
||||
[
|
||||
'id',
|
||||
'model',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$params = array_filter($params, fn($param) => ! in_array($param, $params_to_remove, true));
|
||||
|
||||
foreach ($sub_commands as $sub_command => &$sub_command_data) {
|
||||
$sub_command_data['synopsis'] = array();
|
||||
$sub_command_data['synopsis'] = [];
|
||||
|
||||
if (in_array($sub_command, array('get', 'update', 'delete'), true)) {
|
||||
$sub_command_data['synopsis'][] = array(
|
||||
if (in_array($sub_command, ['get', 'update', 'delete'], true)) {
|
||||
$sub_command_data['synopsis'][] = [
|
||||
'name' => 'id',
|
||||
'type' => 'positional',
|
||||
'description' => __('The id for the resource.', 'wp-ultimo'),
|
||||
'optional' => false,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if (in_array($sub_command, array('list', 'update', 'create'), true)) {
|
||||
if (in_array($sub_command, ['list', 'update', 'create'], true)) {
|
||||
$explanation_list = wu_rest_get_endpoint_schema($this->model_class, 'update');
|
||||
|
||||
foreach ($params as $name) {
|
||||
$explanation = wu_get_isset($explanation_list, $name, array());
|
||||
$explanation = wu_get_isset($explanation_list, $name, []);
|
||||
|
||||
$type = wu_get_isset($explanation, 'type', 'assoc');
|
||||
|
||||
$field = array(
|
||||
$field = [
|
||||
'name' => $name,
|
||||
'description' => wu_get_isset($explanation, 'description', __('No description found.', 'wp-ultimo')),
|
||||
'optional' => ! wu_get_isset($explanation, 'required'),
|
||||
'type' => 'assoc',
|
||||
);
|
||||
];
|
||||
|
||||
$options = wu_get_isset($explanation, 'options', array());
|
||||
$options = wu_get_isset($explanation, 'options', []);
|
||||
|
||||
if ($options) {
|
||||
$field['options'] = $options;
|
||||
@ -146,39 +146,39 @@ trait WP_CLI {
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($sub_command, array('create', 'update'), true)) {
|
||||
$sub_command_data['synopsis'][] = array(
|
||||
if (in_array($sub_command, ['create', 'update'], true)) {
|
||||
$sub_command_data['synopsis'][] = [
|
||||
'name' => 'porcelain',
|
||||
'type' => 'flag',
|
||||
'description' => __('Output just the id when the operation is successful.', 'wp-ultimo'),
|
||||
'optional' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if (in_array($sub_command, array('list', 'get'), true)) {
|
||||
$sub_command_data['synopsis'][] = array(
|
||||
if (in_array($sub_command, ['list', 'get'], true)) {
|
||||
$sub_command_data['synopsis'][] = [
|
||||
'name' => 'format',
|
||||
'type' => 'assoc',
|
||||
'description' => __('Render response in a particular format.', 'wp-ultimo'),
|
||||
'optional' => true,
|
||||
'default' => 'table',
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'table',
|
||||
'json',
|
||||
'csv',
|
||||
'ids',
|
||||
'yaml',
|
||||
'count',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$sub_command_data['synopsis'][] = array(
|
||||
$sub_command_data['synopsis'][] = [
|
||||
'name' => 'fields',
|
||||
'type' => 'assoc',
|
||||
'description' => __('Limit response to specific fields. Defaults to id, name', 'wp-ultimo'),
|
||||
'optional' => true,
|
||||
'options' => array_merge(array('id'), $params),
|
||||
);
|
||||
'options' => array_merge(['id'], $params),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ trait WP_CLI {
|
||||
* @param array $args Positional arguments passed. ID expected.
|
||||
* @param array $array_assoc Assoc arguments passed.
|
||||
*/
|
||||
public function wp_cli_get_item($args, $array_assoc) {
|
||||
public function wp_cli_get_item($args, $array_assoc): void {
|
||||
|
||||
$item = $this->model_class::get_by_id($args[0]);
|
||||
|
||||
@ -256,7 +256,7 @@ trait WP_CLI {
|
||||
* @param array $args Positional arguments passed. ID expected.
|
||||
* @param array $array_assoc Assoc arguments passed.
|
||||
*/
|
||||
public function wp_cli_get_items($args, $array_assoc) {
|
||||
public function wp_cli_get_items($args, $array_assoc): void {
|
||||
|
||||
$fields = (! empty($array_assoc['fields'])) ? $array_assoc['fields'] : $this->wp_cli_get_fields();
|
||||
|
||||
@ -277,7 +277,7 @@ trait WP_CLI {
|
||||
* @param array $args Positional arguments passed. ID expected.
|
||||
* @param array $array_assoc Assoc arguments passed.
|
||||
*/
|
||||
public function wp_cli_create_item($args, $array_assoc) {
|
||||
public function wp_cli_create_item($args, $array_assoc): void {
|
||||
|
||||
$item = new $this->model_class($array_assoc);
|
||||
|
||||
@ -306,7 +306,7 @@ trait WP_CLI {
|
||||
* @param array $args Positional arguments passed. ID expected.
|
||||
* @param array $array_assoc Assoc arguments passed.
|
||||
*/
|
||||
public function wp_cli_update_item($args, $array_assoc) {
|
||||
public function wp_cli_update_item($args, $array_assoc): void {
|
||||
|
||||
$item = $this->model_class::get_by_id($args[0]);
|
||||
|
||||
@ -330,7 +330,7 @@ trait WP_CLI {
|
||||
if ($param === 'meta') {
|
||||
$item->update_meta_batch($value);
|
||||
} elseif (method_exists($item, $set_method)) {
|
||||
call_user_func(array($item, $set_method), $value);
|
||||
call_user_func([$item, $set_method], $value);
|
||||
} else {
|
||||
$error_message = sprintf(
|
||||
/* translators: 1. Object class name; 2. Set method name */
|
||||
@ -367,7 +367,7 @@ trait WP_CLI {
|
||||
*
|
||||
* @param array $args Positional arguments passed. ID expected.
|
||||
*/
|
||||
public function wp_cli_delete_item($args) {
|
||||
public function wp_cli_delete_item($args): void {
|
||||
|
||||
$item = $this->model_class::get_by_id($args[0]);
|
||||
|
||||
|
@ -29,14 +29,14 @@ class Block_Editor_Widget_Manager {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
if (\WP_Ultimo\Compat\Gutenberg_Support::get_instance()->should_load()) {
|
||||
add_action('wu_element_loaded', array($this, 'handle_element'));
|
||||
add_action('wu_element_loaded', [$this, 'handle_element']);
|
||||
|
||||
add_action('init', array($this, 'register_scripts'));
|
||||
add_action('init', [$this, 'register_scripts']);
|
||||
|
||||
add_action('wu_element_is_preview', array($this, 'is_block_preview'));
|
||||
add_action('wu_element_is_preview', [$this, 'is_block_preview']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,11 +46,11 @@ class Block_Editor_Widget_Manager {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-blocks', wu_get_asset('blocks.js', 'js', 'inc/builders/block-editor/assets'), array('underscore', 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wu-functions', 'wp-i18n', 'wp-polyfill'));
|
||||
\WP_Ultimo\Scripts::get_instance()->register_script('wu-blocks', wu_get_asset('blocks.js', 'js', 'inc/builders/block-editor/assets'), ['underscore', 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wu-functions', 'wp-i18n', 'wp-polyfill']);
|
||||
|
||||
$blocks = apply_filters('wu_blocks', array());
|
||||
$blocks = apply_filters('wu_blocks', []);
|
||||
|
||||
wp_localize_script('wu-blocks', 'wu_blocks', $blocks);
|
||||
}
|
||||
@ -79,7 +79,7 @@ class Block_Editor_Widget_Manager {
|
||||
* @param \WP_Ultimo\UI\Base_Element $element The element being registered.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_element($element) {
|
||||
public function handle_element($element): void {
|
||||
|
||||
if (wu_get_current_site()->get_type() === Site_Type::CUSTOMER_OWNED) {
|
||||
return;
|
||||
@ -98,7 +98,7 @@ class Block_Editor_Widget_Manager {
|
||||
* @param \WP_Ultimo\UI\Base_Element $element The element being registered.
|
||||
* @return void
|
||||
*/
|
||||
public function register_block($element) {
|
||||
public function register_block($element): void {
|
||||
|
||||
if (\WP_Block_Type_Registry::get_instance()->is_registered($element->get_id())) {
|
||||
return;
|
||||
@ -108,11 +108,11 @@ class Block_Editor_Widget_Manager {
|
||||
|
||||
register_block_type(
|
||||
$element->get_id(),
|
||||
array(
|
||||
[
|
||||
'attributes' => $attributes,
|
||||
'editor_script' => 'wu-blocks',
|
||||
'render_callback' => \Closure::fromCallable(array($element, 'display')),
|
||||
)
|
||||
'render_callback' => \Closure::fromCallable([$element, 'display']),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -126,20 +126,20 @@ class Block_Editor_Widget_Manager {
|
||||
*/
|
||||
protected function consolidate_callables($fields) {
|
||||
|
||||
$callable_keys = array(
|
||||
$callable_keys = [
|
||||
'options',
|
||||
'value',
|
||||
);
|
||||
];
|
||||
|
||||
$fields_to_ignore = array(
|
||||
$fields_to_ignore = [
|
||||
'note',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($fields as $field_slug => &$field) {
|
||||
/*
|
||||
* Discard fields that are notes and start with _
|
||||
*/
|
||||
if (in_array($field['type'], $fields_to_ignore, true) && strncmp($field_slug, '_', strlen('_')) === 0) {
|
||||
if (in_array($field['type'], $fields_to_ignore, true) && str_starts_with($field_slug, '_')) {
|
||||
unset($fields[ $field_slug ]);
|
||||
}
|
||||
|
||||
@ -184,13 +184,13 @@ class Block_Editor_Widget_Manager {
|
||||
|
||||
$fields = $this->consolidate_callables($element->fields());
|
||||
|
||||
$blocks[] = array(
|
||||
$blocks[] = [
|
||||
'id' => $element->get_id(),
|
||||
'title' => $element->get_title(),
|
||||
'description' => $element->get_description(),
|
||||
'fields' => $fields,
|
||||
'keywords' => $element->keywords(),
|
||||
);
|
||||
];
|
||||
|
||||
return $blocks;
|
||||
}
|
||||
@ -208,7 +208,7 @@ class Block_Editor_Widget_Manager {
|
||||
|
||||
$defaults = $element->defaults();
|
||||
|
||||
$_fields = array();
|
||||
$_fields = [];
|
||||
|
||||
foreach ($fields as $field_id => $field) {
|
||||
$type = 'string';
|
||||
@ -223,10 +223,10 @@ class Block_Editor_Widget_Manager {
|
||||
|
||||
$default_value = wu_get_isset($defaults, $field_id, '');
|
||||
|
||||
$_fields[ $field_id ] = array(
|
||||
$_fields[ $field_id ] = [
|
||||
'default' => wu_get_isset($field, 'value', $default_value),
|
||||
'type' => $type,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $_fields;
|
||||
|
@ -179,7 +179,7 @@ class Cart implements \JsonSerializable {
|
||||
* @since 2.0.0
|
||||
* @var \WP_Ultimo\Models\Product[]
|
||||
*/
|
||||
protected $products = array();
|
||||
protected $products = [];
|
||||
|
||||
/**
|
||||
* The cart recurring products.
|
||||
@ -187,7 +187,7 @@ class Cart implements \JsonSerializable {
|
||||
* @since 2.0.0
|
||||
* @var \WP_Ultimo\Models\Product[]
|
||||
*/
|
||||
protected $recurring_products = array();
|
||||
protected $recurring_products = [];
|
||||
|
||||
/**
|
||||
* The cart additional products.
|
||||
@ -195,7 +195,7 @@ class Cart implements \JsonSerializable {
|
||||
* @since 2.0.0
|
||||
* @var \WP_Ultimo\Models\Product[]
|
||||
*/
|
||||
protected $additional_products = array();
|
||||
protected $additional_products = [];
|
||||
|
||||
/**
|
||||
* Line item representation of the products.
|
||||
@ -203,7 +203,7 @@ class Cart implements \JsonSerializable {
|
||||
* @since 2.0.0
|
||||
* @var \WP_Ultimo\Checkout\Line_Item[]
|
||||
*/
|
||||
protected $line_items = array();
|
||||
protected $line_items = [];
|
||||
|
||||
/**
|
||||
* If this cart should auto-renew.
|
||||
@ -227,7 +227,7 @@ class Cart implements \JsonSerializable {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $extra = array();
|
||||
protected $extra = [];
|
||||
|
||||
/**
|
||||
* The cart description.
|
||||
@ -255,7 +255,7 @@ class Cart implements \JsonSerializable {
|
||||
* this helps us to keep things cleaner and secure.
|
||||
*/
|
||||
$args = shortcode_atts(
|
||||
array(
|
||||
[
|
||||
|
||||
/*
|
||||
* Cart Type.
|
||||
@ -265,7 +265,7 @@ class Cart implements \JsonSerializable {
|
||||
/*
|
||||
* The list of products being bought.
|
||||
*/
|
||||
'products' => array(),
|
||||
'products' => [],
|
||||
|
||||
/*
|
||||
* The duration parameters
|
||||
@ -309,7 +309,7 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
'currency' => '',
|
||||
|
||||
),
|
||||
],
|
||||
$args
|
||||
);
|
||||
|
||||
@ -411,7 +411,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param mixed $value The value to set.
|
||||
* @return void
|
||||
*/
|
||||
public function set_param($key, $value) {
|
||||
public function set_param($key, $value): void {
|
||||
|
||||
$this->extra[] = $key;
|
||||
|
||||
@ -504,7 +504,7 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$desc = wu_get_setting('company_name', __('Subscription', 'wp-ultimo'));
|
||||
|
||||
$products = array();
|
||||
$products = [];
|
||||
|
||||
foreach ($this->get_line_items() as $line_item) {
|
||||
$product = $line_item->get_product();
|
||||
@ -529,7 +529,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param string $descriptor The cart description.
|
||||
* @return void
|
||||
*/
|
||||
public function set_cart_descriptor($descriptor) {
|
||||
public function set_cart_descriptor($descriptor): void {
|
||||
|
||||
$this->cart_descriptor = $descriptor;
|
||||
}
|
||||
@ -568,7 +568,7 @@ class Cart implements \JsonSerializable {
|
||||
/*
|
||||
* Adds the country to calculate taxes.
|
||||
*/
|
||||
$this->country = $this->country ? $this->country : ($this->customer ? $this->customer->get_country() : '');
|
||||
$this->country = ($this->country ?: $this->customer) ? $this->customer->get_country() : '';
|
||||
|
||||
/*
|
||||
* Set the currency in cart
|
||||
@ -676,9 +676,9 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
$allowed_status = apply_filters(
|
||||
'wu_cart_set_payment_allowed_status',
|
||||
array(
|
||||
[
|
||||
'pending',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ( ! in_array($payment->get_status(), $allowed_status, true)) {
|
||||
@ -768,7 +768,7 @@ class Cart implements \JsonSerializable {
|
||||
/*
|
||||
* Adds the country to calculate taxes.
|
||||
*/
|
||||
$this->country = $this->country ? $this->country : $this->customer->get_country();
|
||||
$this->country = $this->country ?: $this->customer->get_country();
|
||||
|
||||
/*
|
||||
* Set the currency in cart
|
||||
@ -933,8 +933,8 @@ class Cart implements \JsonSerializable {
|
||||
* hev it here to prevent bugs.
|
||||
*/
|
||||
if ( ! $is_plan_change || ($this->get_plan_id() === $membership->get_plan_id() && $this->duration_unit === $membership->get_duration_unit() && $this->duration === $membership->get_duration())) {
|
||||
$this->products = array();
|
||||
$this->line_items = array();
|
||||
$this->products = [];
|
||||
$this->line_items = [];
|
||||
|
||||
$this->errors->add('no_changes', __('This cart proposes no changes to the current membership.', 'wp-ultimo'));
|
||||
|
||||
@ -993,8 +993,8 @@ class Cart implements \JsonSerializable {
|
||||
}
|
||||
|
||||
if ( ! $membership->is_free() && $old_price_per_day < $new_price_per_day && $days_in_old_cycle > $days_in_new_cycle && $membership->get_status() === Membership_Status::ACTIVE) {
|
||||
$this->products = array();
|
||||
$this->line_items = array();
|
||||
$this->products = [];
|
||||
$this->line_items = [];
|
||||
|
||||
$description = sprintf(
|
||||
// translators: %1$s the duration, and %2$s the duration unit (day, week, month, etc)
|
||||
@ -1023,7 +1023,7 @@ class Cart implements \JsonSerializable {
|
||||
if ($membership->is_active() || $membership->get_status() === Membership_Status::TRIALING) {
|
||||
$line_item_params = apply_filters(
|
||||
'wu_checkout_credit_line_item_params',
|
||||
array(
|
||||
[
|
||||
'type' => 'credit',
|
||||
'title' => __('Scheduled Swap Credit', 'wp-ultimo'),
|
||||
'description' => __('Swap scheduled to next billing cycle.', 'wp-ultimo'),
|
||||
@ -1031,7 +1031,7 @@ class Cart implements \JsonSerializable {
|
||||
'taxable' => false,
|
||||
'quantity' => 1,
|
||||
'unit_price' => - $this->get_total(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$credit_line_item = new Line_Item($line_item_params);
|
||||
@ -1061,28 +1061,28 @@ class Cart implements \JsonSerializable {
|
||||
protected function search_for_same_period_plans($plan_a, $plan_b) {
|
||||
|
||||
if ($plan_a->get_duration_unit() === $plan_b->get_duration_unit() && $plan_a->get_duration() === $plan_b->get_duration()) {
|
||||
return array(
|
||||
return [
|
||||
$plan_a,
|
||||
$plan_b,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$plan_a_variation = $plan_a->get_as_variation($plan_b->get_duration(), $plan_b->get_duration_unit());
|
||||
|
||||
if ($plan_a_variation) {
|
||||
return array(
|
||||
return [
|
||||
$plan_a_variation,
|
||||
$plan_b,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$plan_b_variation = $plan_b->get_as_variation($plan_a->get_duration(), $plan_a->get_duration_unit());
|
||||
|
||||
if ($plan_b_variation) {
|
||||
return array(
|
||||
return [
|
||||
$plan_a,
|
||||
$plan_b_variation,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->duration_unit && $this->duration && ($this->duration_unit !== $plan_b->get_duration_unit() || $this->duration !== $plan_b->get_duration())) {
|
||||
@ -1093,19 +1093,19 @@ class Cart implements \JsonSerializable {
|
||||
}
|
||||
|
||||
if ($plan_b->get_duration_unit() === $plan_a_variation->get_duration_unit() && $plan_b->get_duration() === $plan_a_variation->get_duration()) {
|
||||
return array(
|
||||
return [
|
||||
$plan_a_variation,
|
||||
$plan_b,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$plan_b_variation = $plan_b->get_as_variation($this->duration, $this->duration_unit);
|
||||
|
||||
if ($plan_b_variation) {
|
||||
return array(
|
||||
return [
|
||||
$plan_a_variation,
|
||||
$plan_b_variation,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1175,7 +1175,7 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
if ($fee_credit > 0) {
|
||||
$new_line_item = new Line_Item(
|
||||
array(
|
||||
[
|
||||
'product' => $old_plan,
|
||||
'type' => 'fee',
|
||||
'description' => '--',
|
||||
@ -1184,7 +1184,7 @@ class Cart implements \JsonSerializable {
|
||||
'recurring' => false,
|
||||
'unit_price' => $fee_credit,
|
||||
'quantity' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$new_line_item = $this->apply_taxes_to_item($new_line_item);
|
||||
@ -1217,7 +1217,7 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$line_item_params = apply_filters(
|
||||
'wu_checkout_credit_line_item_params',
|
||||
array(
|
||||
[
|
||||
'type' => 'credit',
|
||||
'title' => __('Credit', 'wp-ultimo'),
|
||||
'description' => __('Prorated amount based on the previous membership.', 'wp-ultimo'),
|
||||
@ -1225,7 +1225,7 @@ class Cart implements \JsonSerializable {
|
||||
'taxable' => false,
|
||||
'quantity' => 1,
|
||||
'unit_price' => - $credit,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@ -1467,7 +1467,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param \WP_Ultimo\Checkout\Line_Item $line_item The line item.
|
||||
* @return void
|
||||
*/
|
||||
public function add_line_item($line_item) {
|
||||
public function add_line_item($line_item): void {
|
||||
|
||||
if ( ! is_a($line_item, '\WP_Ultimo\Checkout\Line_Item')) {
|
||||
return;
|
||||
@ -1597,13 +1597,13 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$line_item_data = apply_filters(
|
||||
'wu_add_product_line_item',
|
||||
array(
|
||||
[
|
||||
'product' => $product,
|
||||
'quantity' => $quantity,
|
||||
'unit_price' => $amount,
|
||||
'duration' => $duration,
|
||||
'duration_unit' => $duration_unit,
|
||||
),
|
||||
],
|
||||
$product,
|
||||
$duration,
|
||||
$duration_unit,
|
||||
@ -1666,7 +1666,7 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
$setup_fee_line_item = apply_filters(
|
||||
'wu_add_product_setup_fee_line_item',
|
||||
array(
|
||||
[
|
||||
'product' => $product,
|
||||
'type' => 'fee',
|
||||
'description' => '--',
|
||||
@ -1675,7 +1675,7 @@ class Cart implements \JsonSerializable {
|
||||
'recurring' => false,
|
||||
'unit_price' => $product->get_setup_fee(),
|
||||
'quantity' => $quantity,
|
||||
),
|
||||
],
|
||||
$product,
|
||||
$this
|
||||
);
|
||||
@ -1697,7 +1697,7 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$line_items = $this->line_items;
|
||||
|
||||
$tax_brackets = array();
|
||||
$tax_brackets = [];
|
||||
|
||||
foreach ($line_items as $line_item) {
|
||||
$tax_bracket = $line_item->get_tax_rate();
|
||||
@ -1818,18 +1818,18 @@ class Cart implements \JsonSerializable {
|
||||
* @param array $where_clauses Additional where clauses for search.
|
||||
* @return \WP_Ultimo\Checkout\Line_Item[]
|
||||
*/
|
||||
public function get_line_items_by_type($type = 'product', $where_clauses = array()): array {
|
||||
public function get_line_items_by_type($type = 'product', $where_clauses = []): array {
|
||||
|
||||
$where_clauses[] = array('type', $type);
|
||||
$where_clauses[] = ['type', $type];
|
||||
|
||||
// Cast to array recursively
|
||||
$line_items = json_decode(json_encode($this->line_items), true);
|
||||
|
||||
$line_items = Array_Search::find(
|
||||
$line_items,
|
||||
array(
|
||||
[
|
||||
'where' => $where_clauses,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$ids = array_keys($line_items);
|
||||
@ -1958,10 +1958,10 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$subtotal = 0;
|
||||
|
||||
$exclude_types = array(
|
||||
$exclude_types = [
|
||||
'discount',
|
||||
'credit',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($this->line_items as $line_item) {
|
||||
if (in_array($line_item->get_type(), $exclude_types, true)) {
|
||||
@ -2037,9 +2037,9 @@ class Cart implements \JsonSerializable {
|
||||
$new_line_item = clone $line_item;
|
||||
|
||||
$new_line_item->attributes(
|
||||
array(
|
||||
[
|
||||
'discount_rate' => 0,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$new_line_item->recalculate_totals();
|
||||
@ -2230,21 +2230,21 @@ class Cart implements \JsonSerializable {
|
||||
}
|
||||
|
||||
$line_item->attributes(
|
||||
array(
|
||||
[
|
||||
'discount_rate' => $this->discount_code->get_setup_fee_value(),
|
||||
'discount_type' => $this->discount_code->get_setup_fee_type(),
|
||||
'apply_discount_to_renewals' => false,
|
||||
'discount_label' => strtoupper($this->discount_code->get_code()),
|
||||
)
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$line_item->attributes(
|
||||
array(
|
||||
[
|
||||
'discount_rate' => $this->discount_code->get_value(),
|
||||
'discount_type' => $this->discount_code->get_type(),
|
||||
'apply_discount_to_renewals' => $this->discount_code->should_apply_to_renewals(),
|
||||
'discount_label' => strtoupper($this->discount_code->get_code()),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -2301,13 +2301,13 @@ class Cart implements \JsonSerializable {
|
||||
}
|
||||
|
||||
$line_item->attributes(
|
||||
array(
|
||||
[
|
||||
'tax_rate' => $tax_rate ?? 0,
|
||||
'tax_type' => $tax_type ?? 'percentage',
|
||||
'tax_label' => $tax_label ?? '',
|
||||
'tax_inclusive' => wu_get_setting('inclusive_tax', false),
|
||||
'tax_exempt' => $this->is_tax_exempt(),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$line_item->recalculate_totals();
|
||||
@ -2323,17 +2323,17 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
public function calculate_totals() {
|
||||
|
||||
return (object) array(
|
||||
'recurring' => (object) array(
|
||||
return (object) [
|
||||
'recurring' => (object) [
|
||||
'subtotal' => $this->get_recurring_subtotal(),
|
||||
'total' => $this->get_recurring_total(),
|
||||
),
|
||||
],
|
||||
'subtotal' => $this->get_subtotal(),
|
||||
'total_taxes' => $this->get_total_taxes(),
|
||||
'total_fees' => $this->get_total_fees(),
|
||||
'total_discounts' => $this->get_total_discounts(),
|
||||
'total' => $this->get_total(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2355,7 +2355,7 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
public function get_extra_params() {
|
||||
|
||||
$extra_params = array();
|
||||
$extra_params = [];
|
||||
|
||||
foreach ($this->extra as $key) {
|
||||
$extra_params[ $key ] = $this->get_param($key);
|
||||
@ -2374,20 +2374,20 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$totals = $this->calculate_totals();
|
||||
|
||||
$errors = array();
|
||||
$errors = [];
|
||||
|
||||
if ($this->errors->has_errors()) {
|
||||
foreach ($this->errors as $code => $messages) {
|
||||
foreach ($messages as $message) {
|
||||
$errors[] = array(
|
||||
$errors[] = [
|
||||
'code' => $code,
|
||||
'message' => $message,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (object) array(
|
||||
return (object) [
|
||||
|
||||
'errors' => $errors,
|
||||
'url' => $this->get_cart_url(),
|
||||
@ -2407,12 +2407,12 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
'extra' => $this->get_extra_params(),
|
||||
|
||||
'dates' => (object) array(
|
||||
'dates' => (object) [
|
||||
'date_trial_end' => $this->get_billing_start_date(),
|
||||
'date_next_charge' => $this->get_billing_next_charge_date(),
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2423,23 +2423,23 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
public function to_membership_data() {
|
||||
|
||||
$membership_data = array();
|
||||
$membership_data = [];
|
||||
|
||||
$all_additional_products = $this->get_line_items_by_type(
|
||||
'product',
|
||||
array(
|
||||
array('product_id', '!=', $this->get_plan_id()),
|
||||
)
|
||||
[
|
||||
['product_id', '!=', $this->get_plan_id()],
|
||||
]
|
||||
);
|
||||
|
||||
$addon_list = array();
|
||||
$addon_list = [];
|
||||
|
||||
foreach ($all_additional_products as $line_item) {
|
||||
$addon_list[ $line_item->get_product_id() ] = $line_item->get_quantity();
|
||||
}
|
||||
|
||||
$membership_data = array_merge(
|
||||
array(
|
||||
[
|
||||
'recurring' => $this->has_recurring(),
|
||||
'plan_id' => $this->get_plan() ? $this->get_plan()->get_id() : 0,
|
||||
'initial_amount' => $this->get_total(),
|
||||
@ -2452,7 +2452,7 @@ class Cart implements \JsonSerializable {
|
||||
'billing_cycles' => $this->get_plan() ? $this->get_plan()->get_billing_cycles() : 0,
|
||||
'auto_renew' => false, // @todo: revisit
|
||||
'upgraded_from' => false, // @todo: revisit
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $membership_data;
|
||||
@ -2466,10 +2466,10 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
public function to_payment_data() {
|
||||
|
||||
$payment_data = array();
|
||||
$payment_data = [];
|
||||
|
||||
// Creates the pending payment
|
||||
$payment_data = array(
|
||||
$payment_data = [
|
||||
'status' => 'pending',
|
||||
'tax_total' => $this->get_total_taxes(),
|
||||
'fees' => $this->get_total_fees(),
|
||||
@ -2478,7 +2478,7 @@ class Cart implements \JsonSerializable {
|
||||
'discount_code' => $this->get_discount_code() ? $this->get_discount_code()->get_code() : '',
|
||||
'subtotal' => $this->get_subtotal(),
|
||||
'total' => $this->get_total(),
|
||||
);
|
||||
];
|
||||
|
||||
return $payment_data;
|
||||
}
|
||||
@ -2523,7 +2523,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param mixed $currency The currency code.
|
||||
* @return void
|
||||
*/
|
||||
public function set_currency($currency) {
|
||||
public function set_currency($currency): void {
|
||||
|
||||
$this->currency = $currency;
|
||||
}
|
||||
@ -2568,7 +2568,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param \WP_Ultimo\Models\Membership $membership A valid membership object.
|
||||
* @return void
|
||||
*/
|
||||
public function set_membership($membership) {
|
||||
public function set_membership($membership): void {
|
||||
|
||||
$this->membership = $membership;
|
||||
}
|
||||
@ -2580,7 +2580,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param \WP_Ultimo\Models\Customer $customer A valid customer object.
|
||||
* @return void
|
||||
*/
|
||||
public function set_customer($customer) {
|
||||
public function set_customer($customer): void {
|
||||
|
||||
$this->customer = $customer;
|
||||
}
|
||||
@ -2592,7 +2592,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param \WP_Ultimo\Models\Payment $payment A valid payment object.
|
||||
* @return void
|
||||
*/
|
||||
public function set_payment($payment) {
|
||||
public function set_payment($payment): void {
|
||||
|
||||
$this->payment = $payment;
|
||||
}
|
||||
@ -2637,7 +2637,7 @@ class Cart implements \JsonSerializable {
|
||||
* @param string $country The country of the customer.
|
||||
* @return void
|
||||
*/
|
||||
public function set_country($country) {
|
||||
public function set_country($country): void {
|
||||
|
||||
$this->country = $country;
|
||||
}
|
||||
@ -2668,7 +2668,7 @@ class Cart implements \JsonSerializable {
|
||||
|
||||
$all_products = $this->products;
|
||||
|
||||
$products_list = array();
|
||||
$products_list = [];
|
||||
|
||||
foreach ($all_products as $product) {
|
||||
if ($product->get_id() !== $this->plan_id) {
|
||||
@ -2677,9 +2677,9 @@ class Cart implements \JsonSerializable {
|
||||
}
|
||||
|
||||
return add_query_arg(
|
||||
array(
|
||||
[
|
||||
'products' => $products_list,
|
||||
),
|
||||
],
|
||||
$base_url
|
||||
);
|
||||
}
|
||||
|
@ -27,18 +27,18 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
add_filter('display_post_states', array($this, 'add_wp_ultimo_status_annotation'), 10, 2);
|
||||
add_filter('display_post_states', [$this, 'add_wp_ultimo_status_annotation'], 10, 2);
|
||||
|
||||
add_action('wu_thank_you_site_block', array($this, 'add_verify_email_notice'), 10, 3);
|
||||
add_action('wu_thank_you_site_block', [$this, 'add_verify_email_notice'], 10, 3);
|
||||
|
||||
add_shortcode('wu_confirmation', array($this, 'render_confirmation_page'));
|
||||
add_shortcode('wu_confirmation', [$this, 'render_confirmation_page']);
|
||||
|
||||
add_filter('lostpassword_redirect', array($this, 'filter_lost_password_redirect'));
|
||||
add_filter('lostpassword_redirect', [$this, 'filter_lost_password_redirect']);
|
||||
|
||||
if (is_main_site()) {
|
||||
add_action('before_signup_header', array($this, 'redirect_to_registration_page'));
|
||||
add_action('before_signup_header', [$this, 'redirect_to_registration_page']);
|
||||
|
||||
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
|
||||
|
||||
@ -46,30 +46,30 @@ class Checkout_Pages {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter('login_url', array($this, 'filter_login_url'), 10, 3);
|
||||
add_filter('login_url', [$this, 'filter_login_url'], 10, 3);
|
||||
|
||||
add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 3);
|
||||
add_filter('lostpassword_url', [$this, 'filter_login_url'], 10, 3);
|
||||
|
||||
add_filter('retrieve_password_message', array($this, 'replace_reset_password_link'), 10, 4);
|
||||
add_filter('retrieve_password_message', [$this, 'replace_reset_password_link'], 10, 4);
|
||||
|
||||
add_filter('network_site_url', array($this, 'maybe_change_wp_login_on_urls'));
|
||||
add_filter('network_site_url', [$this, 'maybe_change_wp_login_on_urls']);
|
||||
|
||||
add_action('login_init', array($this, 'maybe_obfuscate_login_url'), 9);
|
||||
add_action('login_init', [$this, 'maybe_obfuscate_login_url'], 9);
|
||||
|
||||
add_action('template_redirect', array($this, 'maybe_redirect_to_admin_panel'));
|
||||
add_action('template_redirect', [$this, 'maybe_redirect_to_admin_panel']);
|
||||
|
||||
add_action('after_password_reset', array($this, 'maybe_redirect_to_confirm_screen'));
|
||||
add_action('after_password_reset', [$this, 'maybe_redirect_to_confirm_screen']);
|
||||
|
||||
add_action('lost_password', array($this, 'maybe_handle_password_reset_errors'));
|
||||
add_action('lost_password', [$this, 'maybe_handle_password_reset_errors']);
|
||||
|
||||
add_action('validate_password_reset', array($this, 'maybe_handle_password_reset_errors'));
|
||||
add_action('validate_password_reset', [$this, 'maybe_handle_password_reset_errors']);
|
||||
|
||||
/**
|
||||
* Adds the force elements controls.
|
||||
*/
|
||||
add_action('post_submitbox_misc_actions', array($this, 'render_compat_mode_setting'));
|
||||
add_action('post_submitbox_misc_actions', [$this, 'render_compat_mode_setting']);
|
||||
|
||||
add_action('save_post', array($this, 'handle_compat_mode_setting'));
|
||||
add_action('save_post', [$this, 'handle_compat_mode_setting']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function render_compat_mode_setting() {
|
||||
public function render_compat_mode_setting(): void {
|
||||
|
||||
$post_id = get_the_ID();
|
||||
|
||||
@ -129,7 +129,7 @@ class Checkout_Pages {
|
||||
* @param int $post_id The id of the post being saved.
|
||||
* @return void
|
||||
*/
|
||||
public function handle_compat_mode_setting($post_id) {
|
||||
public function handle_compat_mode_setting($post_id): void {
|
||||
|
||||
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
||||
return;
|
||||
@ -163,7 +163,7 @@ class Checkout_Pages {
|
||||
* Only perform computational-heavy tasks if the URL has
|
||||
* wp-login.php in it to begin with.
|
||||
*/
|
||||
if (strpos($url, 'wp-login.php') === false) {
|
||||
if (! str_contains($url, 'wp-login.php')) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function get_error_message($error_code, $username = '') {
|
||||
|
||||
$messages = array(
|
||||
$messages = [
|
||||
'incorrect_password' => sprintf(__('<strong>Error:</strong> The password you entered is incorrect.', 'wp-ultimo')),
|
||||
// From here we are using the same messages as WordPress core.
|
||||
'expired' => __('Your session has expired. Please log in to continue where you left off.'),
|
||||
@ -206,7 +206,7 @@ class Checkout_Pages {
|
||||
'password_reset_mismatch' => __('<strong>Error:</strong> The passwords do not match.'),
|
||||
'invalidkey' => __('<strong>Error:</strong> Your password reset link appears to be invalid. Please request a new link below.'),
|
||||
'expiredkey' => __('<strong>Error:</strong> Your password reset link has expired. Please request a new link below.'),
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Filter the error messages.
|
||||
@ -231,15 +231,15 @@ class Checkout_Pages {
|
||||
* @param \WP_Error $errors The error object.
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_handle_password_reset_errors($errors) {
|
||||
public function maybe_handle_password_reset_errors($errors): void {
|
||||
|
||||
if ($errors->has_errors()) {
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
[
|
||||
'action' => wu_request('action', ''),
|
||||
'user_login' => wu_request('user_login', ''),
|
||||
'error' => $errors->get_error_code(),
|
||||
),
|
||||
],
|
||||
wp_login_url()
|
||||
);
|
||||
|
||||
@ -260,7 +260,7 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_redirect_to_confirm_screen() {
|
||||
public function maybe_redirect_to_confirm_screen(): void {
|
||||
|
||||
if (wu_request('redirect_to')) {
|
||||
wp_redirect(wu_request('redirect_to'));
|
||||
@ -286,7 +286,7 @@ class Checkout_Pages {
|
||||
return $message;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
$results = [];
|
||||
|
||||
preg_match_all('/.*\/wp-login\.php.*/', $message, $results);
|
||||
|
||||
@ -300,12 +300,12 @@ class Checkout_Pages {
|
||||
$switched_locale = switch_to_locale($locale);
|
||||
|
||||
$new_url = add_query_arg(
|
||||
array(
|
||||
[
|
||||
'action' => 'rp',
|
||||
'key' => $key,
|
||||
'login' => rawurlencode($user_login),
|
||||
'wp_lang' => $locale,
|
||||
),
|
||||
],
|
||||
wp_login_url()
|
||||
);
|
||||
|
||||
@ -327,7 +327,7 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_redirect_to_admin_panel() {
|
||||
public function maybe_redirect_to_admin_panel(): void {
|
||||
|
||||
global $post;
|
||||
|
||||
@ -356,14 +356,14 @@ class Checkout_Pages {
|
||||
*/
|
||||
$exclusion_list = apply_filters(
|
||||
'wu_maybe_redirect_to_admin_panel_exclusion_list',
|
||||
array(
|
||||
[
|
||||
'preview', // WordPress Preview
|
||||
'ct_builder', // Oxygen Builder
|
||||
'fl_builder', // Beaver Builder
|
||||
'elementor-preview', // Elementor
|
||||
'brizy-edit', // Brizy
|
||||
'brizy-edit-iframe', // Brizy
|
||||
),
|
||||
],
|
||||
$custom_login_page,
|
||||
$post,
|
||||
$this
|
||||
@ -410,7 +410,7 @@ class Checkout_Pages {
|
||||
* @param \WP_Ultimo\Models\Customer $customer the current customer.
|
||||
* @return void
|
||||
*/
|
||||
public function add_verify_email_notice($payment, $membership, $customer) {
|
||||
public function add_verify_email_notice($payment, $membership, $customer): void {
|
||||
|
||||
if ($payment->get_total() == 0 && $customer->get_email_verification() === 'pending') {
|
||||
$html = '<div class="wu-p-4 wu-bg-yellow-200 wu-mb-2 wu-text-yellow-700 wu-rounded">%s</div>';
|
||||
@ -429,7 +429,7 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_obfuscate_login_url() {
|
||||
public function maybe_obfuscate_login_url(): void {
|
||||
|
||||
$use_custom_login = wu_get_setting('enable_custom_login_page', false);
|
||||
|
||||
@ -484,7 +484,7 @@ class Checkout_Pages {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function redirect_to_registration_page() {
|
||||
public function redirect_to_registration_page(): void {
|
||||
|
||||
$registration_url = $this->get_page_url('register');
|
||||
|
||||
@ -520,7 +520,7 @@ class Checkout_Pages {
|
||||
return $login_url;
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params = [];
|
||||
|
||||
$old_url_params = wp_parse_url($login_url, PHP_URL_QUERY);
|
||||
|
||||
@ -555,13 +555,13 @@ class Checkout_Pages {
|
||||
*/
|
||||
public function get_signup_pages() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'register' => wu_guess_registration_page(),
|
||||
'update' => wu_get_setting('default_update_page', false),
|
||||
'login' => wu_get_setting('default_login_page', false),
|
||||
'block_frontend' => wu_get_setting('default_block_frontend_page', false),
|
||||
'new_site' => wu_get_setting('default_new_site_page', false),
|
||||
);
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Returns the WP_Post object for one of the pages.
|
||||
@ -617,13 +617,13 @@ class Checkout_Pages {
|
||||
return $states;
|
||||
}
|
||||
|
||||
$labels = array(
|
||||
$labels = [
|
||||
'register' => __('WP Multisite WaaS - Register Page', 'wp-ultimo'),
|
||||
'login' => __('WP Multisite WaaS - Login Page', 'wp-ultimo'),
|
||||
'block_frontend' => __('WP Multisite WaaS - Site Blocked Page', 'wp-ultimo'),
|
||||
'update' => __('WP Multisite WaaS - Membership Update Page', 'wp-ultimo'),
|
||||
'new_site' => __('WP Multisite WaaS - New Site Page', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
$pages = array_map('absint', $this->get_signup_pages());
|
||||
|
||||
@ -649,10 +649,10 @@ class Checkout_Pages {
|
||||
|
||||
return wu_get_template_contents(
|
||||
'checkout/confirmation',
|
||||
array(
|
||||
[
|
||||
'errors' => Checkout::get_instance()->errors,
|
||||
'membership' => wu_get_membership_by_hash(wu_request('membership')),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -159,44 +159,44 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
/*
|
||||
* Setup and handle checkout
|
||||
*/
|
||||
add_action('wu_setup_checkout', array($this, 'setup_checkout'));
|
||||
add_action('wu_setup_checkout', [$this, 'setup_checkout']);
|
||||
|
||||
add_action('wu_setup_checkout', array($this, 'maybe_process_checkout'), 20);
|
||||
add_action('wu_setup_checkout', [$this, 'maybe_process_checkout'], 20);
|
||||
|
||||
/*
|
||||
* Add the rewrite rules.
|
||||
*/
|
||||
add_action('init', array($this, 'add_rewrite_rules'), 20);
|
||||
add_action('init', [$this, 'add_rewrite_rules'], 20);
|
||||
|
||||
add_filter('wu_request', array($this, 'get_checkout_from_query_vars'), 10, 2);
|
||||
add_filter('wu_request', [$this, 'get_checkout_from_query_vars'], 10, 2);
|
||||
|
||||
/*
|
||||
* Creates the order object to display to the customer
|
||||
*/
|
||||
add_action('wu_ajax_wu_create_order', array($this, 'create_order'));
|
||||
add_action('wu_ajax_wu_create_order', [$this, 'create_order']);
|
||||
|
||||
add_action('wu_ajax_nopriv_wu_create_order', array($this, 'create_order'));
|
||||
add_action('wu_ajax_nopriv_wu_create_order', [$this, 'create_order']);
|
||||
|
||||
/*
|
||||
* Validates form and process preflight.
|
||||
*/
|
||||
add_action('wu_ajax_wu_validate_form', array($this, 'maybe_handle_order_submission'));
|
||||
add_action('wu_ajax_wu_validate_form', [$this, 'maybe_handle_order_submission']);
|
||||
|
||||
add_action('wu_ajax_nopriv_wu_validate_form', array($this, 'maybe_handle_order_submission'));
|
||||
add_action('wu_ajax_nopriv_wu_validate_form', [$this, 'maybe_handle_order_submission']);
|
||||
|
||||
/*
|
||||
* Adds the necessary scripts
|
||||
*/
|
||||
add_action('wu_checkout_scripts', array($this, 'register_scripts'));
|
||||
add_action('wu_checkout_scripts', [$this, 'register_scripts']);
|
||||
|
||||
/*
|
||||
* Errors
|
||||
*/
|
||||
add_action('wu_checkout_errors', array($this, 'maybe_display_checkout_errors'));
|
||||
add_action('wu_checkout_errors', [$this, 'maybe_display_checkout_errors']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +213,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_rewrite_rules() {
|
||||
public function add_rewrite_rules(): void {
|
||||
|
||||
$register = Checkout_Pages::get_instance()->get_signup_page('register');
|
||||
|
||||
@ -297,13 +297,13 @@ class Checkout {
|
||||
|
||||
$cart_arguments = apply_filters(
|
||||
'wu_get_checkout_from_query_vars',
|
||||
array(
|
||||
[
|
||||
'products',
|
||||
'duration',
|
||||
'duration_unit',
|
||||
'template_id',
|
||||
'wu_preselected',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
@ -345,7 +345,7 @@ class Checkout {
|
||||
* @param \WP_Ultimo\UI\Checkout_Element $element The checkout element.
|
||||
* @return void
|
||||
*/
|
||||
public function setup_checkout($element = null) {
|
||||
public function setup_checkout($element = null): void {
|
||||
|
||||
if ($this->already_setup) {
|
||||
return;
|
||||
@ -362,7 +362,7 @@ class Checkout {
|
||||
if ( ! $checkout_form_slug && is_a($element, \WP_Ultimo\UI\Checkout_Element::class)) {
|
||||
$pre_loaded_checkout_form_slug = $element->get_pre_loaded_attribute('slug', $checkout_form_slug);
|
||||
|
||||
$checkout_form_slug = $pre_loaded_checkout_form_slug ? $pre_loaded_checkout_form_slug : $checkout_form_slug;
|
||||
$checkout_form_slug = $pre_loaded_checkout_form_slug ?: $checkout_form_slug;
|
||||
}
|
||||
|
||||
$this->checkout_form = wu_get_checkout_form_by_slug($checkout_form_slug);
|
||||
@ -382,7 +382,7 @@ class Checkout {
|
||||
|
||||
$this->step = $this->checkout_form->get_step($this->step_name, true);
|
||||
|
||||
$this->step['fields'] ??= array();
|
||||
$this->step['fields'] ??= [];
|
||||
|
||||
$this->auto_submittable_field = $this->contains_auto_submittable_field($this->step['fields']);
|
||||
|
||||
@ -408,19 +408,19 @@ class Checkout {
|
||||
*/
|
||||
public function contains_auto_submittable_field($fields) {
|
||||
|
||||
$relevant_fields = array();
|
||||
$relevant_fields = [];
|
||||
|
||||
$field_types_to_ignore = array(
|
||||
$field_types_to_ignore = [
|
||||
'hidden',
|
||||
'products',
|
||||
'submit_button',
|
||||
'period_selection',
|
||||
'steps',
|
||||
);
|
||||
];
|
||||
|
||||
// Extra check to prevent error messages from being displayed.
|
||||
if ( ! is_array($fields)) {
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
}
|
||||
|
||||
foreach ($fields as $field) {
|
||||
@ -457,10 +457,10 @@ class Checkout {
|
||||
* while the value should be the parameter we should watch for changes
|
||||
* so we can submit the form when we detect one.
|
||||
*/
|
||||
$auto_submittable_fields = array(
|
||||
$auto_submittable_fields = [
|
||||
'template_selection' => 'template_id',
|
||||
'pricing_table' => 'products',
|
||||
);
|
||||
];
|
||||
|
||||
return apply_filters('wu_checkout_get_auto_submittable_fields', $auto_submittable_fields, $this);
|
||||
}
|
||||
@ -471,7 +471,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_handle_order_submission() {
|
||||
public function maybe_handle_order_submission(): void {
|
||||
|
||||
$this->setup_checkout();
|
||||
|
||||
@ -484,7 +484,7 @@ class Checkout {
|
||||
wp_send_json_error($validation);
|
||||
}
|
||||
|
||||
wp_send_json_success(array());
|
||||
wp_send_json_success([]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function handle_order_submission() {
|
||||
public function handle_order_submission(): void {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
@ -545,7 +545,7 @@ class Checkout {
|
||||
|
||||
$wpdb->query('COMMIT');
|
||||
|
||||
$this->session->set('signup', array());
|
||||
$this->session->set('signup', []);
|
||||
$this->session->commit();
|
||||
|
||||
wp_send_json_success($results);
|
||||
@ -589,8 +589,8 @@ class Checkout {
|
||||
$cart = new Cart(
|
||||
apply_filters(
|
||||
'wu_cart_parameters',
|
||||
array(
|
||||
'products' => $this->request_or_session('products', array()),
|
||||
[
|
||||
'products' => $this->request_or_session('products', []),
|
||||
'discount_code' => $this->request_or_session('discount_code'),
|
||||
'country' => $this->request_or_session('billing_country'),
|
||||
'state' => $this->request_or_session('billing_state'),
|
||||
@ -601,7 +601,7 @@ class Checkout {
|
||||
'duration' => $this->request_or_session('duration'),
|
||||
'duration_unit' => $this->request_or_session('duration_unit'),
|
||||
'cart_type' => $this->request_or_session('cart_type', 'new'),
|
||||
),
|
||||
],
|
||||
$this
|
||||
)
|
||||
);
|
||||
@ -684,7 +684,7 @@ class Checkout {
|
||||
/*
|
||||
* Handles display names, if needed.
|
||||
*/
|
||||
add_filter('pre_user_display_name', array($this, 'handle_display_name'));
|
||||
add_filter('pre_user_display_name', [$this, 'handle_display_name']);
|
||||
|
||||
/*
|
||||
* If we get to this point, most of the validations are done.
|
||||
@ -834,7 +834,7 @@ class Checkout {
|
||||
$gateway->trigger_payment_processed($this->payment, $this->membership);
|
||||
}
|
||||
|
||||
$success_data = array(
|
||||
$success_data = [
|
||||
'nonce' => wp_create_nonce('wp-ultimo-register-nonce'),
|
||||
'customer' => $this->customer->to_search_results(),
|
||||
'total' => $this->order->get_total(),
|
||||
@ -843,11 +843,11 @@ class Checkout {
|
||||
'payment_id' => $this->payment->get_id(),
|
||||
'cart_type' => $this->order->get_cart_type(),
|
||||
'auto_renew' => $this->order->should_auto_renew(),
|
||||
'gateway' => array(
|
||||
'gateway' => [
|
||||
'slug' => $gateway->get_id(),
|
||||
'data' => array(),
|
||||
),
|
||||
);
|
||||
'data' => [],
|
||||
],
|
||||
];
|
||||
|
||||
/*
|
||||
* Let's the gateway do its thing.
|
||||
@ -862,7 +862,7 @@ class Checkout {
|
||||
/*
|
||||
* Attach the gateway results to the return array.
|
||||
*/
|
||||
$success_data['gateway']['data'] = $result && is_array($result) ? $result : array();
|
||||
$success_data['gateway']['data'] = $result && is_array($result) ? $result : [];
|
||||
|
||||
/*
|
||||
* On error, bail.
|
||||
@ -941,24 +941,24 @@ class Checkout {
|
||||
*
|
||||
* Next step then would be to create one.
|
||||
*/
|
||||
$customer_data = array(
|
||||
$customer_data = [
|
||||
'username' => $username,
|
||||
'email' => $this->request_or_session('email_address'),
|
||||
'password' => $this->request_or_session('password'),
|
||||
'email_verification' => $this->get_customer_email_verification_status(),
|
||||
'signup_form' => $form_slug,
|
||||
'meta' => array(),
|
||||
);
|
||||
'meta' => [],
|
||||
];
|
||||
|
||||
/*
|
||||
* If the user is logged in,
|
||||
* we use the existing email address to create the customer.
|
||||
*/
|
||||
if ($this->is_existing_user()) {
|
||||
$customer_data = array(
|
||||
$customer_data = [
|
||||
'email' => wp_get_current_user()->user_email,
|
||||
'email_verification' => 'verified',
|
||||
);
|
||||
];
|
||||
} elseif (isset($customer_data['email']) && get_user_by('email', $customer_data['email'])) {
|
||||
return new \WP_Error('email_exists', __('The email address you entered is already in use.', 'wp-ultimo'));
|
||||
}
|
||||
@ -993,7 +993,7 @@ class Checkout {
|
||||
* class, so there's no problem in passing
|
||||
* the entire post array in here.
|
||||
*/
|
||||
$session = $this->session->get('signup') ?? array();
|
||||
$session = $this->session->get('signup') ?? [];
|
||||
$billing_address->attributes(array_merge($session, $_POST));
|
||||
|
||||
/*
|
||||
@ -1068,7 +1068,7 @@ class Checkout {
|
||||
if ($checkout_form) {
|
||||
$customer_meta_fields = $checkout_form->get_all_meta_fields('customer_meta');
|
||||
|
||||
$meta_repository = array();
|
||||
$meta_repository = [];
|
||||
|
||||
foreach ($customer_meta_fields as $customer_meta_field) {
|
||||
/*
|
||||
@ -1106,7 +1106,7 @@ class Checkout {
|
||||
|
||||
$user = $customer->get_user();
|
||||
|
||||
$user_meta_repository = array();
|
||||
$user_meta_repository = [];
|
||||
|
||||
foreach ($user_meta_fields as $user_meta_field) {
|
||||
/*
|
||||
@ -1239,7 +1239,7 @@ class Checkout {
|
||||
if ($auto_generate_url === 'username') {
|
||||
$site_url = $this->customer->get_username();
|
||||
|
||||
$site_title = $site_title ? $site_title : $site_url;
|
||||
$site_title = $site_title ?: $site_url;
|
||||
} else {
|
||||
$site_url = strtolower(str_replace(' ', '', preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities(trim((string) $site_title)))));
|
||||
}
|
||||
@ -1278,7 +1278,7 @@ class Checkout {
|
||||
* that way we can use it when actually registering
|
||||
* the site on WordPress.
|
||||
*/
|
||||
$transient = array();
|
||||
$transient = [];
|
||||
|
||||
if ($this->checkout_form) {
|
||||
$site_meta_fields = $this->checkout_form->get_all_fields();
|
||||
@ -1289,7 +1289,7 @@ class Checkout {
|
||||
* to make sure plain passwords do not get stored
|
||||
* on the database.
|
||||
*/
|
||||
if (strpos((string) $site_meta_field['id'], 'password') !== false ) {
|
||||
if (str_contains((string) $site_meta_field['id'], 'password') ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1310,7 +1310,7 @@ class Checkout {
|
||||
*/
|
||||
$template_id = apply_filters('wu_checkout_template_id', (int) $this->request_or_session('template_id'), $this->membership, $this);
|
||||
|
||||
$site_data = array(
|
||||
$site_data = [
|
||||
'domain' => $d->domain,
|
||||
'path' => $d->path,
|
||||
'title' => $site_title,
|
||||
@ -1321,7 +1321,7 @@ class Checkout {
|
||||
'signup_options' => $this->get_site_meta_fields($form_slug, 'site_option'),
|
||||
'signup_meta' => $this->get_site_meta_fields($form_slug, 'site_meta'),
|
||||
'type' => Site_Type::CUSTOMER_OWNED,
|
||||
);
|
||||
];
|
||||
|
||||
$pending_site = $this->membership->create_pending_site($site_data);
|
||||
|
||||
@ -1340,12 +1340,12 @@ class Checkout {
|
||||
protected function get_site_meta_fields($form_slug, $meta_type = 'site_meta') {
|
||||
|
||||
if (empty($form_slug) || $form_slug === 'none') {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$checkout_form = wu_get_checkout_form_by_slug($form_slug);
|
||||
|
||||
$list = array();
|
||||
$list = [];
|
||||
|
||||
if ($checkout_form) {
|
||||
$site_meta_fields = $checkout_form->get_all_meta_fields($meta_type);
|
||||
@ -1389,11 +1389,11 @@ class Checkout {
|
||||
*/
|
||||
$previous_payment = $this->membership->get_last_pending_payment();
|
||||
|
||||
$cancel_types = array(
|
||||
$cancel_types = [
|
||||
'upgrade',
|
||||
'downgrade',
|
||||
'addon',
|
||||
);
|
||||
];
|
||||
|
||||
if ($previous_payment && in_array($this->type, $cancel_types, true)) {
|
||||
$previous_payment->set_status(Payment_Status::CANCELLED);
|
||||
@ -1444,12 +1444,12 @@ class Checkout {
|
||||
*/
|
||||
if ($this->order->has_trial()) {
|
||||
$payment->attributes(
|
||||
array(
|
||||
[
|
||||
'tax_total' => 0,
|
||||
'subtotal' => 0,
|
||||
'refund_total' => 0,
|
||||
'total' => 0,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$payment->save();
|
||||
@ -1464,7 +1464,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function validate_form() {
|
||||
public function validate_form(): void {
|
||||
|
||||
$validation = $this->validate();
|
||||
|
||||
@ -1481,7 +1481,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function create_order() {
|
||||
public function create_order(): void {
|
||||
|
||||
$this->setup_checkout();
|
||||
|
||||
@ -1493,8 +1493,8 @@ class Checkout {
|
||||
$cart = new Cart(
|
||||
apply_filters(
|
||||
'wu_cart_parameters',
|
||||
array(
|
||||
'products' => $this->request_or_session('products', array()),
|
||||
[
|
||||
'products' => $this->request_or_session('products', []),
|
||||
'discount_code' => $this->request_or_session('discount_code'),
|
||||
'country' => $country,
|
||||
'state' => $state,
|
||||
@ -1505,7 +1505,7 @@ class Checkout {
|
||||
'duration' => $this->request_or_session('duration'),
|
||||
'duration_unit' => $this->request_or_session('duration_unit'),
|
||||
'cart_type' => $this->request_or_session('cart_type', 'new'),
|
||||
),
|
||||
],
|
||||
$this
|
||||
)
|
||||
);
|
||||
@ -1518,15 +1518,15 @@ class Checkout {
|
||||
$country_data = wu_get_country($cart->get_country());
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
[
|
||||
'order' => $cart->done(),
|
||||
'states' => wu_key_map_to_array($country_data->get_states_as_options(), 'code', 'name'),
|
||||
'cities' => wu_key_map_to_array($country_data->get_cities_as_options($state), 'code', 'name'),
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'state_field' => $country_data->get_administrative_division_name(null, true),
|
||||
'city_field' => $country_data->get_municipality_name(null, true),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -1543,11 +1543,11 @@ class Checkout {
|
||||
/*
|
||||
* Localized strings.
|
||||
*/
|
||||
$i18n = array(
|
||||
$i18n = [
|
||||
'loading' => __('Loading...', 'wp-ultimo'),
|
||||
'added_to_order' => __('The item was added!', 'wp-ultimo'),
|
||||
'weak_password' => __('The Password entered is too weak.', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Get the default gateway.
|
||||
@ -1579,14 +1579,14 @@ class Checkout {
|
||||
}
|
||||
}
|
||||
|
||||
$products = array_merge($this->request_or_session('products', array()), wu_request('products', array()));
|
||||
$products = array_merge($this->request_or_session('products', []), wu_request('products', []));
|
||||
|
||||
$geolocation = \WP_Ultimo\Geolocation::geolocate_ip('', true);
|
||||
|
||||
/*
|
||||
* Set the default variables.
|
||||
*/
|
||||
$variables = array(
|
||||
$variables = [
|
||||
'i18n' => $i18n,
|
||||
'ajaxurl' => wu_ajax_url(),
|
||||
'late_ajaxurl' => wu_ajax_url('init'),
|
||||
@ -1603,7 +1603,7 @@ class Checkout {
|
||||
'needs_billing_info' => true,
|
||||
'auto_renew' => true,
|
||||
'products' => array_unique($products),
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* There's a couple of things we need to determine.
|
||||
@ -1651,7 +1651,7 @@ class Checkout {
|
||||
$variables['membership_id'] = $membership_id;
|
||||
}
|
||||
|
||||
list($plan, $other_products) = wu_segregate_products($variables['products']);
|
||||
[$plan, $other_products] = wu_segregate_products($variables['products']);
|
||||
|
||||
$variables['plan'] = $plan ? $plan->get_id() : 0;
|
||||
|
||||
@ -1700,7 +1700,7 @@ class Checkout {
|
||||
*
|
||||
* First, let's set upm the general rules:
|
||||
*/
|
||||
$rules = array(
|
||||
$rules = [
|
||||
'email_address' => 'required_without:user_id|email|unique:\WP_User,email',
|
||||
'username' => 'required_without:user_id|alpha_dash|min:4|lowercase|unique:\WP_User,login',
|
||||
'password' => 'required_without:user_id|min:6',
|
||||
@ -1713,7 +1713,7 @@ class Checkout {
|
||||
'billing_zip_code' => 'required_with:billing_zip_code',
|
||||
'billing_state' => 'state',
|
||||
'billing_city' => 'city',
|
||||
);
|
||||
];
|
||||
|
||||
/*
|
||||
* Add rules for site when creating a new account.
|
||||
@ -1745,7 +1745,7 @@ class Checkout {
|
||||
$validation_rules = $this->validation_rules();
|
||||
|
||||
if (wu_request('pre-flight') || wu_request('checkout_form') === 'wu-finish-checkout') {
|
||||
$validation_rules = array();
|
||||
$validation_rules = [];
|
||||
|
||||
return $validation_rules;
|
||||
}
|
||||
@ -1764,10 +1764,10 @@ class Checkout {
|
||||
}
|
||||
|
||||
// We'll use this to validate product fields
|
||||
$product_fields = array(
|
||||
$product_fields = [
|
||||
'pricing_table',
|
||||
'products',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Add the additional required fields.
|
||||
@ -1825,9 +1825,9 @@ class Checkout {
|
||||
$rules = $this->get_validation_rules();
|
||||
}
|
||||
|
||||
$base_aliases = array();
|
||||
$base_aliases = [];
|
||||
|
||||
$checkout_form_fields = $this->checkout_form ? $this->checkout_form->get_all_fields() : array();
|
||||
$checkout_form_fields = $this->checkout_form ? $this->checkout_form->get_all_fields() : [];
|
||||
|
||||
// Add current form fields
|
||||
foreach ($checkout_form_fields as $field) {
|
||||
@ -1841,13 +1841,13 @@ class Checkout {
|
||||
|
||||
// Add some hidden or compound fields ids
|
||||
$validation_aliases = array_merge(
|
||||
array(
|
||||
[
|
||||
'password_conf' => __('Password confirmation', 'wp-ultimo'),
|
||||
'template_id' => __('Template ID', 'wp-ultimo'),
|
||||
'valid_password' => __('Valid password', 'wp-ultimo'),
|
||||
'products' => __('Products', 'wp-ultimo'),
|
||||
'gateway' => __('Payment Gateway', 'wp-ultimo'),
|
||||
),
|
||||
],
|
||||
$base_aliases
|
||||
);
|
||||
|
||||
@ -1885,7 +1885,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_process_checkout() {
|
||||
public function maybe_process_checkout(): void {
|
||||
/*
|
||||
* Sets up the checkout
|
||||
* environment.
|
||||
@ -1944,10 +1944,10 @@ class Checkout {
|
||||
*/
|
||||
if ($payment) {
|
||||
$redirect_url = add_query_arg(
|
||||
array(
|
||||
[
|
||||
'payment' => $payment->get_hash(),
|
||||
'status' => 'error',
|
||||
),
|
||||
],
|
||||
$redirect_url
|
||||
);
|
||||
}
|
||||
@ -1973,11 +1973,11 @@ class Checkout {
|
||||
* have checkout_ on their name, or start
|
||||
* with a underscore.
|
||||
*/
|
||||
$to_save = array_filter($_POST, fn($item) => strncmp((string) $item, 'checkout_', strlen('checkout_')) !== 0 && strncmp((string) $item, '_', strlen('_')) !== 0, ARRAY_FILTER_USE_KEY);
|
||||
$to_save = array_filter($_POST, fn($item) => ! str_starts_with((string) $item, 'checkout_') && ! str_starts_with((string) $item, '_'), ARRAY_FILTER_USE_KEY);
|
||||
|
||||
if (isset($to_save['pre-flight'])) {
|
||||
unset($to_save['pre-flight']);
|
||||
$this->session->add_values('signup', array('pre_selected' => $to_save));
|
||||
$this->session->add_values('signup', ['pre_selected' => $to_save]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2119,12 +2119,12 @@ class Checkout {
|
||||
if (has_action('wp_ultimo_registration')) {
|
||||
$_payment = wu_get_payment($payment->get_id());
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
0, // Site ID is not yet available at this point
|
||||
$customer->get_user_id(),
|
||||
$this->session->get('signup'),
|
||||
$_payment && $_payment->get_membership() ? new \WU_Plan($_payment->get_membership()->get_plan()) : false,
|
||||
);
|
||||
];
|
||||
|
||||
ob_start();
|
||||
|
||||
@ -2152,10 +2152,10 @@ class Checkout {
|
||||
$redirect_url = apply_filters('wp_ultimo_redirect_url_after_signup', $redirect_url, 0, get_current_user_id(), $_POST);
|
||||
|
||||
$redirect_url = add_query_arg(
|
||||
array(
|
||||
[
|
||||
'payment' => $payment ? $payment->get_hash() : 'none',
|
||||
'status' => 'done',
|
||||
),
|
||||
],
|
||||
$redirect_url
|
||||
);
|
||||
}
|
||||
@ -2174,10 +2174,10 @@ class Checkout {
|
||||
return new \WP_Error(
|
||||
'error',
|
||||
$e->getMessage(),
|
||||
array(
|
||||
[
|
||||
'trace' => $e->getTrace(),
|
||||
'payment' => $payment,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2254,7 +2254,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
$custom_css = apply_filters('wu_checkout_custom_css', '');
|
||||
|
||||
@ -2264,7 +2264,7 @@ class Checkout {
|
||||
|
||||
wp_enqueue_style('wu-admin');
|
||||
|
||||
wp_register_script('wu-checkout', wu_get_asset('checkout.js', 'js'), array('jquery-core', 'wu-vue', 'moment', 'wu-block-ui', 'wu-functions', 'password-strength-meter', 'underscore', 'wp-polyfill', 'wp-hooks', 'wu-cookie-helpers'), wu_get_version(), true);
|
||||
wp_register_script('wu-checkout', wu_get_asset('checkout.js', 'js'), ['jquery-core', 'wu-vue', 'moment', 'wu-block-ui', 'wu-functions', 'password-strength-meter', 'underscore', 'wp-polyfill', 'wp-hooks', 'wu-cookie-helpers'], wu_get_version(), true);
|
||||
|
||||
wp_localize_script('wu-checkout', 'wu_checkout', $this->get_checkout_variables());
|
||||
|
||||
@ -2326,7 +2326,7 @@ class Checkout {
|
||||
|
||||
$index = $current_step_index + 1;
|
||||
|
||||
return isset($keys[ $index ]) ? $keys[ $index ] : $keys[ $current_step_index ];
|
||||
return $keys[ $index ] ?? $keys[ $current_step_index ];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2390,7 +2390,7 @@ class Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_display_checkout_errors() {
|
||||
public function maybe_display_checkout_errors(): void {
|
||||
|
||||
if (wu_request('status') !== 'error') {
|
||||
return;
|
||||
|
@ -90,26 +90,26 @@ class Legacy_Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
public function init(): void {
|
||||
|
||||
$this->session = wu_get_session('signup');
|
||||
|
||||
$this->templates = array(
|
||||
$this->templates = [
|
||||
'signup-main.php' => __('WP Multisite WaaS Legacy Signup', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
// add_filter('request', array($this, 'maybe_render_legacy_signup'));
|
||||
|
||||
add_action('wu_signup_enqueue_scripts', array($this, 'register_scripts'));
|
||||
add_action('wu_signup_enqueue_scripts', [$this, 'register_scripts']);
|
||||
|
||||
add_filter('theme_page_templates', array($this, 'add_new_template'));
|
||||
add_filter('theme_page_templates', [$this, 'add_new_template']);
|
||||
|
||||
// Add a filter to the save post to inject out template into the page cache
|
||||
add_filter('wp_insert_post_data', array($this, 'register_legacy_templates'));
|
||||
add_filter('wp_insert_post_data', [$this, 'register_legacy_templates']);
|
||||
|
||||
// Add a filter to the template include to determine if the page has our
|
||||
// template assigned and return it's path
|
||||
add_filter('template_include', array($this, 'view_legacy_template'));
|
||||
add_filter('template_include', [$this, 'view_legacy_template']);
|
||||
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ class Legacy_Checkout {
|
||||
|
||||
if (empty($templates)) {
|
||||
|
||||
$templates = array();
|
||||
$templates = [];
|
||||
|
||||
}
|
||||
|
||||
@ -228,21 +228,21 @@ class Legacy_Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
wp_enqueue_script('wu-block-ui');
|
||||
|
||||
wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'));
|
||||
wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), ['wu-functions']);
|
||||
|
||||
wp_localize_script('wu-legacy-signup', 'wpu', array(
|
||||
wp_localize_script('wu-legacy-signup', 'wpu', [
|
||||
'default_pricing_option' => 1,
|
||||
));
|
||||
]);
|
||||
|
||||
wp_enqueue_script('wu-legacy-signup');
|
||||
|
||||
wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'), array('dashicons', 'install', 'admin-bar'));
|
||||
wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'), ['dashicons', 'install', 'admin-bar']);
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons', 'install'));
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), ['dashicons', 'install']);
|
||||
|
||||
wp_add_inline_style('legacy-signup', $this->get_legacy_dynamic_styles());
|
||||
|
||||
@ -315,9 +315,9 @@ class Legacy_Checkout {
|
||||
|
||||
$checkout_page_slug = 'register';
|
||||
|
||||
$page_name = isset($request['pagename']) ? $request['pagename'] : '';
|
||||
$page_name = $request['pagename'] ?? '';
|
||||
|
||||
if (strncmp((string) $page_name, $checkout_page_slug, strlen($checkout_page_slug)) === 0) {
|
||||
if (str_starts_with((string) $page_name, $checkout_page_slug)) {
|
||||
$page = explode('/', (string) $page_name);
|
||||
|
||||
/**
|
||||
@ -347,13 +347,13 @@ class Legacy_Checkout {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function legacy_signup() {
|
||||
public function legacy_signup(): void {
|
||||
|
||||
status_header(200);
|
||||
|
||||
$this->session = wu_get_session('signup');
|
||||
|
||||
$this->session->set('form', array('not-empty'));
|
||||
$this->session->set('form', ['not-empty']);
|
||||
|
||||
// Apply a filter so we can add steps in the future
|
||||
$this->steps = $this->get_steps();
|
||||
@ -365,9 +365,9 @@ class Legacy_Checkout {
|
||||
|
||||
wu_get_template(
|
||||
'legacy/signup/signup-main',
|
||||
array(
|
||||
[
|
||||
'signup' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
exit;
|
||||
@ -378,7 +378,7 @@ class Legacy_Checkout {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check_geolocation() {
|
||||
public function check_geolocation(): void {
|
||||
|
||||
$location = \WP_Ultimo\Geolocation::geolocate_ip();
|
||||
|
||||
@ -425,7 +425,7 @@ class Legacy_Checkout {
|
||||
if (isset($current_step['handler']) && $current_step['handler']) {
|
||||
$handler_function = $current_step['handler'];
|
||||
} else {
|
||||
$handler_function = array($this, 'default_save');
|
||||
$handler_function = [$this, 'default_save'];
|
||||
}
|
||||
|
||||
/** Allows for handler rewrite */
|
||||
@ -441,7 +441,7 @@ class Legacy_Checkout {
|
||||
* @since 1.4.0
|
||||
* @return void
|
||||
*/
|
||||
public function begin_signup() {
|
||||
public function begin_signup(): void {
|
||||
|
||||
/**
|
||||
* Check Geo-location
|
||||
@ -452,9 +452,9 @@ class Legacy_Checkout {
|
||||
$uniqid = uniqid('', true);
|
||||
|
||||
/** Initializes the content holder with the honeypot unique id */
|
||||
$content = array(
|
||||
$content = [
|
||||
'honeypot_id' => uniqid(''),
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Saves the coupon code in the request, only if that option is available
|
||||
@ -519,7 +519,7 @@ class Legacy_Checkout {
|
||||
*/
|
||||
public static function is_customizer(): bool {
|
||||
|
||||
$exclude_list = apply_filters('wu_replace_signup_urls_exclude', array('wu-signup-customizer-preview'));
|
||||
$exclude_list = apply_filters('wu_replace_signup_urls_exclude', ['wu-signup-customizer-preview']);
|
||||
|
||||
foreach ($exclude_list as $replace_word) {
|
||||
if (isset($_GET[ $replace_word ])) {
|
||||
@ -556,7 +556,7 @@ class Legacy_Checkout {
|
||||
$current_step = wu_request('step', current(array_keys($this->steps)));
|
||||
|
||||
// Always get the first step for the customizer //
|
||||
if ($this->is_customizer()) {
|
||||
if (static::is_customizer()) {
|
||||
$current_step = $this->get_first_step();
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ class Legacy_Checkout {
|
||||
* @param string $step The current step.
|
||||
* @return void
|
||||
*/
|
||||
public function get_step_view($step) {
|
||||
public function get_step_view($step): void {
|
||||
|
||||
$transient = $this->session->get('form');
|
||||
$geo = $this->session->get('geolocation');
|
||||
@ -578,7 +578,7 @@ class Legacy_Checkout {
|
||||
* Set the errors
|
||||
*/
|
||||
if ($this->results === null) {
|
||||
$this->results = array('errors' => new \WP_Error());
|
||||
$this->results = ['errors' => new \WP_Error()];
|
||||
}
|
||||
|
||||
if (empty($_POST)) {
|
||||
@ -588,12 +588,12 @@ class Legacy_Checkout {
|
||||
/**
|
||||
* Builds the array containing the available elements inside the template
|
||||
*/
|
||||
$args = array(
|
||||
$args = [
|
||||
'signup' => $this,
|
||||
'transient' => $transient,
|
||||
'fields' => isset($this->steps[ $step ]['fields']) ? $this->steps[ $step ]['fields'] : array(),
|
||||
'fields' => $this->steps[ $step ]['fields'] ?? [],
|
||||
'results' => $this->results,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Checks if anything is passed to the view element
|
||||
@ -626,47 +626,47 @@ class Legacy_Checkout {
|
||||
public function get_steps($include_hidden = true, $filtered = true) {
|
||||
|
||||
// Set the Steps
|
||||
$steps = array();
|
||||
$steps = [];
|
||||
|
||||
// Plan Selector
|
||||
$steps['plan'] = array(
|
||||
$steps['plan'] = [
|
||||
'name' => __('Pick a Plan', 'wp-ultimo'),
|
||||
'desc' => __('Which one of our amazing plans you want to get?', 'wp-ultimo'),
|
||||
'view' => 'step-plans',
|
||||
'handler' => array($this, 'plans_save'),
|
||||
'handler' => [$this, 'plans_save'],
|
||||
'order' => 10,
|
||||
'fields' => false,
|
||||
'core' => true,
|
||||
);
|
||||
];
|
||||
|
||||
$site_templates = array(
|
||||
$site_templates = [
|
||||
2,
|
||||
);
|
||||
];
|
||||
|
||||
// We add template selection if this has template
|
||||
if ($site_templates) {
|
||||
$steps['template'] = array(
|
||||
$steps['template'] = [
|
||||
'name' => __('Template Selection', 'wp-ultimo'),
|
||||
'desc' => __('Select the base template of your new site.', 'wp-ultimo'),
|
||||
'view' => 'step-template',
|
||||
'order' => 20,
|
||||
'handler' => false,
|
||||
'core' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
// Domain registering
|
||||
$steps['domain'] = array(
|
||||
$steps['domain'] = [
|
||||
'name' => __('Site Details', 'wp-ultimo'),
|
||||
'desc' => __('Ok, now it\'s time to pick your site url and title!', 'wp-ultimo'),
|
||||
'handler' => array($this, 'domain_save'),
|
||||
'handler' => [$this, 'domain_save'],
|
||||
'view' => false,
|
||||
'order' => 30,
|
||||
'core' => true,
|
||||
'fields' => apply_filters(
|
||||
'wu_signup_fields_domain',
|
||||
array(
|
||||
'blog_title' => array(
|
||||
[
|
||||
'blog_title' => [
|
||||
'order' => 10,
|
||||
'name' => apply_filters('wu_signup_site_title_label', __('Site Title', 'wp-ultimo')),
|
||||
'type' => 'text',
|
||||
@ -675,8 +675,8 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_site_title_tooltip', __('Select the title your site is going to have.', 'wp-ultimo')),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
'blogname' => array(
|
||||
],
|
||||
'blogname' => [
|
||||
'order' => 20,
|
||||
'name' => apply_filters('wu_signup_site_url_label', __('URL', 'wp-ultimo')),
|
||||
'type' => 'text',
|
||||
@ -685,30 +685,30 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_site_url_tooltip', __('Site urls can only contain lowercase letters (a-z) and numbers and must be at least 4 characters. .', 'wp-ultimo')),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
'url_preview' => array(
|
||||
],
|
||||
'url_preview' => [
|
||||
'order' => 30,
|
||||
'name' => __('Site URL Preview', 'wp-ultimo'),
|
||||
'type' => 'html',
|
||||
'content' => wu_get_template_contents('legacy/signup/steps/step-domain-url-preview'),
|
||||
),
|
||||
'submit' => array(
|
||||
],
|
||||
'submit' => [
|
||||
'order' => 100,
|
||||
'type' => 'submit',
|
||||
'name' => __('Continue to the next step', 'wp-ultimo'),
|
||||
'core' => true,
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Since there are some conditional fields on the accounts step, we need to declare the variable before
|
||||
* so we can append items and filter it later
|
||||
*/
|
||||
$account_fields = array(
|
||||
$account_fields = [
|
||||
|
||||
'user_name' => array(
|
||||
'user_name' => [
|
||||
'order' => 10,
|
||||
'name' => apply_filters('wu_signup_username_label', __('Username', 'wp-ultimo')),
|
||||
'type' => 'text',
|
||||
@ -717,9 +717,9 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_username_tooltip', __('Username must be at least 4 characters.', 'wp-ultimo')),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
],
|
||||
|
||||
'user_email' => array(
|
||||
'user_email' => [
|
||||
'order' => 20,
|
||||
'name' => apply_filters('wu_signup_email_label', __('Email', 'wp-ultimo')),
|
||||
'type' => 'email',
|
||||
@ -728,9 +728,9 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_email_tooltip', ''),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
],
|
||||
|
||||
'user_pass' => array(
|
||||
'user_pass' => [
|
||||
'order' => 30,
|
||||
'name' => apply_filters('wu_signup_password_label', __('Password', 'wp-ultimo')),
|
||||
'type' => 'password',
|
||||
@ -739,9 +739,9 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_password_tooltip', __('Your password should be at least 6 characters long.', 'wp-ultimo')),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
],
|
||||
|
||||
'user_pass_conf' => array(
|
||||
'user_pass_conf' => [
|
||||
'order' => 40,
|
||||
'name' => apply_filters('wu_signup_password_conf_label', __('Confirm Password', 'wp-ultimo')),
|
||||
'type' => 'password',
|
||||
@ -750,28 +750,28 @@ class Legacy_Checkout {
|
||||
'tooltip' => apply_filters('wu_signup_password_conf_tooltip', ''),
|
||||
'required' => true,
|
||||
'core' => true,
|
||||
),
|
||||
],
|
||||
|
||||
/**
|
||||
* HoneyPot Field
|
||||
*/
|
||||
'site_url' => array(
|
||||
'order' => rand(1, 59), // Use random order for Honeypot
|
||||
'site_url' => [
|
||||
'order' => random_int(1, 59), // Use random order for Honeypot
|
||||
'name' => __('Site URL', 'wp-ultimo'),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'placeholder' => '',
|
||||
'tooltip' => '',
|
||||
'core' => true,
|
||||
'wrapper_attributes' => array(
|
||||
'wrapper_attributes' => [
|
||||
'style' => 'display: none;',
|
||||
),
|
||||
'attributes' => array(
|
||||
],
|
||||
'attributes' => [
|
||||
'autocomplete' => 'nope',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Check and Add Coupon Code Fields
|
||||
@ -819,22 +819,22 @@ class Legacy_Checkout {
|
||||
/**
|
||||
* Submit Field
|
||||
*/
|
||||
$account_fields['submit'] = array(
|
||||
$account_fields['submit'] = [
|
||||
'order' => 100,
|
||||
'type' => 'submit',
|
||||
'name' => __('Create Account', 'wp-ultimo'),
|
||||
'core' => true,
|
||||
);
|
||||
];
|
||||
|
||||
// Account registering
|
||||
$steps['account'] = array(
|
||||
$steps['account'] = [
|
||||
'name' => __('Account Details', 'wp-ultimo'),
|
||||
'view' => false,
|
||||
'handler' => array($this, 'account_save'),
|
||||
'handler' => [$this, 'account_save'],
|
||||
'order' => 40,
|
||||
'core' => true,
|
||||
'fields' => apply_filters('wu_signup_fields_account', $account_fields),
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Add additional steps via filters
|
||||
@ -842,21 +842,21 @@ class Legacy_Checkout {
|
||||
$steps = $filtered ? apply_filters('wp_ultimo_registration_steps', $steps) : $steps;
|
||||
|
||||
// Sort elements based on their order
|
||||
uasort($steps, array($this, 'sort_steps_and_fields'));
|
||||
uasort($steps, [$this, 'sort_steps_and_fields']);
|
||||
|
||||
// Sorts each of the fields block
|
||||
foreach ($steps as &$step) {
|
||||
$step = wp_parse_args(
|
||||
$step,
|
||||
array(
|
||||
[
|
||||
'hidden' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if (isset($step['fields']) && is_array($step['fields'])) {
|
||||
|
||||
// Sort elements based on their order
|
||||
uasort($step['fields'], array($this, 'sort_steps_and_fields'));
|
||||
uasort($step['fields'], [$this, 'sort_steps_and_fields']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -865,32 +865,32 @@ class Legacy_Checkout {
|
||||
*
|
||||
* @since 1.4.0
|
||||
*/
|
||||
$begin_signup = array(
|
||||
'begin-signup' => array(
|
||||
$begin_signup = [
|
||||
'begin-signup' => [
|
||||
'name' => __('Begin Signup Process', 'wp-ultimo'),
|
||||
'handler' => array($this, 'begin_signup'),
|
||||
'handler' => [$this, 'begin_signup'],
|
||||
'view' => false,
|
||||
'hidden' => true,
|
||||
'order' => 0,
|
||||
'core' => true,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Adds the hidden step now responsible for validating data entry and the actual account creation
|
||||
*
|
||||
* @since 1.4.0
|
||||
*/
|
||||
$create_account = array(
|
||||
'create-account' => array(
|
||||
$create_account = [
|
||||
'create-account' => [
|
||||
'name' => __('Creating Account', 'wp-ultimo'),
|
||||
'handler' => array($this, 'create_account'),
|
||||
'handler' => [$this, 'create_account'],
|
||||
'view' => false,
|
||||
'hidden' => true,
|
||||
'core' => true,
|
||||
'order' => 1_000_000_000,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Glue the required steps together with the filterable ones
|
||||
@ -923,9 +923,9 @@ class Legacy_Checkout {
|
||||
public static function get_transient($die = true) {
|
||||
|
||||
if (self::is_customizer()) {
|
||||
$transient = array(
|
||||
$transient = [
|
||||
'not-empty' => '',
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$transient = wu_get_session('signup')->get('form');
|
||||
}
|
||||
@ -936,7 +936,7 @@ class Legacy_Checkout {
|
||||
}
|
||||
|
||||
if (is_null($transient)) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
return $transient;
|
||||
@ -947,7 +947,7 @@ class Legacy_Checkout {
|
||||
*
|
||||
* @param array $transient Array containing the transient data.
|
||||
*/
|
||||
public function update_transient($transient) {
|
||||
public function update_transient($transient): void {
|
||||
|
||||
$this->session->set('form', $transient);
|
||||
|
||||
@ -958,7 +958,7 @@ class Legacy_Checkout {
|
||||
*/
|
||||
public function has_plan_step(): bool {
|
||||
|
||||
$transient = $this->get_transient();
|
||||
$transient = static::get_transient();
|
||||
|
||||
if (isset($transient['skip_plan']) && isset($transient['plan_id']) && isset($transient['plan_freq'])) {
|
||||
return false;
|
||||
@ -973,7 +973,7 @@ class Legacy_Checkout {
|
||||
* @param array $params The params.
|
||||
* @return string The link for the next step
|
||||
*/
|
||||
public function get_next_step_link($params = array()) {
|
||||
public function get_next_step_link($params = []) {
|
||||
|
||||
// Add CS
|
||||
if (isset($_GET['cs'])) {
|
||||
@ -1020,7 +1020,7 @@ class Legacy_Checkout {
|
||||
* @param array $args Arguments to build the URL.
|
||||
* @return void
|
||||
*/
|
||||
public function next_step($args = array()) {
|
||||
public function next_step($args = []): void {
|
||||
|
||||
/** Redirect the user to the next step */
|
||||
wp_redirect(esc_url_raw($this->get_next_step_link($args)));
|
||||
@ -1035,7 +1035,7 @@ class Legacy_Checkout {
|
||||
* @param array $params The params.
|
||||
* @return string The link for the previous step
|
||||
*/
|
||||
public function get_prev_step_link($params = array()) {
|
||||
public function get_prev_step_link($params = []) {
|
||||
|
||||
// Add CS
|
||||
if (isset($_GET['cs'])) {
|
||||
@ -1089,10 +1089,10 @@ class Legacy_Checkout {
|
||||
* @param integer $freq The freq.
|
||||
* @return void
|
||||
*/
|
||||
public function form_fields($current_plan = false, $step = 'plan', $freq = false) {
|
||||
public function form_fields($current_plan = false, $step = 'plan', $freq = false): void {
|
||||
|
||||
/** Select the default frequency */
|
||||
$freq = $freq ? $freq : wu_get_setting('default_pricing_option');
|
||||
$freq = $freq ?: wu_get_setting('default_pricing_option');
|
||||
|
||||
?>
|
||||
|
||||
@ -1127,7 +1127,7 @@ class Legacy_Checkout {
|
||||
*/
|
||||
public function get_site_url_for_previewer() {
|
||||
|
||||
$domain_options = array();
|
||||
$domain_options = [];
|
||||
|
||||
$site = get_current_site();
|
||||
|
||||
@ -1153,10 +1153,10 @@ class Legacy_Checkout {
|
||||
/**
|
||||
* We pass the following info
|
||||
*/
|
||||
public function plans_save() {
|
||||
public function plans_save(): void {
|
||||
|
||||
// Get transient
|
||||
$transient = $this->get_transient();
|
||||
$transient = static::get_transient();
|
||||
|
||||
// Check referer
|
||||
check_admin_referer('signup_form_1', '_signup_form');
|
||||
@ -1200,10 +1200,10 @@ class Legacy_Checkout {
|
||||
/**
|
||||
* Personal Info Settings.
|
||||
*/
|
||||
public function domain_save() {
|
||||
public function domain_save(): void {
|
||||
|
||||
// Get transient
|
||||
$transient = $this->get_transient();
|
||||
$transient = static::get_transient();
|
||||
|
||||
// Check referer
|
||||
check_admin_referer('signup_form_1', '_signup_form');
|
||||
@ -1247,7 +1247,7 @@ class Legacy_Checkout {
|
||||
*/
|
||||
public function filter_post_array($post, $exclude_list = false) {
|
||||
|
||||
$exclude_list = $exclude_list ? $exclude_list : array('_signup_form', '_wp_http_referer');
|
||||
$exclude_list = $exclude_list ?: ['_signup_form', '_wp_http_referer'];
|
||||
|
||||
/** Filter Array */
|
||||
$post = $this->array_filter_key($post, fn($element_key) => ! in_array($element_key, $exclude_list, true));
|
||||
@ -1267,7 +1267,7 @@ class Legacy_Checkout {
|
||||
*/
|
||||
public function array_filter_key(array $array, $callback): array {
|
||||
|
||||
$matched_keys = array_filter(array_keys($array), $callback === null ? fn($v, $k): bool => ! empty($v) : $callback, $callback === null ? ARRAY_FILTER_USE_BOTH : 0);
|
||||
$matched_keys = array_filter(array_keys($array), $callback ?? fn($v, $k): bool => ! empty($v), $callback === null ? ARRAY_FILTER_USE_BOTH : 0);
|
||||
|
||||
return array_intersect_key($array, array_flip($matched_keys));
|
||||
}
|
||||
@ -1296,7 +1296,7 @@ class Legacy_Checkout {
|
||||
* @param array $step The step info.
|
||||
* @return void
|
||||
*/
|
||||
public function add_signup_step($id, $order, $step) {
|
||||
public function add_signup_step($id, $order, $step): void {
|
||||
|
||||
add_filter(
|
||||
'wp_ultimo_registration_steps',
|
||||
@ -1325,7 +1325,7 @@ class Legacy_Checkout {
|
||||
* @param array $field The field.
|
||||
* @return void
|
||||
*/
|
||||
public function add_signup_field($step, $id, $order, $field) {
|
||||
public function add_signup_field($step, $id, $order, $field): void {
|
||||
|
||||
add_filter(
|
||||
'wp_ultimo_registration_steps',
|
||||
|
@ -305,7 +305,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param array $data Array of key => values billing address fields.
|
||||
* @return void
|
||||
*/
|
||||
public function attributes($data) {
|
||||
public function attributes($data): void {
|
||||
/*
|
||||
* Set type first to allow for overriding the other parameters.
|
||||
*/
|
||||
@ -368,7 +368,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $type The line item type.
|
||||
* @return void
|
||||
*/
|
||||
public function set_type($type) {
|
||||
public function set_type($type): void {
|
||||
|
||||
$this->type = $type;
|
||||
}
|
||||
@ -407,7 +407,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param Product $product Product associated with this line item.
|
||||
* @return void
|
||||
*/
|
||||
public function set_product($product) {
|
||||
public function set_product($product): void {
|
||||
|
||||
$this->product_id = $product->get_id();
|
||||
|
||||
@ -491,12 +491,12 @@ class Line_Item implements \JsonSerializable {
|
||||
$taxes = 0;
|
||||
}
|
||||
|
||||
$totals = array(
|
||||
$totals = [
|
||||
'subtotal' => $sub_total,
|
||||
'discount_total' => $discounts,
|
||||
'tax_total' => $taxes,
|
||||
'total' => $total,
|
||||
);
|
||||
];
|
||||
|
||||
$this->attributes($totals);
|
||||
|
||||
@ -521,7 +521,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $quantity Quantity of the given product.
|
||||
* @return void
|
||||
*/
|
||||
public function set_quantity($quantity) {
|
||||
public function set_quantity($quantity): void {
|
||||
|
||||
$this->quantity = $quantity;
|
||||
}
|
||||
@ -544,7 +544,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param integer $unit_price Unit price of the product.
|
||||
* @return void
|
||||
*/
|
||||
public function set_unit_price($unit_price) {
|
||||
public function set_unit_price($unit_price): void {
|
||||
|
||||
$this->unit_price = $unit_price;
|
||||
}
|
||||
@ -567,7 +567,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $tax_rate Tax amount, absolute or percentage.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_rate($tax_rate) {
|
||||
public function set_tax_rate($tax_rate): void {
|
||||
|
||||
$this->tax_rate = $tax_rate;
|
||||
}
|
||||
@ -590,7 +590,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $tax_type Type of the tax, percentage or absolute.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_type($tax_type) {
|
||||
public function set_tax_type($tax_type): void {
|
||||
|
||||
$this->tax_type = $tax_type;
|
||||
}
|
||||
@ -613,7 +613,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $tax_inclusive If tax are included in the price or not.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_inclusive($tax_inclusive) {
|
||||
public function set_tax_inclusive($tax_inclusive): void {
|
||||
|
||||
$this->tax_inclusive = $tax_inclusive;
|
||||
}
|
||||
@ -636,7 +636,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $tax_exempt If the line item is tax exempt ot not.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_exempt($tax_exempt) {
|
||||
public function set_tax_exempt($tax_exempt): void {
|
||||
|
||||
$this->tax_exempt = $tax_exempt;
|
||||
}
|
||||
@ -659,7 +659,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $tax_total The amount, in currency, of the tax.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_total($tax_total) {
|
||||
public function set_tax_total($tax_total): void {
|
||||
|
||||
$this->tax_total = $tax_total;
|
||||
}
|
||||
@ -682,7 +682,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $total The total value of the line.
|
||||
* @return void
|
||||
*/
|
||||
public function set_total($total) {
|
||||
public function set_total($total): void {
|
||||
|
||||
$this->total = $total;
|
||||
}
|
||||
@ -705,7 +705,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $recurring If this item is recurring or not.
|
||||
* @return void
|
||||
*/
|
||||
public function set_recurring($recurring) {
|
||||
public function set_recurring($recurring): void {
|
||||
|
||||
$this->recurring = $recurring;
|
||||
}
|
||||
@ -728,7 +728,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $subtotal Value before taxes, discounts, fees and etc.
|
||||
* @return void
|
||||
*/
|
||||
public function set_subtotal($subtotal) {
|
||||
public function set_subtotal($subtotal): void {
|
||||
|
||||
$this->subtotal = $subtotal;
|
||||
}
|
||||
@ -751,7 +751,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param int $duration The billing cycle duration.
|
||||
* @return void
|
||||
*/
|
||||
public function set_duration($duration) {
|
||||
public function set_duration($duration): void {
|
||||
|
||||
$this->duration = $duration;
|
||||
}
|
||||
@ -774,7 +774,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $duration_unit The duration unit.
|
||||
* @return void
|
||||
*/
|
||||
public function set_duration_unit($duration_unit) {
|
||||
public function set_duration_unit($duration_unit): void {
|
||||
|
||||
$this->duration_unit = $duration_unit;
|
||||
}
|
||||
@ -797,7 +797,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param int $billing_cycles The number of billing cycles.
|
||||
* @return void
|
||||
*/
|
||||
public function set_billing_cycles($billing_cycles) {
|
||||
public function set_billing_cycles($billing_cycles): void {
|
||||
|
||||
$this->billing_cycles = $billing_cycles;
|
||||
}
|
||||
@ -820,7 +820,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $discount_total The total value of discounts.
|
||||
* @return void
|
||||
*/
|
||||
public function set_discount_total($discount_total) {
|
||||
public function set_discount_total($discount_total): void {
|
||||
|
||||
$this->discount_total = $discount_total;
|
||||
}
|
||||
@ -843,7 +843,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $tax_category The tax category.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_category($tax_category) {
|
||||
public function set_tax_category($tax_category): void {
|
||||
|
||||
$this->tax_category = $tax_category;
|
||||
}
|
||||
@ -866,7 +866,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $discountable If the line is discountable.
|
||||
* @return void
|
||||
*/
|
||||
public function set_discountable($discountable) {
|
||||
public function set_discountable($discountable): void {
|
||||
|
||||
$this->discountable = $discountable;
|
||||
}
|
||||
@ -889,7 +889,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $taxable If the item is taxable or not.
|
||||
* @return void
|
||||
*/
|
||||
public function set_taxable($taxable) {
|
||||
public function set_taxable($taxable): void {
|
||||
|
||||
$this->taxable = $taxable;
|
||||
}
|
||||
@ -912,7 +912,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param float $discount_rate The discount amount (flat or percentage).
|
||||
* @return void
|
||||
*/
|
||||
public function set_discount_rate($discount_rate) {
|
||||
public function set_discount_rate($discount_rate): void {
|
||||
|
||||
$this->discount_rate = $discount_rate;
|
||||
}
|
||||
@ -935,7 +935,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $discount_type The type of discount, percentage or absolute.
|
||||
* @return void
|
||||
*/
|
||||
public function set_discount_type($discount_type) {
|
||||
public function set_discount_type($discount_type): void {
|
||||
|
||||
$this->discount_type = $discount_type;
|
||||
}
|
||||
@ -958,7 +958,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $discount_label Discount Label.
|
||||
* @return void
|
||||
*/
|
||||
public function set_discount_label($discount_label) {
|
||||
public function set_discount_label($discount_label): void {
|
||||
|
||||
$this->discount_label = $discount_label;
|
||||
}
|
||||
@ -981,7 +981,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param boolean $apply_discount_to_renewals If we should apply discount to renewals.
|
||||
* @return void
|
||||
*/
|
||||
public function set_apply_discount_to_renewals($apply_discount_to_renewals) {
|
||||
public function set_apply_discount_to_renewals($apply_discount_to_renewals): void {
|
||||
|
||||
$this->apply_discount_to_renewals = $apply_discount_to_renewals;
|
||||
}
|
||||
@ -1004,7 +1004,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param int $product_id The product id.
|
||||
* @return void
|
||||
*/
|
||||
public function set_product_id($product_id) {
|
||||
public function set_product_id($product_id): void {
|
||||
|
||||
$this->product_id = $product_id;
|
||||
}
|
||||
@ -1027,7 +1027,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $title The line item title.
|
||||
* @return void
|
||||
*/
|
||||
public function set_title($title) {
|
||||
public function set_title($title): void {
|
||||
|
||||
$this->title = $title;
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $description The line item description.
|
||||
* @return void
|
||||
*/
|
||||
public function set_description($description) {
|
||||
public function set_description($description): void {
|
||||
|
||||
$this->description = $description;
|
||||
}
|
||||
@ -1073,7 +1073,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param string $tax_label Label of the tax applied.
|
||||
* @return void
|
||||
*/
|
||||
public function set_tax_label($tax_label) {
|
||||
public function set_tax_label($tax_label): void {
|
||||
|
||||
$this->tax_label = $tax_label;
|
||||
}
|
||||
@ -1135,17 +1135,17 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param array $query Query arguments.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_line_items($query = array()) {
|
||||
public static function get_line_items($query = []) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$query = wp_parse_args(
|
||||
$query,
|
||||
array(
|
||||
[
|
||||
'number' => 100,
|
||||
'date_query' => array(),
|
||||
'date_query' => [],
|
||||
'payment_status' => false,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$query['date_query']['column'] = 'p.date_created';
|
||||
@ -1154,7 +1154,7 @@ class Line_Item implements \JsonSerializable {
|
||||
|
||||
$date_query_sql = $date_query->get_sql();
|
||||
|
||||
$taxes_paid_list = array();
|
||||
$taxes_paid_list = [];
|
||||
|
||||
$status_query_sql = '';
|
||||
|
||||
@ -1219,7 +1219,7 @@ class Line_Item implements \JsonSerializable {
|
||||
* @param null|string $product_slug The product slug.
|
||||
* @return void
|
||||
*/
|
||||
public function set_product_slug($product_slug) {
|
||||
public function set_product_slug($product_slug): void {
|
||||
|
||||
$this->product_slug = $product_slug;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function get_field_as_type_option() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'title' => $this->get_title(),
|
||||
'desc' => $this->get_description(),
|
||||
'tooltip' => $this->get_tooltip(),
|
||||
@ -154,8 +154,8 @@ abstract class Base_Signup_Field {
|
||||
'default_fields' => $this->default_fields(),
|
||||
'force_attributes' => $this->force_attributes(),
|
||||
'all_attributes' => $this->get_all_attributes(),
|
||||
'fields' => array($this, 'get_editor_fields'),
|
||||
);
|
||||
'fields' => [$this, 'get_editor_fields'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,10 +180,10 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function get_tabs() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'content',
|
||||
'style',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,7 +219,7 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function calculate_style_attr() {
|
||||
|
||||
$styles = array();
|
||||
$styles = [];
|
||||
|
||||
$width = (int) wu_get_isset($this->attributes, 'width');
|
||||
|
||||
@ -244,7 +244,7 @@ abstract class Base_Signup_Field {
|
||||
* @param array $attributes Array containing settings for the field.
|
||||
* @return void
|
||||
*/
|
||||
public function set_attributes($attributes) {
|
||||
public function set_attributes($attributes): void {
|
||||
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
@ -257,7 +257,7 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,7 +268,7 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,14 +279,14 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id',
|
||||
'name',
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
'default',
|
||||
'required',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -297,7 +297,7 @@ abstract class Base_Signup_Field {
|
||||
* @param array $attributes The list of attributes of the field.
|
||||
* @return array
|
||||
*/
|
||||
public function get_editor_fields($attributes = array()) {
|
||||
public function get_editor_fields($attributes = []) {
|
||||
|
||||
$final_field_list = $this->get_fields();
|
||||
|
||||
@ -305,28 +305,28 @@ abstract class Base_Signup_Field {
|
||||
* Checks if this is a site field
|
||||
*/
|
||||
if ($this->is_site_field()) {
|
||||
$final_field_list[ '_site_notice_field_' . uniqid() ] = array(
|
||||
$final_field_list[ '_site_notice_field_' . uniqid() ] = [
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('This is a site-related field. For that reason, this field will not show up when no plans are present on the shopping cart.', 'wp-ultimo')),
|
||||
'order' => 98.5,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if this is a user field
|
||||
*/
|
||||
if ($this->is_user_field()) {
|
||||
$final_field_list[ '_user_notice_field_' . uniqid() ] = array(
|
||||
$final_field_list[ '_user_notice_field_' . uniqid() ] = [
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('This is a customer-related field. For that reason, this field will not show up when the user is logged and already has a customer on file.', 'wp-ultimo')),
|
||||
'order' => 98.5,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($final_field_list as $key => &$field) {
|
||||
$field['html_attr'] = wu_get_isset($field, 'html_attr', array());
|
||||
$field['html_attr'] = wu_get_isset($field, 'html_attr', []);
|
||||
|
||||
$value = wu_get_isset($attributes, $key, null);
|
||||
|
||||
@ -382,11 +382,11 @@ abstract class Base_Signup_Field {
|
||||
$tab = wu_get_isset($field, 'tab', 'content');
|
||||
|
||||
$field['wrapper_html_attr'] = array_merge(
|
||||
wu_get_isset($field, 'wrapper_html_attr', array()),
|
||||
array(
|
||||
wu_get_isset($field, 'wrapper_html_attr', []),
|
||||
[
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -401,14 +401,14 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public function get_all_attributes() {
|
||||
|
||||
$styles = array(
|
||||
$styles = [
|
||||
'wrapper_element_classes',
|
||||
'element_classes',
|
||||
'element_id',
|
||||
'from_request',
|
||||
'width',
|
||||
'logged',
|
||||
);
|
||||
];
|
||||
|
||||
$field_keys = array_keys($this->get_fields());
|
||||
|
||||
@ -436,34 +436,34 @@ abstract class Base_Signup_Field {
|
||||
*/
|
||||
public static function fields_list() {
|
||||
|
||||
$fields = array();
|
||||
$fields = [];
|
||||
|
||||
$fields['id'] = array(
|
||||
$fields['id'] = [
|
||||
'type' => 'text',
|
||||
'title' => __('Field ID', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. info-name', 'wp-ultimo'),
|
||||
'tooltip' => __('Only alpha-numeric and hyphens allowed.', 'wp-ultimo'),
|
||||
'desc' => __('The ID of the field. This is used to reference the field.', 'wp-ultimo'),
|
||||
'value' => wu_request('id', ''),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-on:input' => 'id = $event.target.value.toLowerCase().replace(/[^a-z0-9-_]+/g, "")',
|
||||
'v-bind:value' => 'id',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['name'] = array(
|
||||
$fields['name'] = [
|
||||
'type' => 'text',
|
||||
'title' => __('Field Label', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Your Name', 'wp-ultimo'),
|
||||
'desc' => __('This is what your customer see as the field title.', 'wp-ultimo'),
|
||||
'tooltip' => __('Leave blank to hide the field label. You can also set a placeholder value and tip in the "Additional Settings" tab.', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'name',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['placeholder'] = array(
|
||||
$fields['placeholder'] = [
|
||||
'type' => 'text',
|
||||
'title' => __('Field Placeholder', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Placeholder value', 'wp-ultimo'),
|
||||
@ -471,12 +471,12 @@ abstract class Base_Signup_Field {
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
'tab' => 'advanced',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'placeholder',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['tooltip'] = array(
|
||||
$fields['tooltip'] = [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Field Tooltip', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. This field is great, be sure to fill it.', 'wp-ultimo'),
|
||||
@ -485,60 +485,60 @@ abstract class Base_Signup_Field {
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
'tab' => 'advanced',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'tooltip',
|
||||
'rows' => 4,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['default_value'] = array(
|
||||
$fields['default_value'] = [
|
||||
'type' => 'text',
|
||||
'title' => __('Default Value', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. None', 'wp-ultimo'),
|
||||
'value' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'default_value',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['note'] = array(
|
||||
$fields['note'] = [
|
||||
'type' => 'textarea',
|
||||
'title' => __('Content', 'wp-ultimo'),
|
||||
'placeholder' => '',
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'content',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['limits'] = array(
|
||||
$fields['limits'] = [
|
||||
'type' => 'group',
|
||||
'title' => __('Field Length', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'fields' => array(
|
||||
'min' => array(
|
||||
'fields' => [
|
||||
'min' => [
|
||||
'type' => 'number',
|
||||
'value' => '',
|
||||
'placeholder' => __('Min', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-w-1/2',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'min',
|
||||
),
|
||||
),
|
||||
'max' => array(
|
||||
],
|
||||
],
|
||||
'max' => [
|
||||
'type' => 'number',
|
||||
'value' => '',
|
||||
'placeholder' => __('Max', 'wp-ultimo'),
|
||||
'wrapper_classes' => 'wu-ml-2 wu-w-1/2',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'max',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['save_as'] = array(
|
||||
$fields['save_as'] = [
|
||||
'type' => 'select',
|
||||
'title' => __('Save As', 'wp-ultimo'),
|
||||
'desc' => __('Select how you want to save this piece of meta data. You can attach it to the customer or the site as site meta or as site option.', 'wp-ultimo'),
|
||||
@ -546,28 +546,28 @@ abstract class Base_Signup_Field {
|
||||
'tooltip' => '',
|
||||
'value' => 'customer_meta',
|
||||
'order' => 99.5,
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'customer_meta' => __('Customer Meta', 'wp-ultimo'),
|
||||
'user_meta' => __('User Meta', 'wp-ultimo'),
|
||||
'site_meta' => __('Site Meta', 'wp-ultimo'),
|
||||
'site_option' => __('Site Option', 'wp-ultimo'),
|
||||
'nothing' => __('Do not save', 'wp-ultimo'),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model' => 'save_as',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$fields['required'] = array(
|
||||
$fields['required'] = [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Required', 'wp-ultimo'),
|
||||
'desc' => __('Mark this field as required. The checkout will not proceed unless this field is filled.', 'wp-ultimo'),
|
||||
'value' => 0,
|
||||
'order' => 98,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'required',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
@ -122,9 +122,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'zip_and_country' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,9 +135,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,10 +148,10 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'billing_address',
|
||||
'required' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,14 +162,14 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'zip_and_country' => array(
|
||||
return [
|
||||
'zip_and_country' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display only ZIP and Country?', 'wp-ultimo'),
|
||||
'desc' => __('Checking this option will only add the ZIP and country fields, instead of all the normal billing address fields.', 'wp-ultimo'),
|
||||
'value' => true,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +197,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
|
||||
$field['type'] = 'select';
|
||||
$field['options_template'] = $option_template;
|
||||
$field['options'] = array();
|
||||
$field['options'] = [];
|
||||
$field['required'] = true;
|
||||
$field['wrapper_html_attr']['v-if'] = "{$data_key_name}.length";
|
||||
$field['html_attr']['required'] = 'required';
|
||||
@ -234,16 +234,16 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
}
|
||||
|
||||
if (isset($fields['billing_country'])) {
|
||||
$fields['billing_country']['html_attr'] = array(
|
||||
$fields['billing_country']['html_attr'] = [
|
||||
'v-model' => 'country',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
if ( ! $zip_only) {
|
||||
if (isset($fields['billing_state'])) {
|
||||
$fields['billing_state']['html_attr'] = array(
|
||||
$fields['billing_state']['html_attr'] = [
|
||||
'v-model.lazy' => 'state',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Format the state field accordingly.
|
||||
@ -254,9 +254,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
}
|
||||
|
||||
if (isset($fields['billing_city'])) {
|
||||
$fields['billing_city']['html_attr'] = array(
|
||||
$fields['billing_city']['html_attr'] = [
|
||||
'v-model.lazy' => 'city',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Format the city field accordingly.
|
||||
|
@ -122,9 +122,9 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,13 +135,13 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id',
|
||||
'name',
|
||||
'tooltip',
|
||||
'save_as',
|
||||
'required',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,7 +152,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,15 +163,15 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'default_state' => array(
|
||||
return [
|
||||
'default_state' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Default State', 'wp-ultimo'),
|
||||
'desc' => __('Use the toggle to the set the default state of the checkbox.', 'wp-ultimo'),
|
||||
'value' => 0,
|
||||
'order' => 12,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,16 +184,16 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
$checkout_fields = array();
|
||||
$checkout_fields = [];
|
||||
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = [
|
||||
'type' => 'checkbox',
|
||||
'id' => $attributes['id'],
|
||||
'name' => $attributes['name'],
|
||||
'tooltip' => $attributes['tooltip'],
|
||||
'required' => $attributes['required'],
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
);
|
||||
];
|
||||
|
||||
if ($attributes['default_state']) {
|
||||
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
|
||||
|
@ -108,9 +108,9 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,14 +121,14 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id',
|
||||
'name',
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,14 +150,14 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'default_value' => array(
|
||||
return [
|
||||
'default_value' => [
|
||||
'type' => 'color-picker',
|
||||
'order' => 12,
|
||||
'title' => __('Default Color', 'wp-ultimo'),
|
||||
'desc' => __('Set the default value for this color field.', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,8 +170,8 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
return array(
|
||||
$attributes['id'] => array(
|
||||
return [
|
||||
$attributes['id'] => [
|
||||
'type' => 'color',
|
||||
'id' => $attributes['id'],
|
||||
'name' => $attributes['name'],
|
||||
@ -182,10 +182,10 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
'classes' => 'wu-rounded',
|
||||
'value' => $this->get_value(),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'style' => 'width: 50px !important',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -108,10 +108,10 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'placeholder' => '',
|
||||
'default' => '',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,11 +122,11 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,9 +137,9 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'discount_code',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,19 +163,19 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
$checkout_fields = array();
|
||||
$checkout_fields = [];
|
||||
|
||||
$checkout_fields['discount_code_checkbox'] = array(
|
||||
$checkout_fields['discount_code_checkbox'] = [
|
||||
'id' => 'discount_code',
|
||||
'type' => 'toggle',
|
||||
'name' => __('Have a coupon code?', 'wp-ultimo'),
|
||||
'class' => 'wu-w-auto',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'toggle_discount_code',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$checkout_fields['discount_code'] = array(
|
||||
$checkout_fields['discount_code'] = [
|
||||
'type' => 'text',
|
||||
'id' => 'discount_code',
|
||||
'name' => $attributes['name'],
|
||||
@ -184,16 +184,16 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'default' => $attributes['default'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'v-show' => 'toggle_discount_code',
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
'html_attr' => array(
|
||||
],
|
||||
'html_attr' => [
|
||||
'v-model.lazy' => 'discount_code',
|
||||
'v-init:discount_code' => "'{$this->get_value()}'",
|
||||
'v-init:toggle_discount_code' => ! empty($this->get_value()),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return $checkout_fields;
|
||||
}
|
||||
|
@ -115,9 +115,9 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'display_notices' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,11 +128,11 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,10 +143,10 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'email_address',
|
||||
'required' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,18 +157,18 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'display_notices' => array(
|
||||
return [
|
||||
'display_notices' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Notices', 'wp-ultimo'),
|
||||
'desc' => __('When the customer is already logged in, a box with the customer\'s username and a link to logout is displayed instead of the email field. Disable this option if you do not want that box to show up.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => 1,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'display_notices',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,34 +181,34 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
$checkout_fields = array();
|
||||
$checkout_fields = [];
|
||||
|
||||
if (is_user_logged_in()) {
|
||||
if ($attributes['display_notices']) {
|
||||
$checkout_fields['login_note'] = array(
|
||||
$checkout_fields['login_note'] = [
|
||||
'type' => 'note',
|
||||
'title' => __('Not you?', 'wp-ultimo'),
|
||||
'desc' => array($this, 'render_not_you_customer_message'),
|
||||
'desc' => [$this, 'render_not_you_customer_message'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if ($attributes['display_notices']) {
|
||||
$checkout_fields['login_note'] = array(
|
||||
$checkout_fields['login_note'] = [
|
||||
'type' => 'note',
|
||||
'title' => __('Existing customer?', 'wp-ultimo'),
|
||||
'desc' => array($this, 'render_existing_customer_message'),
|
||||
'desc' => [$this, 'render_existing_customer_message'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$checkout_fields['email_address'] = array(
|
||||
$checkout_fields['email_address'] = [
|
||||
'type' => 'text',
|
||||
'id' => 'email_address',
|
||||
'name' => $attributes['name'],
|
||||
@ -218,10 +218,10 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'required' => true,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
@ -108,9 +108,9 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'from_request' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,10 +121,10 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id',
|
||||
'save_as',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +135,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,8 +146,8 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'fixed_value' => array(
|
||||
return [
|
||||
'fixed_value' => [
|
||||
'order' => 12,
|
||||
'type' => 'text',
|
||||
'title' => __('Pre-filled Value', 'wp-ultimo'),
|
||||
@ -155,8 +155,8 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'placeholder' => __('e.g. blue', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => '',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,13 +186,13 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
return array(
|
||||
$attributes['id'] => array(
|
||||
return [
|
||||
$attributes['id'] => [
|
||||
'type' => 'hidden',
|
||||
'id' => $attributes['id'],
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
'value' => $this->get_value(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -109,10 +109,10 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'order_bump_template' => 'simple',
|
||||
'display_product_description' => 0,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,10 +123,10 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
// 'id',
|
||||
'name',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,9 +137,9 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'order_bump_template' => 'simple',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,37 +163,37 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
$editor_fields = array(
|
||||
'product' => array(
|
||||
$editor_fields = [
|
||||
'product' => [
|
||||
'type' => 'model',
|
||||
'title' => __('Product', 'wp-ultimo'),
|
||||
'placeholder' => __('e.g. Premium', 'wp-ultimo'),
|
||||
'desc' => __('Select the product that will be presented to the customer as an add-on option.', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'order' => 12,
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'data-model' => 'product',
|
||||
'data-value-field' => 'id',
|
||||
'data-label-field' => 'name',
|
||||
'data-search-field' => 'name',
|
||||
'data-max-items' => 1,
|
||||
),
|
||||
),
|
||||
'display_product_description' => array(
|
||||
],
|
||||
],
|
||||
'display_product_description' => [
|
||||
'order' => 13,
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Product Description', 'wp-ultimo'),
|
||||
'desc' => __('Toggle to display the product description as well, if one is available.', 'wp-ultimo'),
|
||||
'value' => 0,
|
||||
),
|
||||
'display_product_image' => array(
|
||||
],
|
||||
'display_product_image' => [
|
||||
'order' => 14,
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Product Image', 'wp-ultimo'),
|
||||
'desc' => __('Toggle to display the product image as well, if one is available.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
// $editor_fields['order_bump_template'] = array(
|
||||
// 'type' => 'group',
|
||||
@ -240,7 +240,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
$product = is_numeric($product_id) ? wu_get_product($product_id) : wu_get_product_by_slug($product_id);
|
||||
|
||||
if ( ! $product) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$attributes['product'] = $product;
|
||||
@ -249,12 +249,12 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
|
||||
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
|
||||
|
||||
return array(
|
||||
$attributes['id'] => array(
|
||||
return [
|
||||
$attributes['id'] => [
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -104,10 +104,10 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'order_summary_template' => 'clean',
|
||||
'table_columns' => 'simple',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,9 +118,9 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,9 +131,9 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'order_summary',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,34 +157,34 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
$editor_fields = array();
|
||||
$editor_fields = [];
|
||||
|
||||
$editor_fields['table_columns'] = array(
|
||||
$editor_fields['table_columns'] = [
|
||||
'type' => 'select',
|
||||
'title' => __('Table Columns', 'wp-ultimo'),
|
||||
'desc' => __('"Simplified" will condense all discount and tax info into separate rows to keep the table with only two columns. "Display All" adds a discounts and taxes column to each product row.', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'simple' => __('Simplified', 'wp-ultimo'),
|
||||
'full' => __('Display All', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$editor_fields['order_summary_template'] = array(
|
||||
$editor_fields['order_summary_template'] = [
|
||||
'type' => 'group',
|
||||
'desc' => Field_Templates_Manager::get_instance()->render_preview_block('order_summary'),
|
||||
'fields' => array(
|
||||
'order_summary_template' => array(
|
||||
'fields' => [
|
||||
'order_summary_template' => [
|
||||
'type' => 'select',
|
||||
'title' => __('Layout', 'wp-ultimo'),
|
||||
'placeholder' => __('Select your Layout', 'wp-ultimo'),
|
||||
'options' => array($this, 'get_templates'),
|
||||
'options' => [$this, 'get_templates'],
|
||||
'wrapper_classes' => 'wu-flex-grow',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'order_summary_template',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// @todo: re-add developer notes.
|
||||
// $editor_fields['_dev_note_develop_your_own_template_order_summary'] = array(
|
||||
@ -208,7 +208,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
$checkout_fields = array();
|
||||
$checkout_fields = [];
|
||||
|
||||
/*
|
||||
* Backwards compatibility with previous betas
|
||||
@ -221,15 +221,15 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
|
||||
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
|
||||
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = [
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
return $checkout_fields;
|
||||
}
|
||||
|
@ -122,10 +122,10 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'password_confirm_field' => false,
|
||||
'password_confirm_label' => __('Confirm Password', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,11 +136,11 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,10 +151,10 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'password',
|
||||
'required' => true,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,20 +165,20 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array(
|
||||
'password_strength_meter' => array(
|
||||
return [
|
||||
'password_strength_meter' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Password Strength Meter', 'wp-ultimo'),
|
||||
'desc' => __('Adds a password strength meter below the password field. Enabling this option also enforces passwords to be strong.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
),
|
||||
'password_confirm_field' => array(
|
||||
],
|
||||
'password_confirm_field' => [
|
||||
'type' => 'toggle',
|
||||
'title' => __('Display Password Confirm Field', 'wp-ultimo'),
|
||||
'desc' => __('Adds a "Confirm your Password" field below the default password field to reduce the chance or making a mistake.', 'wp-ultimo'),
|
||||
'value' => 1,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,12 +194,12 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
* Logged in user, bail.
|
||||
*/
|
||||
if (is_user_logged_in()) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$checkout_fields = array();
|
||||
$checkout_fields = [];
|
||||
|
||||
$checkout_fields['password'] = array(
|
||||
$checkout_fields['password'] = [
|
||||
'type' => 'password',
|
||||
'id' => 'password',
|
||||
'name' => $attributes['name'],
|
||||
@ -209,16 +209,16 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'required' => true,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'autocomplete' => 'new-password',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if ($attributes['password_confirm_field']) {
|
||||
$checkout_fields['password_conf'] = array(
|
||||
$checkout_fields['password_conf'] = [
|
||||
'type' => 'password',
|
||||
'id' => 'password_conf',
|
||||
'name' => $attributes['password_confirm_label'],
|
||||
@ -228,13 +228,13 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'required' => true,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'autocomplete' => 'new-password',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
@ -109,9 +109,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
*/
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,9 +122,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
*/
|
||||
public function default_fields() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,9 +135,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
*/
|
||||
public function force_attributes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => 'payment',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,7 +148,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
*/
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,24 +161,24 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
*/
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
$fields = array(
|
||||
'payment_template' => array(
|
||||
$fields = [
|
||||
'payment_template' => [
|
||||
'type' => 'text',
|
||||
'id' => 'payment_template',
|
||||
'name' => '',
|
||||
'classes' => 'wu-hidden',
|
||||
),
|
||||
'payment' => array(
|
||||
],
|
||||
'payment' => [
|
||||
'type' => 'payment-methods',
|
||||
'id' => 'payment',
|
||||
'name' => $attributes['name'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
'classes' => wu_get_isset($attributes, 'element_classes', ''),
|
||||
'wrapper_html_attr' => array(
|
||||
'wrapper_html_attr' => [
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/*
|
||||
* Checks if we need to add the
|
||||
@ -187,22 +187,22 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
if ( ! wu_get_setting('force_auto_renew', 1)) {
|
||||
$auto_renewable_gateways = Gateway_Manager::get_instance()->get_auto_renewable_gateways();
|
||||
|
||||
$fields['auto_renew'] = array(
|
||||
$fields['auto_renew'] = [
|
||||
'type' => 'toggle',
|
||||
'id' => 'auto_renew',
|
||||
'name' => __('Auto-renew', 'wp-ultimo'),
|
||||
'tooltip' => '',
|
||||
'value' => '1',
|
||||
'html_attr' => array(
|
||||
'html_attr' => [
|
||||
'v-model' => 'auto_renew',
|
||||
'true-value' => '1',
|
||||
'false-value' => '0',
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
],
|
||||
'wrapper_html_attr' => [
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('%s.includes(gateway) && order.should_collect_payment && order.has_recurring', json_encode($auto_renewable_gateways)),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user