diff --git a/composer.json b/composer.json
index ca63db773..511a77f4f 100644
--- a/composer.json
+++ b/composer.json
@@ -32,27 +32,24 @@
"php-di/php-di": "^7"
},
"require-dev": {
- "brain/monkey": "^2.6.1",
"captainhook/captainhook": "^5.10",
"dealerdirect/phpcodesniffer-composer-installer": "^v1.0.0",
"infinum/eightshift-coding-standards": "2.0.0-beta",
- "pestphp/pest": "^1.20",
"php-parallel-lint/php-parallel-lint": "^1.3",
"php-stubs/wordpress-stubs": "^6.3",
"roave/security-advisories": "dev-master",
"szepeviktor/phpstan-wordpress": "^1.3",
- "wp-cli/wp-cli": "^2.9",
- "yoast/wp-test-utils": "^1.0"
+ "wp-cli/wp-cli": "^2.9"
},
"autoload": {
"psr-4": {
- "EightshiftLibs\\": "src/",
- "EightshiftBoilerplate\\": "src/"
+ "EightshiftLibs\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "Tests\\": "tests/"
+ "Tests\\": "tests/",
+ "Infinum\\": "cliOutput/"
}
},
"minimum-stability": "dev",
@@ -64,7 +61,6 @@
"process-timeout": 2000,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
- "pestphp/pest-plugin": true,
"composer/installers": true
}
},
@@ -74,14 +70,10 @@
],
"test:types": "@php ./vendor/bin/phpstan analyze",
"test:standards": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-",
- "test:unit": "@php ./vendor/bin/pest --group=unit",
- "test:unit-report": "@php ./vendor/bin/pest --group=unit --log-junit tests/coverage/report.xml",
- "test:coverage": "@php ./vendor/bin/pest --group=unit --coverage",
"standards:fix": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --runtime-set testVersion 7.4-",
"test": [
"@test:standards",
- "@test:types",
- "@test:unit"
+ "@test:types"
]
}
}
diff --git a/package/intro.png b/package/intro.png
deleted file mode 100644
index f3d0056ef..000000000
Binary files a/package/intro.png and /dev/null differ
diff --git a/patchwork.json b/patchwork.json
deleted file mode 100644
index 54fad08da..000000000
--- a/patchwork.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "redefinable-internals": [
- "shell_exec",
- "system",
- "function_exists",
- "file_get_contents",
- "file_put_contents",
- "file_exists"
- ]
-}
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 00bbf7f21..f3d9c4474 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -55,6 +55,26 @@
*/src/Cli/*
+
+ */src/*/*Example.php
+ */src/Init/theme/
+
+
+
+ */src/*/*Example.php
+ */src/Init/theme/
+
+
+
+ */src/*/*Example.php
+ */src/Init/theme/
+
+
+
+ */src/*/*Example.php
+ */src/Init/theme/
+
+
0
@@ -77,17 +97,6 @@
0
-
-
-
-
-
-
-
-
-
-
-
*/src/**/*Cli.php
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index 758015e47..4c5b702d3 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -12,6 +12,8 @@ parameters:
- src/
excludePaths:
- src/**/*Example.php
+ - src/Init/theme/
+ - src/Init/plugin/
ignoreErrors:
# Ignore errors about reflection class variable being undefined. Errors are caught.
- '/^Variable \$reflectionClass might not be defined\.$/'
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index c9f200a64..000000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- ./tests/Unit/
-
-
-
-
-
-
-
- ./src
-
-
- ./src/Build/BuildExample.php
- ./src/Menu/BemMenuWalker.php
- ./src/ConfigProject/ConfigProjectExample.php
-
-
-
-
-
-
-
diff --git a/src/AdminMenus/AbstractAdminMenu.php b/src/AdminMenus/AbstractAdminMenu.php
index 8767fe8ff..e88d5b99b 100644
--- a/src/AdminMenus/AbstractAdminMenu.php
+++ b/src/AdminMenus/AbstractAdminMenu.php
@@ -10,7 +10,7 @@
namespace EightshiftLibs\AdminMenus;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use EightshiftLibs\Services\ServiceInterface;
use EightshiftLibs\Blocks\RenderableBlockInterface;
use Exception;
@@ -93,7 +93,7 @@ public function processAdminMenu($attr): void
public function render(array $attributes = [], string $innerBlockContent = ''): string
{
try {
- return Components::render($this->getViewComponent(), $attributes);
+ return Helpers::render($this->getViewComponent(), $attributes);
} catch (Exception $exception) { // To do: once new libs are released, replace with ComponentException.
// Don't let exceptions bubble up. Just render the exception message into the admin menu.
return \sprintf(
diff --git a/src/AdminMenus/AdminMenuCli.php b/src/AdminMenus/AdminMenuCli.php
index 839a9e702..69233b44e 100644
--- a/src/AdminMenus/AdminMenuCli.php
+++ b/src/AdminMenus/AdminMenuCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class AdminMenuCli
@@ -126,6 +126,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
// Get Arguments.
@@ -143,9 +144,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('title'), $title)
->searchReplaceString($this->getArgTemplate('menu_title'), $menuTitle)
->searchReplaceString($this->getArgTemplate('capability'), $capability)
@@ -160,6 +159,6 @@ public function __invoke(array $args, array $assocArgs)
}
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/AdminMenus/AdminMenuExample.php b/src/AdminMenus/AdminMenuExample.php
index 97a1d2868..4a925f313 100644
--- a/src/AdminMenus/AdminMenuExample.php
+++ b/src/AdminMenus/AdminMenuExample.php
@@ -3,14 +3,14 @@
/**
* File that holds class for admin menu example.
*
- * @package EightshiftBoilerplate\AdminMenus
+ * @package %g_namespace%\AdminMenus
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\AdminMenus;
+namespace %g_namespace%\AdminMenus;
-use EightshiftLibs\AdminMenus\AbstractAdminMenu;
+use %g_use_libs%\AdminMenus\AbstractAdminMenu;
/**
* AdminMenuExample class.
@@ -52,7 +52,7 @@ class AdminMenuExample extends AbstractAdminMenu
*/
protected function getTitle(): string
{
- return \esc_html__('%title%', 'eightshift-libs');
+ return \esc_html__('%title%', '%g_textdomain%');
}
/**
@@ -62,7 +62,7 @@ protected function getTitle(): string
*/
protected function getMenuTitle(): string
{
- return \esc_html__('%menu_title%', 'eightshift-libs');
+ return \esc_html__('%menu_title%', '%g_textdomain%');
}
/**
@@ -148,7 +148,7 @@ protected function getViewComponent(): string
protected function processAttributes($attr): array
{
return [
- 'pageTitle' => \esc_html__('%title%', 'eightshift-libs'),
+ 'pageTitle' => \esc_html__('%title%', '%g_textdomain%'),
];
}
}
diff --git a/src/AdminMenus/AdminReusableBlocksMenuCli.php b/src/AdminMenus/AdminReusableBlocksMenuCli.php
index 9a8419851..6d8bb541f 100644
--- a/src/AdminMenus/AdminReusableBlocksMenuCli.php
+++ b/src/AdminMenus/AdminReusableBlocksMenuCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class AdminReusableBlocksMenuCli
@@ -122,6 +122,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
// Get Arguments.
@@ -138,9 +139,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('title'), $title)
->searchReplaceString($this->getArgTemplate('menu_title'), $menuTitle)
->searchReplaceString($this->getArgTemplate('capability'), $capability);
@@ -154,6 +153,6 @@ public function __invoke(array $args, array $assocArgs)
}
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/AdminMenus/AdminReusableBlocksMenuExample.php b/src/AdminMenus/AdminReusableBlocksMenuExample.php
index 94a9116b9..60a11a9dc 100644
--- a/src/AdminMenus/AdminReusableBlocksMenuExample.php
+++ b/src/AdminMenus/AdminReusableBlocksMenuExample.php
@@ -3,14 +3,14 @@
/**
* File that holds class for admin menu example.
*
- * @package EightshiftBoilerplate\AdminMenus
+ * @package %g_namespace%\AdminMenus
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\AdminMenus;
+namespace %g_namespace%\AdminMenus;
-use EightshiftLibs\AdminMenus\AbstractAdminMenu;
+use %g_use_libs%\AdminMenus\AbstractAdminMenu;
/**
* AdminReusableBlocksMenuExample class.
@@ -73,7 +73,7 @@ function () {
*/
protected function getTitle(): string
{
- return \esc_html__('%title%', 'eightshift-libs');
+ return \esc_html__('%title%', '%g_textdomain%');
}
/**
@@ -83,7 +83,7 @@ protected function getTitle(): string
*/
protected function getMenuTitle(): string
{
- return \esc_html__('%menu_title%', 'eightshift-libs');
+ return \esc_html__('%menu_title%', '%g_textdomain%');
}
/**
diff --git a/src/AdminMenus/AdminSubMenuCli.php b/src/AdminMenus/AdminSubMenuCli.php
index b5563b2a6..9efb5b7ef 100644
--- a/src/AdminMenus/AdminSubMenuCli.php
+++ b/src/AdminMenus/AdminSubMenuCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class AdminSubMenuCli
@@ -117,6 +117,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
// Get Arguments.
@@ -133,14 +134,12 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('parent_slug'), $parentSlug)
->searchReplaceString($this->getArgTemplate('title'), $title)
->searchReplaceString($this->getArgTemplate('menu_title'), $menuTitle)
->searchReplaceString($this->getArgTemplate('capability'), $capability)
->searchReplaceString($this->getArgTemplate('menu_slug'), $menuSlug)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/AdminMenus/AdminSubMenuExample.php b/src/AdminMenus/AdminSubMenuExample.php
index 5c52b0efe..10089944f 100644
--- a/src/AdminMenus/AdminSubMenuExample.php
+++ b/src/AdminMenus/AdminSubMenuExample.php
@@ -3,14 +3,14 @@
/**
* File that holds class for admin sub menu example.
*
- * @package EightshiftBoilerplate\AdminMenus
+ * @package %g_namespace%\AdminMenus
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\AdminMenus;
+namespace %g_namespace%\AdminMenus;
-use EightshiftLibs\AdminMenus\AbstractAdminSubMenu;
+use %g_use_libs%\AdminMenus\AbstractAdminSubMenu;
/**
* AdminSubMenuExample class.
@@ -45,7 +45,7 @@ class AdminSubMenuExample extends AbstractAdminSubMenu
*/
protected function getTitle(): string
{
- return \esc_html__('%title%', 'eightshift-libs');
+ return \esc_html__('%title%', '%g_textdomain%');
}
/**
@@ -55,7 +55,7 @@ protected function getTitle(): string
*/
protected function getMenuTitle(): string
{
- return \esc_html__('%menu_title%', 'eightshift-libs');
+ return \esc_html__('%menu_title%', '%g_textdomain%');
}
/**
@@ -115,7 +115,7 @@ protected function getViewComponent(): string
protected function processAttributes($attr): array
{
return [
- 'pageTitle' => \esc_html__('%title%', 'eightshift-libs'),
+ 'pageTitle' => \esc_html__('%title%', '%g_textdomain%'),
];
}
}
diff --git a/src/AdminMenus/ReusableBlocksHeaderFooterCli.php b/src/AdminMenus/ReusableBlocksHeaderFooterCli.php
index b6fb7033b..5c4916611 100644
--- a/src/AdminMenus/ReusableBlocksHeaderFooterCli.php
+++ b/src/AdminMenus/ReusableBlocksHeaderFooterCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class ReusableBlocksHeaderFooterCli
@@ -113,6 +113,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
// Get Arguments.
@@ -128,9 +129,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('title'), $title)
->searchReplaceString($this->getArgTemplate('capability'), $capability)
->searchReplaceString($this->getArgTemplate('menu_title'), $menuTitle);
@@ -140,6 +139,6 @@ public function __invoke(array $args, array $assocArgs)
}
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'AdminMenus'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/AdminMenus/ReusableBlocksHeaderFooterExample.php b/src/AdminMenus/ReusableBlocksHeaderFooterExample.php
index 4a5df703f..03ad9e8a2 100644
--- a/src/AdminMenus/ReusableBlocksHeaderFooterExample.php
+++ b/src/AdminMenus/ReusableBlocksHeaderFooterExample.php
@@ -3,15 +3,15 @@
/**
* File that holds class for reusable blocks header/footer example.
*
- * @package EightshiftBoilerplate\AdminMenus
+ * @package %g_namespace%\AdminMenus
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\AdminMenus;
+namespace %g_namespace%\AdminMenus;
-use EightshiftLibs\AdminMenus\AbstractAdminMenu;
-use EightshiftLibs\Helpers\Components;
+use %g_use_libs%\AdminMenus\AbstractAdminMenu;
+use %g_use_libs%\Helpers\Helpers;
use WP_Query;
/**
@@ -89,7 +89,7 @@ public function register(): void
*/
protected function getTitle(): string
{
- return \esc_html__('%title%', 'eightshift-libs');
+ return \esc_html__('%title%', '%g_textdomain%');
}
/**
@@ -99,7 +99,7 @@ protected function getTitle(): string
*/
protected function getMenuTitle(): string
{
- return \esc_html__('%menu_title%', 'eightshift-libs');
+ return \esc_html__('%menu_title%', '%g_textdomain%');
}
/**
@@ -203,7 +203,7 @@ public function registerWpSettings(): void
\add_settings_field(
self::HEADER_PARTIAL,
- \__('Header partial', 'eightshift-libs'),
+ \__('Header partial', '%g_textdomain%'),
[$this, 'renderPartialSelector'],
self::ADMIN_MENU_SLUG,
self::SETTINGS_SECTION_NAME,
@@ -215,7 +215,7 @@ public function registerWpSettings(): void
\add_settings_field(
self::FOOTER_PARTIAL,
- \__('Footer partial', 'eightshift-libs'),
+ \__('Footer partial', '%g_textdomain%'),
[$this, 'renderPartialSelector'],
self::ADMIN_MENU_SLUG,
self::SETTINGS_SECTION_NAME,
@@ -249,7 +249,7 @@ public function renderPartialSelector($args): void
?>
-
+
prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'AnalyticsGdpr'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'AnalyticsGdpr'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/AnalyticsGdpr/AnalyticsGdprExample.php b/src/AnalyticsGdpr/AnalyticsGdprExample.php
index f26095d00..c016553ab 100644
--- a/src/AnalyticsGdpr/AnalyticsGdprExample.php
+++ b/src/AnalyticsGdpr/AnalyticsGdprExample.php
@@ -3,14 +3,14 @@
/**
* Class that adds Analytics and GDPR capability.
*
- * @package EightshiftBoilerplate\AnalyticsGdpr
+ * @package %g_namespace%\AnalyticsGdpr
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\AnalyticsGdpr;
+namespace %g_namespace%\AnalyticsGdpr;
-use EightshiftLibs\Services\ServiceInterface;
+use %g_use_libs%\Services\ServiceInterface;
/**
* Class AnalyticsGdprExample
@@ -228,8 +228,8 @@ public function createAnalyticsPage(): void
if (\function_exists('acf_add_options_page')) {
\acf_add_options_page(
[
- 'page_title' => \esc_html__('Analytics and GDPR settings', 'eightshift-libs'),
- 'menu_title' => \esc_html__('Analytics', 'eightshift-libs'),
+ 'page_title' => \esc_html__('Analytics and GDPR settings', '%g_textdomain%'),
+ 'menu_title' => \esc_html__('Analytics', '%g_textdomain%'),
'menu_slug' => static::ANALYTICS_SLUG,
'capability' => static::ANALYTICS_CAPABILITY,
'redirect' => false,
@@ -251,11 +251,11 @@ public function registerAnalytics(): void
\acf_add_local_field_group(
[
'key' => 'group_5fc829103758c',
- 'title' => \esc_html__('Analytics', 'eightshift-libs'),
+ 'title' => \esc_html__('Analytics', '%g_textdomain%'),
'fields' => [
[
'key' => 'field_0927122830152',
- 'label' => \esc_html__('Google Optimize on pages', 'eightshift-libs'),
+ 'label' => \esc_html__('Google Optimize on pages', '%g_textdomain%'),
'name' => static::GOOGLE_OPTIMIZE_PAGES,
'type' => 'post_object',
'instructions' => '',
@@ -275,7 +275,7 @@ public function registerAnalytics(): void
],
[
'key' => 'field_5810891023701',
- 'label' => \esc_html__('Google Tag Manager Container ID', 'eightshift-libs'),
+ 'label' => \esc_html__('Google Tag Manager Container ID', '%g_textdomain%'),
'name' => static::GOOGLE_TAG_MANAGER_CONTAINER_ID,
'type' => 'text',
'instructions' => '',
@@ -325,8 +325,8 @@ public function createGdprModalPage(): void
if (\function_exists('acf_add_options_sub_page') && \current_user_can(self::ANALYTICS_CAPABILITY)) {
\acf_add_options_sub_page(
[
- 'page_title' => \esc_html__('GDPR Modal', 'eightshift-libs'),
- 'menu_title' => \esc_html__('GDPR', 'eightshift-libs'),
+ 'page_title' => \esc_html__('GDPR Modal', '%g_textdomain%'),
+ 'menu_title' => \esc_html__('GDPR', '%g_textdomain%'),
'menu_slug' => self::GDPR_MODAL_SLUG,
'parent_slug' => self::ANALYTICS_SLUG,
]
@@ -345,11 +345,11 @@ public function registerGdprModalSettings(): void
\acf_add_local_field_group(
[
'key' => 'group_5f09139247eb0',
- 'title' => \esc_html__('GDPR', 'eightshift-libs'),
+ 'title' => \esc_html__('GDPR', '%g_textdomain%'),
'fields' => [
[
'key' => 'field_5f5f29103542a8',
- 'label' => \esc_html__('Basic modal open advanced link', 'eightshift-libs'),
+ 'label' => \esc_html__('Basic modal open advanced link', '%g_textdomain%'),
'name' => static::BASIC_MODAL_OPEN_ADVANCED,
'type' => 'text',
'instructions' => '',
@@ -360,7 +360,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Manage cookies', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Manage cookies', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -368,7 +368,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f102929842a8',
- 'label' => \esc_html__('Basic modal intro', 'eightshift-libs'),
+ 'label' => \esc_html__('Basic modal intro', '%g_textdomain%'),
'name' => static::BASIC_MODAL_INTRO,
'type' => 'text',
'instructions' => '',
@@ -380,7 +380,7 @@ public function registerGdprModalSettings(): void
'id' => '',
],
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'default_value' => \esc_html__('By clicking "I agree", you accept storing of all cookies on your device to enhance user experience, analyze site usage, and assist in our marketing efforts.', 'eightshift-libs'),
+ 'default_value' => \esc_html__('By clicking "I agree", you accept storing of all cookies on your device to enhance user experience, analyze site usage, and assist in our marketing efforts.', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -388,7 +388,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f902a4657483',
- 'label' => \esc_html__('Basic modal accept button', 'eightshift-libs'),
+ 'label' => \esc_html__('Basic modal accept button', '%g_textdomain%'),
'name' => static::BASIC_MODAL_ACCEPT_BUTTON,
'type' => 'text',
'instructions' => '',
@@ -399,7 +399,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Accept all', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Accept all', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -407,7 +407,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f812934842a8',
- 'label' => \esc_html__('Advanced modal title', 'eightshift-libs'),
+ 'label' => \esc_html__('Advanced modal title', '%g_textdomain%'),
'name' => static::ADVANCED_MODAL_TITLE,
'type' => 'text',
'instructions' => '',
@@ -418,7 +418,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('We need your consent to continue', 'eightshift-libs'),
+ 'default_value' => \esc_html__('We need your consent to continue', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -426,7 +426,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f473829842a8',
- 'label' => \esc_html__('Advanced modal accept all button', 'eightshift-libs'),
+ 'label' => \esc_html__('Advanced modal accept all button', '%g_textdomain%'),
'name' => static::ADVANCED_MODAL_ACCEPT_ALL_BUTTON,
'type' => 'text',
'instructions' => '',
@@ -437,7 +437,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Accept all', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Accept all', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -445,7 +445,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f473921022a8',
- 'label' => \esc_html__('Advanced modal reject all button', 'eightshift-libs'),
+ 'label' => \esc_html__('Advanced modal reject all button', '%g_textdomain%'),
'name' => static::ADVANCED_MODAL_REJECT_ALL_BUTTON,
'type' => 'text',
'instructions' => '',
@@ -456,7 +456,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Reject all', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Reject all', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -464,7 +464,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_50001229842a8',
- 'label' => \esc_html__('Advanced modal confirm choices button', 'eightshift-libs'),
+ 'label' => \esc_html__('Advanced modal confirm choices button', '%g_textdomain%'),
'name' => static::ADVANCED_MODAL_CHOICE_BUTTON,
'type' => 'text',
'instructions' => '',
@@ -475,7 +475,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Confirm choices', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Confirm choices', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -483,11 +483,11 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_61910287b1a5d',
- 'label' => \esc_html__('Privacy policy page link', 'eightshift-libs'),
+ 'label' => \esc_html__('Privacy policy page link', '%g_textdomain%'),
'name' => static::ADVANCED_MODAL_PRIVACY_POLICY_LINK,
'type' => 'page_link',
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'instructions' => \esc_html__('Select the page which serves as privacy policy, it will be linked in advanced cookie modal.', 'eightshift-libs'),
+ 'instructions' => \esc_html__('Select the page which serves as privacy policy, it will be linked in advanced cookie modal.', '%g_textdomain%'),
'required' => 0,
'conditional_logic' => 0,
'wrapper' => [
@@ -505,11 +505,11 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_621c12e21e5f8',
- 'label' => \esc_html__('Date of publishing privacy policy', 'eightshift-libs'),
+ 'label' => \esc_html__('Date of publishing privacy policy', '%g_textdomain%'),
'name' => static::PRIVACY_POLICY_PUBLISH_DATE,
'type' => 'date_time_picker',
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'instructions' => \esc_html__('Date when you\'ve changed the privacy policy. If user accepted the privacy policy before new date is set. GDPR modal will appear to that user.', 'eightshift-libs'),
+ 'instructions' => \esc_html__('Date when you\'ve changed the privacy policy. If user accepted the privacy policy before new date is set. GDPR modal will appear to that user.', '%g_textdomain%'),
'required' => 0,
'conditional_logic' => 0,
'default_value' => \gmdate('d m Y H:i:s'),
@@ -524,7 +524,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_50009184844a9',
- 'label' => \esc_html__('Required Cookies', 'eightshift-libs'),
+ 'label' => \esc_html__('Required Cookies', '%g_textdomain%'),
'name' => '',
'type' => 'tab',
'instructions' => '',
@@ -540,7 +540,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_621cb755cb8e4',
- 'label' => \esc_html__('Required Cookies Activated', 'eightshift-libs'),
+ 'label' => \esc_html__('Required Cookies Activated', '%g_textdomain%'),
'name' => static::REQUIRED_COOKIES_ACTIVATED,
'type' => 'true_false',
'instructions' => '',
@@ -551,13 +551,13 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'message' => \esc_html__('Activate Required cookie level', 'eightshift-libs'),
+ 'message' => \esc_html__('Activate Required cookie level', '%g_textdomain%'),
'default_value' => 1,
'ui' => 0,
],
[
'key' => 'field_5f8f7939844ac',
- 'label' => \esc_html__('Required Title', 'eightshift-libs'),
+ 'label' => \esc_html__('Required Title', '%g_textdomain%'),
'name' => static::REQUIRED_COOKIES_TITLE,
'type' => 'text',
'instructions' => '',
@@ -568,7 +568,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Required cookies', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Required cookies', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -576,7 +576,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5f5f66482910f',
- 'label' => \esc_html__('Required Summary', 'eightshift-libs'),
+ 'label' => \esc_html__('Required Summary', '%g_textdomain%'),
'name' => static::REQUIRED_COOKIES_SUMMARY,
'type' => 'text',
'instructions' => '',
@@ -588,7 +588,7 @@ public function registerGdprModalSettings(): void
'id' => '',
],
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'default_value' => \esc_html__('Cookies for the basic functionality of the website.', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Cookies for the basic functionality of the website.', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -596,7 +596,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_f83912e4844a9',
- 'label' => \esc_html__('Functional Cookies', 'eightshift-libs'),
+ 'label' => \esc_html__('Functional Cookies', '%g_textdomain%'),
'name' => '',
'type' => 'tab',
'instructions' => '',
@@ -612,7 +612,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_621c9182668e4',
- 'label' => \esc_html__('Functional Cookies Activated', 'eightshift-libs'),
+ 'label' => \esc_html__('Functional Cookies Activated', '%g_textdomain%'),
'name' => static::FUNCTIONAL_COOKIES_ACTIVATED,
'type' => 'true_false',
'instructions' => '',
@@ -623,13 +623,13 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'message' => \esc_html__('Activate Functional cookie level', 'eightshift-libs'),
+ 'message' => \esc_html__('Activate Functional cookie level', '%g_textdomain%'),
'default_value' => 1,
'ui' => 0,
],
[
'key' => 'field_5f5f1589164ac',
- 'label' => \esc_html__('Functional Title', 'eightshift-libs'),
+ 'label' => \esc_html__('Functional Title', '%g_textdomain%'),
'name' => static::FUNCTIONAL_COOKIES_TITLE,
'type' => 'text',
'instructions' => '',
@@ -640,7 +640,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Functional cookies', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Functional cookies', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -648,7 +648,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5091024ff452d',
- 'label' => \esc_html__('Functional Summary', 'eightshift-libs'),
+ 'label' => \esc_html__('Functional Summary', '%g_textdomain%'),
'name' => static::FUNCTIONAL_COOKIES_SUMMARY,
'type' => 'text',
'instructions' => '',
@@ -660,7 +660,7 @@ public function registerGdprModalSettings(): void
'id' => '',
],
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'default_value' => \esc_html__('Cookies for additional functionality and increased website security.', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Cookies for additional functionality and increased website security.', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -668,7 +668,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_0910234520139',
- 'label' => \esc_html__('Performance Cookies', 'eightshift-libs'),
+ 'label' => \esc_html__('Performance Cookies', '%g_textdomain%'),
'name' => '',
'type' => 'tab',
'instructions' => '',
@@ -684,7 +684,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_62110242168e4',
- 'label' => \esc_html__('Performance Cookies Activated', 'eightshift-libs'),
+ 'label' => \esc_html__('Performance Cookies Activated', '%g_textdomain%'),
'name' => static::PERFORMANCE_COOKIES_ACTIVATED,
'type' => 'true_false',
'instructions' => '',
@@ -695,13 +695,13 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'message' => \esc_html__('Activate Performance cookie level', 'eightshift-libs'),
+ 'message' => \esc_html__('Activate Performance cookie level', '%g_textdomain%'),
'default_value' => 1,
'ui' => 0,
],
[
'key' => 'field_5f5f1082914ac',
- 'label' => \esc_html__('Performance Title', 'eightshift-libs'),
+ 'label' => \esc_html__('Performance Title', '%g_textdomain%'),
'name' => static::PERFORMANCE_COOKIES_TITLE,
'type' => 'text',
'instructions' => '',
@@ -712,7 +712,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Performance cookies', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Performance cookies', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -720,7 +720,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_509191024a52d',
- 'label' => \esc_html__('Performance Summary', 'eightshift-libs'),
+ 'label' => \esc_html__('Performance Summary', '%g_textdomain%'),
'name' => static::PERFORMANCE_COOKIES_SUMMARY,
'type' => 'text',
'instructions' => '',
@@ -732,7 +732,7 @@ public function registerGdprModalSettings(): void
'id' => '',
],
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'default_value' => \esc_html__('Performance cookies monitor only the performance of the site as the user interacts with it. These cookies don\'t collect identifiable information on visitor. Data is anonymous.', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Performance cookies monitor only the performance of the site as the user interacts with it. These cookies don\'t collect identifiable information on visitor. Data is anonymous.', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -740,7 +740,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_0897712920139',
- 'label' => \esc_html__('Marketing Cookies', 'eightshift-libs'),
+ 'label' => \esc_html__('Marketing Cookies', '%g_textdomain%'),
'name' => '',
'type' => 'tab',
'instructions' => '',
@@ -756,7 +756,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_62110192468e4',
- 'label' => \esc_html__('Marketing Cookies Activated', 'eightshift-libs'),
+ 'label' => \esc_html__('Marketing Cookies Activated', '%g_textdomain%'),
'name' => static::MARKETING_COOKIES_ACTIVATED,
'type' => 'true_false',
'instructions' => '',
@@ -767,13 +767,13 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'message' => \esc_html__('Activate Marketing cookie level', 'eightshift-libs'),
+ 'message' => \esc_html__('Activate Marketing cookie level', '%g_textdomain%'),
'default_value' => 1,
'ui' => 0,
],
[
'key' => 'field_5f7ff654164ac',
- 'label' => \esc_html__('Marketing Title', 'eightshift-libs'),
+ 'label' => \esc_html__('Marketing Title', '%g_textdomain%'),
'name' => static::MARKETING_COOKIES_TITLE,
'type' => 'text',
'instructions' => '',
@@ -784,7 +784,7 @@ public function registerGdprModalSettings(): void
'class' => '',
'id' => '',
],
- 'default_value' => \esc_html__('Marketing cookies', 'eightshift-libs'),
+ 'default_value' => \esc_html__('Marketing cookies', '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -792,7 +792,7 @@ public function registerGdprModalSettings(): void
],
[
'key' => 'field_5ff922112684d',
- 'label' => \esc_html__('Marketing Summary', 'eightshift-libs'),
+ 'label' => \esc_html__('Marketing Summary', '%g_textdomain%'),
'name' => static::MARKETING_COOKIES_SUMMARY,
'type' => 'text',
'instructions' => '',
@@ -804,7 +804,7 @@ public function registerGdprModalSettings(): void
'id' => '',
],
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'default_value' => \esc_html__("Advertising and analytics service cookies that create day-to-day statistics and show ads on their site and on the advertiser's partners websites.", 'eightshift-libs'),
+ 'default_value' => \esc_html__("Advertising and analytics service cookies that create day-to-day statistics and show ads on their site and on the advertiser's partners websites.", '%g_textdomain%'),
'placeholder' => '',
'prepend' => '',
'append' => '',
@@ -847,40 +847,40 @@ public function prepareGdprModalData(): array
return [
'basic' => [
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'intro' => \get_field(static::BASIC_MODAL_INTRO, 'option') ?? \esc_html__('By clicking "I agree", you accept storing of all cookies on your device to enhance user experience, analyze site usage, and assist in our marketing efforts.', 'eightshift-libs'),
- 'acceptButton' => \get_field(static::BASIC_MODAL_ACCEPT_BUTTON, 'option') ?? \esc_html__('Accept all', 'eightshift-libs'),
- 'openAdvanced' => \get_field(static::BASIC_MODAL_OPEN_ADVANCED, 'option') ?? \esc_html__('Manage cookies', 'eightshift-libs'),
+ 'intro' => \get_field(static::BASIC_MODAL_INTRO, 'option') ?? \esc_html__('By clicking "I agree", you accept storing of all cookies on your device to enhance user experience, analyze site usage, and assist in our marketing efforts.', '%g_textdomain%'),
+ 'acceptButton' => \get_field(static::BASIC_MODAL_ACCEPT_BUTTON, 'option') ?? \esc_html__('Accept all', '%g_textdomain%'),
+ 'openAdvanced' => \get_field(static::BASIC_MODAL_OPEN_ADVANCED, 'option') ?? \esc_html__('Manage cookies', '%g_textdomain%'),
],
'advanced' => [
- 'title' => \get_field(static::ADVANCED_MODAL_TITLE, 'option') ?? \esc_html__('We need your consent to continue', 'eightshift-libs'),
- 'acceptAllButton' => \get_field(static::ADVANCED_MODAL_ACCEPT_ALL_BUTTON, 'option') ?? \esc_html__('Accept all', 'eightshift-libs'),
- 'rejectAllButton' => \get_field(static::ADVANCED_MODAL_REJECT_ALL_BUTTON, 'option') ?? \esc_html__('Reject all', 'eightshift-libs'),
- 'choiceButton' => \get_field(static::ADVANCED_MODAL_CHOICE_BUTTON, 'option') ?? \esc_html__('Confirm choices', 'eightshift-libs'),
+ 'title' => \get_field(static::ADVANCED_MODAL_TITLE, 'option') ?? \esc_html__('We need your consent to continue', '%g_textdomain%'),
+ 'acceptAllButton' => \get_field(static::ADVANCED_MODAL_ACCEPT_ALL_BUTTON, 'option') ?? \esc_html__('Accept all', '%g_textdomain%'),
+ 'rejectAllButton' => \get_field(static::ADVANCED_MODAL_REJECT_ALL_BUTTON, 'option') ?? \esc_html__('Reject all', '%g_textdomain%'),
+ 'choiceButton' => \get_field(static::ADVANCED_MODAL_CHOICE_BUTTON, 'option') ?? \esc_html__('Confirm choices', '%g_textdomain%'),
'privacyPolicyLink' => \get_field(static::ADVANCED_MODAL_PRIVACY_POLICY_LINK, 'option') ?? '',
],
'publishDate' => \get_field(static::PRIVACY_POLICY_PUBLISH_DATE, 'option') ?? \gmdate('F j, Y g:i ZZZ'),
'levels' => [
'required' => [
- 'title' => \get_field(static::REQUIRED_COOKIES_TITLE, 'option') ?? \esc_html__('Required cookies', 'eightshift-libs'),
- 'summary' => \get_field(static::REQUIRED_COOKIES_SUMMARY, 'option') ?? \esc_html__('Cookies for the basic functionality of the website.', 'eightshift-libs'),
+ 'title' => \get_field(static::REQUIRED_COOKIES_TITLE, 'option') ?? \esc_html__('Required cookies', '%g_textdomain%'),
+ 'summary' => \get_field(static::REQUIRED_COOKIES_SUMMARY, 'option') ?? \esc_html__('Cookies for the basic functionality of the website.', '%g_textdomain%'),
'activated' => \get_field(static::REQUIRED_COOKIES_ACTIVATED, 'option') ?? true,
],
'functional' => [
- 'title' => \get_field(static::FUNCTIONAL_COOKIES_TITLE, 'option') ?? \esc_html__('Functional cookies', 'eightshift-libs'),
+ 'title' => \get_field(static::FUNCTIONAL_COOKIES_TITLE, 'option') ?? \esc_html__('Functional cookies', '%g_textdomain%'),
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'summary' => \get_field(static::FUNCTIONAL_COOKIES_SUMMARY, 'option') ?? \esc_html__('Cookies for additional functionality and increased website security.', 'eightshift-libs'),
+ 'summary' => \get_field(static::FUNCTIONAL_COOKIES_SUMMARY, 'option') ?? \esc_html__('Cookies for additional functionality and increased website security.', '%g_textdomain%'),
'activated' => \get_field(static::FUNCTIONAL_COOKIES_ACTIVATED, 'option') ?? true,
],
'performance' => [
- 'title' => \get_field(static::PERFORMANCE_COOKIES_TITLE, 'option') ?? \esc_html__('Performance cookies', 'eightshift-libs'),
+ 'title' => \get_field(static::PERFORMANCE_COOKIES_TITLE, 'option') ?? \esc_html__('Performance cookies', '%g_textdomain%'),
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'summary' => \get_field(static::PERFORMANCE_COOKIES_SUMMARY, 'option') ?? \esc_html__('Performance cookies monitor only the performance of the site as the user interacts with it. These cookies don\'t collect identifiable information on visitor. Data is anonymous.', 'eightshift-libs'),
+ 'summary' => \get_field(static::PERFORMANCE_COOKIES_SUMMARY, 'option') ?? \esc_html__('Performance cookies monitor only the performance of the site as the user interacts with it. These cookies don\'t collect identifiable information on visitor. Data is anonymous.', '%g_textdomain%'),
'activated' => \get_field(static::PERFORMANCE_COOKIES_ACTIVATED, 'option') ?? true,
],
'marketing' => [
- 'title' => \get_field(static::MARKETING_COOKIES_TITLE, 'option') ?? \esc_html__('Marketing cookies', 'eightshift-libs'),
+ 'title' => \get_field(static::MARKETING_COOKIES_TITLE, 'option') ?? \esc_html__('Marketing cookies', '%g_textdomain%'),
// phpcs:ignore Generic.Files.LineLength.TooLong
- 'summary' => \get_field(static::MARKETING_COOKIES_SUMMARY, 'option') ?? \esc_html__("Advertising and analytics service cookies that create day-to-day statistics and show ads on their site and on the advertiser's partners websites.", 'eightshift-libs'),
+ 'summary' => \get_field(static::MARKETING_COOKIES_SUMMARY, 'option') ?? \esc_html__("Advertising and analytics service cookies that create day-to-day statistics and show ads on their site and on the advertiser's partners websites.", '%g_textdomain%'),
'activated' => \get_field(static::REQUIRED_COOKIES_ACTIVATED, 'option') ?? true,
],
],
diff --git a/src/BlockPatterns/BlockPatternCli.php b/src/BlockPatterns/BlockPatternCli.php
index 211a23e75..6853df662 100644
--- a/src/BlockPatterns/BlockPatternCli.php
+++ b/src/BlockPatterns/BlockPatternCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class BlockPatternCli
@@ -113,6 +113,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
// Get Props.
@@ -131,13 +132,12 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('title'), $title)
->searchReplaceString($this->getArgTemplate('name'), $name)
->searchReplaceString($this->getArgTemplate('content'), $content)
->searchReplaceString($this->getArgTemplate('description'), $description)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'BlockPatterns'), "{$className}.php", $assocArgs);
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'BlockPatterns'), "{$className}.php", $assocArgs);
}
/**
@@ -148,6 +148,6 @@ public function __invoke(array $args, array $assocArgs)
*/
private function generateName(string $title): string
{
- return 'eightshift-boilerplate/' . Components::camelToKebabCase($title);
+ return 'eightshift-boilerplate/' . Helpers::camelToKebabCase($title);
}
}
diff --git a/src/BlockPatterns/BlockPatternExample.php b/src/BlockPatterns/BlockPatternExample.php
index a02c6454f..b5b58c65d 100644
--- a/src/BlockPatterns/BlockPatternExample.php
+++ b/src/BlockPatterns/BlockPatternExample.php
@@ -8,9 +8,9 @@
declare(strict_types=1);
-namespace EightshiftBoilerplate\BlockPatterns;
+namespace %g_namespace%\BlockPatterns;
-use EightshiftLibs\BlockPatterns\AbstractBlockPattern;
+use %g_use_libs%\BlockPatterns\AbstractBlockPattern;
/**
* BlockPatternExample class.
diff --git a/src/Blocks/AbstractBlocksCli.php b/src/Blocks/AbstractBlocksCli.php
index 222b0964a..0b22f2dab 100644
--- a/src/Blocks/AbstractBlocksCli.php
+++ b/src/Blocks/AbstractBlocksCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\AbstractCli;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Abstract class used for Blocks and Components
@@ -113,8 +113,8 @@ protected function moveItems(array $args, string $source, string $destination, s
);
}
- $fullSource = Components::joinPaths([$source, $item]);
- $fullDestination = Components::joinPaths([$destination, $item]);
+ $fullSource = Helpers::joinPaths([$source, $item]);
+ $fullDestination = Helpers::joinPaths([$destination, $item]);
if ($isSingleFolder) {
$fullSource = $source;
@@ -125,9 +125,10 @@ protected function moveItems(array $args, string $source, string $destination, s
self::cliError(
\sprintf(
// translators: %s will be replaced with type of item, and shorten cli path.
- "%s files exist on this path: `%s`. If you want to override the destination folder please use --skip_existing='true' argument.",
+ "%s files exist on this path: `%s`. If you want to override the destination folder please use --%s='true' argument.",
$type,
- $this->getShortenCliPathOutput($fullDestination)
+ $this->getShortenCliPathOutput($fullDestination),
+ AbstractCli::ARG_SKIP_EXISTING
)
);
}
@@ -139,25 +140,10 @@ protected function moveItems(array $args, string $source, string $destination, s
$this->copyRecursively($fullSource, $fullDestination);
}
- $partialsOutput = [];
- $partialsPath = Components::joinPaths([$fullDestination, 'partials']);
-
- // Check if we have partials folder. If so output that folder with items in it.
- if (\is_dir($partialsPath)) {
- $partials = \array_diff(\scandir($partialsPath), ['..', '.']);
- $partials = \array_values($partials);
-
- $partialsOutput = \array_map(
- static function ($item) use ($sep) {
- return "partials{$sep}{$item}";
- },
- $partials
- );
- }
-
$innerItems = \array_merge(
- $this->getFullBlocksFiles($item),
- $partialsOutput
+ $this->getFullDirFiles($fullDestination),
+ $this->getFullDirFiles($fullDestination, 'components'),
+ $this->getFullDirFiles($fullDestination, 'partials'),
);
foreach ($innerItems as $innerItem) {
@@ -165,12 +151,9 @@ static function ($item) use ($sep) {
$class = $this->getExampleTemplate($fullDestination, $innerItem, true);
if (!empty($class->fileContents)) {
- $class->renameProjectName($args)
- ->renameNamespace($args)
- ->renameTextDomainFrontendLibs($args)
- ->renameUseFrontendLibs($args)
+ $class->renameGlobals($args)
->outputWrite($fullDestination, $innerItem, [
- 'skip_existing' => true,
+ self::ARG_SKIP_EXISTING => true,
'groupOutput' => true,
]);
}
@@ -236,14 +219,14 @@ private function outputDependencyItems(string $source, string $type): void
$outputComand = [];
if ($componentsDependencies) {
- $componentsDependenciesAll = \array_map(static fn ($item) => Components::camelToKebabCase($item), $componentsDependencies);
+ $componentsDependenciesAll = \array_map(static fn ($item) => Helpers::camelToKebabCase($item), $componentsDependencies);
$componentsDependenciesAll = \implode(', ', \array_unique(\array_values($componentsDependenciesAll)));
$outputComand[] = "%Uwp boilerplate {$this->getCommandParentName()} {$componentsCommandName} --name='{$componentsDependenciesAll}'%n";
}
if ($innerBlocksDependency) {
- $innerBlocksDependencyAll = \array_map(static fn ($item) => Components::camelToKebabCase($item), $innerBlocksDependency);
+ $innerBlocksDependencyAll = \array_map(static fn ($item) => Helpers::camelToKebabCase($item), $innerBlocksDependency);
$innerBlocksDependencyAll = \implode(', ', \array_unique(\array_values($innerBlocksDependencyAll)));
$outputComand[] = "%Uwp boilerplate {$this->getCommandParentName()} {$blocksCommandName} --name='{$innerBlocksDependencyAll}'%n";
diff --git a/src/Blocks/BlocksCli.php b/src/Blocks/BlocksCli.php
index 860d0bd67..3167c2850 100644
--- a/src/Blocks/BlocksCli.php
+++ b/src/Blocks/BlocksCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class BlocksCli
@@ -68,6 +68,7 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,9 +77,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameTextDomainFrontendLibs($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('blocksDestination'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('blocksDestination'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Blocks/BlocksExample.php b/src/Blocks/BlocksExample.php
index 35f5bcaa9..6ce946d25 100644
--- a/src/Blocks/BlocksExample.php
+++ b/src/Blocks/BlocksExample.php
@@ -4,14 +4,14 @@
* Class Blocks is the base class for Gutenberg blocks registration.
* It provides the ability to register custom blocks using manifest.json.
*
- * @package EightshiftBoilerplate\Blocks
+ * @package %g_namespace%\Blocks
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Blocks;
+namespace %g_namespace%\Blocks;
-use EightshiftLibs\Blocks\AbstractBlocks;
+use %g_use_libs%\Blocks\AbstractBlocks;
/**
* Class Blocks
diff --git a/src/Blocks/UseAssetsCli.php b/src/Blocks/UseAssetsCli.php
index 5105f5aa4..248145d38 100644
--- a/src/Blocks/UseAssetsCli.php
+++ b/src/Blocks/UseAssetsCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -69,10 +69,12 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
- $this->getIntroText($assocArgs);
-
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
$this->moveItems(
\array_merge(
$assocArgs,
@@ -80,8 +82,8 @@ public function __invoke(array $args, array $assocArgs)
'name' => 'assets',
],
),
- Components::getProjectPaths('blocksAssetsSource'),
- Components::getProjectPaths('blocksAssetsDestination'),
+ Helpers::getProjectPaths('blocksAssetsSource'),
+ Helpers::getProjectPaths('blocksAssetsDestination'),
'assets folder',
true
);
diff --git a/src/Blocks/UseBlockCli.php b/src/Blocks/UseBlockCli.php
index bea3ebef3..c4bc32700 100644
--- a/src/Blocks/UseBlockCli.php
+++ b/src/Blocks/UseBlockCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class UseBlockCli
@@ -98,15 +98,17 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$this->moveItems(
$assocArgs,
- Components::getProjectPaths('blocksSourceCustom'),
- Components::getProjectPaths('blocksDestinationCustom'),
+ Helpers::getProjectPaths('blocksSourceCustom'),
+ Helpers::getProjectPaths('blocksDestinationCustom'),
'block',
false,
- Components::getProjectPaths('blocksPrivateSourceCustom')
+ Helpers::getProjectPaths('blocksPrivateSourceCustom')
);
}
}
diff --git a/src/Blocks/UseComponentCli.php b/src/Blocks/UseComponentCli.php
index dc669d94a..71323760e 100644
--- a/src/Blocks/UseComponentCli.php
+++ b/src/Blocks/UseComponentCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -99,17 +99,19 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$groupOutput = $assocArgs['groupOutput'] ?? false;
$this->moveItems(
$assocArgs,
- Components::getProjectPaths('blocksSourceComponents'),
- Components::getProjectPaths('blocksDestinationComponents'),
+ Helpers::getProjectPaths('blocksSourceComponents'),
+ Helpers::getProjectPaths('blocksDestinationComponents'),
'component',
false,
- Components::getProjectPaths('blocksPrivateSourceCustom')
+ Helpers::getProjectPaths('blocksPrivateSourceCustom')
);
if (!$groupOutput) {
diff --git a/src/Blocks/UseGlobalAssetsCli.php b/src/Blocks/UseGlobalAssetsCli.php
index 209f5cebd..e9d66c4c7 100644
--- a/src/Blocks/UseGlobalAssetsCli.php
+++ b/src/Blocks/UseGlobalAssetsCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -69,10 +69,12 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
- $this->getIntroText($assocArgs);
-
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
$this->moveItems(
\array_merge(
$assocArgs,
@@ -80,8 +82,8 @@ public function __invoke(array $args, array $assocArgs)
'name' => 'assets',
],
),
- Components::getProjectPaths('blocksGlobalAssetsSource'),
- Components::getProjectPaths('blocksGlobalAssetsDestination'),
+ Helpers::getProjectPaths('blocksGlobalAssetsSource'),
+ Helpers::getProjectPaths('blocksGlobalAssetsDestination'),
'assets folder',
true
);
diff --git a/src/Blocks/UseManifestCli.php b/src/Blocks/UseManifestCli.php
index dad611c5a..6d50b6c6d 100644
--- a/src/Blocks/UseManifestCli.php
+++ b/src/Blocks/UseManifestCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -68,10 +68,12 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
- $this->getIntroText($assocArgs);
-
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
$this->moveItems(
\array_merge(
$assocArgs,
@@ -79,8 +81,8 @@ public function __invoke(array $args, array $assocArgs)
'name' => 'manifest.json',
],
),
- Components::getProjectPaths('blocksSource'),
- Components::getProjectPaths('blocksDestination'),
+ Helpers::getProjectPaths('blocksSource'),
+ Helpers::getProjectPaths('blocksDestination'),
'file'
);
diff --git a/src/Blocks/UseVariationCli.php b/src/Blocks/UseVariationCli.php
index ce69b0329..42ce11dc4 100644
--- a/src/Blocks/UseVariationCli.php
+++ b/src/Blocks/UseVariationCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -89,17 +89,19 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
- $this->getIntroText($assocArgs);
-
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
$this->moveItems(
$assocArgs,
- Components::getProjectPaths('blocksSourceVariations'),
- Components::getProjectPaths('blocksDestinationVariations'),
+ Helpers::getProjectPaths('blocksSourceVariations'),
+ Helpers::getProjectPaths('blocksDestinationVariations'),
'variation',
false,
- Components::getProjectPaths('blocksPrivateSourceCustom')
+ Helpers::getProjectPaths('blocksPrivateSourceCustom')
);
if (!$groupOutput) {
diff --git a/src/Blocks/UseWrapperCli.php b/src/Blocks/UseWrapperCli.php
index 8af0593d4..c0d450d36 100644
--- a/src/Blocks/UseWrapperCli.php
+++ b/src/Blocks/UseWrapperCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Blocks;
use EightshiftLibs\Cli\ParentGroups\CliBlocks;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
/**
@@ -65,10 +65,12 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
- $this->getIntroText($assocArgs);
-
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
$this->moveItems(
\array_merge(
$assocArgs,
@@ -76,8 +78,8 @@ public function __invoke(array $args, array $assocArgs)
'name' => 'wrapper',
],
),
- Components::getProjectPaths('blocksSourceWrapper'),
- Components::getProjectPaths('blocksDestinationWrapper'),
+ Helpers::getProjectPaths('blocksSourceWrapper'),
+ Helpers::getProjectPaths('blocksDestinationWrapper'),
'wrapper',
true
);
diff --git a/src/Cache/AbstractManifestCache.php b/src/Cache/AbstractManifestCache.php
index b9070b0e6..d6c88f60a 100644
--- a/src/Cache/AbstractManifestCache.php
+++ b/src/Cache/AbstractManifestCache.php
@@ -150,7 +150,7 @@ public function getManifestCacheTopItem(string $key, string $cacheType = self::T
{
$output = [];
- if (\defined('WP_ENVIRONMENT_TYPE') && \WP_ENVIRONMENT_TYPE !== 'development') {
+ if ((\defined('WP_ENVIRONMENT_TYPE') && \WP_ENVIRONMENT_TYPE !== 'development') || !\defined('WP_CLI')) {
$output = $this->getCache($cacheType)[$key] ?? [];
}
@@ -158,7 +158,7 @@ public function getManifestCacheTopItem(string $key, string $cacheType = self::T
$output = $this->getAllManifests($cacheType)[$key] ?? [];
}
- if (!$output) {
+ if (!$output && !\defined('WP_CLI')) {
throw InvalidManifest::missingCacheTopItemException($key, $this->getFullPath($key, $cacheType));
}
diff --git a/src/Cache/ManifestCacheCli.php b/src/Cache/ManifestCacheCli.php
index 2ad3670d9..2d0fbb063 100644
--- a/src/Cache/ManifestCacheCli.php
+++ b/src/Cache/ManifestCacheCli.php
@@ -69,6 +69,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,8 +78,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
+ ->renameGlobals($assocArgs)
->outputWrite(Helpers::getProjectPaths('srcDestination', 'Cache'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Cache/ManifestCacheExample.php b/src/Cache/ManifestCacheExample.php
index 138b6983b..e40d2b97c 100644
--- a/src/Cache/ManifestCacheExample.php
+++ b/src/Cache/ManifestCacheExample.php
@@ -3,15 +3,15 @@
/**
* The file that defines a project config details like prefix, absolute path and etc.
*
- * @package EightshiftBoilerplate\Cache
+ * @package %g_namespace%\Cache
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Cache;
+namespace %g_namespace%\Cache;
-use EightshiftBoilerplate\Config\Config;
-use EightshiftLibs\Cache\AbstractManifestCache;
+use %g_namespace%\Config\Config;
+use %g_use_libs%\Cache\AbstractManifestCache;
/**
* The project config class.
diff --git a/src/Cli/AbstractCli.php b/src/Cli/AbstractCli.php
index a07272145..bb3221c5c 100644
--- a/src/Cli/AbstractCli.php
+++ b/src/Cli/AbstractCli.php
@@ -11,7 +11,7 @@
namespace EightshiftLibs\Cli;
use EightshiftLibs\Exception\InvalidPath;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use FilesystemIterator;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
@@ -62,21 +62,91 @@ abstract class AbstractCli implements CliInterface
*
* @var string
*/
- public const PROJECT_NAME_ARG = 'project_name';
+ public const ARG_PROJECT_NAME = 'g_project_name';
/**
- * Output theme name arg.
+ * Output project description arg.
*
* @var string
*/
- public const THEME_NAME_ARG = 'theme_name';
+ public const ARG_PROJECT_DESCRIPTION = 'g_project_description';
/**
- * Output plugin name arg.
+ * Output project author arg.
*
* @var string
*/
- public const PLUGIN_NAME_ARG = 'plugin_name';
+ public const ARG_PROJECT_AUTHOR = 'g_project_author';
+
+ /**
+ * Output project author url arg.
+ *
+ * @var string
+ */
+ public const ARG_PROJECT_AUTHOR_URL = 'g_project_author_url';
+
+ /**
+ * Output project version arg.
+ *
+ * @var string
+ */
+ public const ARG_PROJECT_VERSION = 'g_project_version';
+
+ /**
+ * Output textdomain arg.
+ *
+ * @var string
+ */
+ public const ARG_TEXTDOMAIN = 'g_textdomain';
+
+ /**
+ * Output composer_config_path arg.
+ *
+ * @var string
+ */
+ public const ARG_COMPOSER_CONFIG_PATH = 'g_composer_config_path';
+
+ /**
+ * Output skip existing arg.
+ *
+ * @var string
+ */
+ public const ARG_SKIP_EXISTING = 'g_skip_existing';
+
+ /**
+ * Output site_url arg.
+ *
+ * @var string
+ */
+ public const ARG_SITE_URL = 'g_site_url';
+
+ /**
+ * Output namespace arg.
+ *
+ * @var string
+ */
+ public const ARG_NAMESPACE = 'g_namespace';
+
+ /**
+ * Output namespace_vendor_prefix arg.
+ *
+ * @var string
+ */
+ public const ARG_NAMESPACE_VENDOR_PREFIX = 'g_namespace_vendor_prefix';
+
+ /**
+ * Output is setup arg.
+ *
+ * @var string
+ */
+ public const ARG_IS_SETUP = 'g_is_setup';
+
+ /**
+ * Output use libs arg.
+ *
+ * @var string
+ */
+ public const ARG_USE_LIBS = 'g_use_libs';
/**
* Construct Method.
@@ -109,25 +179,13 @@ public function getGlobalSynopsis(): array
'synopsis' => [
[
'type' => 'assoc',
- 'name' => 'namespace',
- 'description' => 'Define your project namespace. Default is read from composer autoload psr-4 key.',
+ 'name' => self::ARG_COMPOSER_CONFIG_PATH,
+ 'description' => 'Define your project composer.json absolute path.',
'optional' => true,
],
[
'type' => 'assoc',
- 'name' => 'vendor_prefix',
- 'description' => 'Define your project vendor_prefix. Default is read from composer extra, imposter, namespace key.',
- 'optional' => true,
- ],
- [
- 'type' => 'assoc',
- 'name' => 'config_path',
- 'description' => 'Define your project composer absolute path.',
- 'optional' => true,
- ],
- [
- 'type' => 'assoc',
- 'name' => 'skip_existing',
+ 'name' => self::ARG_SKIP_EXISTING,
'description' => 'If this value is set to true CLI commands will not fail it they find an existing files in your project',
'optional' => true,
'options' => [
@@ -139,6 +197,56 @@ public function getGlobalSynopsis(): array
];
}
+ /**
+ * Prepare arguments for all the commands.
+ *
+ * @param array $args Arguments array.
+ *
+ * @return array
+ */
+ public function prepareArgs(array $args = []): array
+ {
+ $configPath = $args[self::ARG_COMPOSER_CONFIG_PATH] ?? Helpers::getProjectPaths('root', 'composer.json');
+ $composerFile = $this->getComposer($configPath);
+
+ $namespace = $composerFile ? \rtrim(\array_key_first($composerFile['autoload']['psr-4']), '\\') : 'EightshiftBoilerplate';
+
+ return \array_merge(
+ [
+ self::ARG_NAMESPACE => $namespace,
+ self::ARG_NAMESPACE_VENDOR_PREFIX => $composerFile ? $composerFile['extra']['strauss']['namespace_prefix'] : "{$namespace}Vendor",
+ self::ARG_TEXTDOMAIN => Helpers::camelToKebabCase($namespace),
+ ],
+ $args
+ );
+ }
+
+ /**
+ * Prepare arguments for setup commands.
+ *
+ * @param array $args Arguments array.
+ *
+ * @return array
+ */
+ public function prepareSetupArgs(array $args = []): array
+ {
+ $namespace = $this->convertToNamespace($args[self::ARG_PROJECT_NAME]);
+
+ return [
+ self::ARG_NAMESPACE => $namespace,
+ self::ARG_NAMESPACE_VENDOR_PREFIX => "{$namespace}Vendor",
+ self::ARG_TEXTDOMAIN => Helpers::camelToKebabCase($namespace),
+ self::ARG_PROJECT_NAME => $args[self::ARG_PROJECT_NAME] ?? 'Eightshift Boilerplate',
+ self::ARG_PROJECT_DESCRIPTION => $args[self::ARG_PROJECT_DESCRIPTION] ?? 'Eightshift Boilerplate is a WordPress starter theme that helps you build better and faster using the modern development tools.',
+ self::ARG_PROJECT_AUTHOR => $args[self::ARG_PROJECT_AUTHOR] ?? 'Team Eightshift',
+ self::ARG_PROJECT_AUTHOR_URL => $args[self::ARG_PROJECT_AUTHOR_URL] ?? 'https://eightshift.com/',
+ self::ARG_PROJECT_VERSION => $args[self::ARG_PROJECT_VERSION] ?? '1.0.0',
+ self::ARG_SITE_URL => $args[self::ARG_SITE_URL] ?? \site_url(),
+ self::ARG_IS_SETUP => 'true',
+ self::ARG_SKIP_EXISTING => 'true',
+ ];
+ }
+
/**
* Method that creates actual WPCLI command in terminal
*
@@ -355,14 +463,21 @@ public function outputWrite(string $destination, string $fileName, array $args =
$skipExisting = $this->getSkipExisting($args);
// Set output file path.
- $destinationFile = Components::joinPaths([$destination, $fileName]);
+ $destinationFile = Helpers::joinPaths([$destination, $fileName]);
// Bailout if file already exists.
if (\file_exists($destinationFile) && $skipExisting === false) {
$path = $this->getShortenCliPathOutput($destinationFile);
self::cliError(
- "{$typeOutput} '{$fileName}' is already present at\n'{$path}'\n\nIf you want to override the destination folder, use %c--skip_existing='true'%n"
+ \sprintf(
+ // translators: %s will be replaced with type of item, and shorten cli path.
+ "%1\$s '%2\$s' is already present at\n'%3\$s'\n\nIf you want to override the destination folder, use --%4\$s='true'",
+ $typeOutput,
+ $fileName,
+ $path,
+ AbstractCli::ARG_SKIP_EXISTING
+ )
);
}
@@ -423,38 +538,6 @@ public function getOutputFile(string $file): string
return "{$ds}{$file}.php";
}
- /**
- * Replace namespace EightshiftBoilerplateVendor\ in class
- *
- * @param array $args CLI args array.
- *
- * @return AbstractCli Current CLI class.
- */
- public function renameNamespace(array $args = []): self
- {
- $output = $this->fileContents;
- $namespace = $this->getNamespace($args);
- $vendorPrefix = $this->getVendorPrefix($args);
-
- if (\getenv('ES_TEST')) {
- $output = \str_replace(
- 'namespace EightshiftBoilerplate\\',
- "namespace {$namespace}\\",
- $output
- );
- } else {
- $output = \str_replace(
- "namespace {$vendorPrefix}\EightshiftBoilerplate\\",
- "namespace {$namespace}\\",
- $output
- );
- }
-
- $this->fileContents = $output;
-
- return $this;
- }
-
/**
* Replace use in class
*
@@ -464,181 +547,89 @@ public function renameNamespace(array $args = []): self
*/
public function renameUse(array $args = []): self
{
- $output = $this->fileContents;
-
- $vendorPrefix = $this->getVendorPrefix($args);
- $namespace = $this->getNamespace($args);
-
- $prefixUse = 'use';
- $prefixPackage = '@package';
-
- if (\getenv('ES_TEST')) {
- $output = \str_replace(
- "{$prefixUse} EightshiftBoilerplate\\",
- "{$prefixUse} {$namespace}\\",
- $output
- );
- } else {
- $output = \str_replace(
- "{$prefixUse} EightshiftBoilerplateVendor\\",
- "{$prefixUse} {$vendorPrefix}\\",
- $output
- );
-
- $output = \str_replace(
- "{$prefixUse} {$vendorPrefix}\EightshiftBoilerplate\\",
- "{$prefixUse} {$namespace}\\",
- $output
- );
- }
-
- $output = \str_replace(
- "{$prefixPackage} EightshiftBoilerplate",
- "{$prefixPackage} {$namespace}",
- $output
- );
-
- $this->fileContents = $output;
-
- return $this;
- }
-
- /**
- * Replace use in frontend libs views.
- *
- * @param array $args CLI args array.
- *
- * @return AbstractCli Current CLI class.
- */
- public function renameUseFrontendLibs(array $args = []): self
- {
- $output = $this->fileContents;
-
- $vendorPrefix = $this->getVendorPrefix($args);
- $namespace = $this->getNamespace($args);
-
- $prefixUse = 'use';
- $prefixPackage = '@package';
-
- $output = \str_replace(
- "{$prefixUse} EightshiftBoilerplateVendor\\",
- "{$prefixUse} {$vendorPrefix}\\",
- $output
- );
-
- $output = \str_replace(
- "{$prefixUse} EightshiftBoilerplate\\",
- "{$prefixUse} {$namespace}\\",
- $output
- );
-
- $output = \str_replace(
- "{$prefixPackage} EightshiftBoilerplate",
- "{$prefixPackage} {$namespace}",
- $output
+ $this->fileContents = \str_replace(
+ $this->getArgTemplate(self::ARG_USE_LIBS),
+ !\getenv('ES_TEST') ? $args[self::ARG_NAMESPACE_VENDOR_PREFIX] . "\EightshiftLibs" : 'EightshiftLibs',
+ $this->fileContents
);
- $this->fileContents = $output;
-
return $this;
}
/**
- * Replace text domain in class
+ * Replace generic key in class.
*
+ * @param string $keyName Key name to replace.
* @param array $args CLI args array.
*
* @return AbstractCli Current CLI class.
*/
- public function renameTextDomain(array $args = []): self
+ public function renameGeneric(string $keyName, array $args): self
{
- $namespace = Components::camelToKebabCase($this->getNamespace($args));
-
- $this->fileContents = \str_replace(
- 'eightshift-libs',
- $namespace,
- $this->fileContents
- );
+ if (isset($args[$keyName])) {
+ $this->fileContents = \str_replace(
+ $this->getArgTemplate($keyName),
+ $args[$keyName],
+ $this->fileContents
+ );
+ }
return $this;
}
/**
- * Replace text domain in class for frontend libs
+ * Replace all generic keys in class.
*
* @param array $args CLI args array.
*
* @return AbstractCli Current CLI class.
*/
- public function renameTextDomainFrontendLibs(array $args = []): self
+ public function renameGlobals(array $args = []): self
{
- $namespace = Components::camelToKebabCase($this->getNamespace($args));
-
- $this->fileContents = \str_replace(
- 'eightshift-frontend-libs',
- $namespace,
- $this->fileContents
- );
+ $this->renameGeneric(self::ARG_NAMESPACE, $args)
+ ->renameGeneric(self::ARG_TEXTDOMAIN, $args)
+ ->renameUse($args)
+ ->renameGeneric(self::ARG_PROJECT_NAME, $args)
+ ->renameGeneric(self::ARG_PROJECT_DESCRIPTION, $args)
+ ->renameGeneric(self::ARG_PROJECT_AUTHOR, $args)
+ ->renameGeneric(self::ARG_PROJECT_AUTHOR_URL, $args)
+ ->renameGeneric(self::ARG_PROJECT_VERSION, $args)
+ ->renameGeneric(self::ARG_SITE_URL, $args)
+ ->renameGeneric(self::ARG_NAMESPACE_VENDOR_PREFIX, $args);
return $this;
}
/**
- * Replace project file name
+ * Clean up initial boilerplate files.
*
- * @param array $args CLI args array.
- *
- * @return AbstractCli Current CLI class.
+ * @return void
*/
- public function renameProjectName(array $args = []): self
+ public function cleanUpInitialBoilerplate(): void
{
- $projectName = 'eightshift-boilerplate';
-
- // Don't use this option on the tests.
- if (!\getenv('ES_TEST')) {
- $projectName = \basename(Components::getProjectPaths('root'));
- }
-
- if (isset($args['project_name'])) {
- $projectName = $args['project_name'];
- }
-
- $this->fileContents = \str_replace(
- 'eightshift-boilerplate',
- $projectName,
- $this->fileContents
- );
-
- return $this;
+ $this->cliLog('Removing initial boilerplate setup files', 'C');
+ WP_CLI::runcommand("eval 'shell_exec(\"rm -rf .github\");'");
+ WP_CLI::runcommand("eval 'shell_exec(\"rm CODE_OF_CONDUCT.md\");'");
+ WP_CLI::runcommand("eval 'shell_exec(\"rm CHANGELOG.md\");'");
+ WP_CLI::runcommand("eval 'shell_exec(\"rm LICENSE.md\");'");
}
/**
- * Replace project file type
+ * Run commands after initial setup.
*
- * @param array $args CLI args array.
- *
- * @return AbstractCli Current CLI class.
+ * @return void
*/
- public function renameProjectType(array $args = []): self
+ public function initMandatoryAfter(): void
{
- $projectType = 'themes';
-
- // Don't use this option on the tests.
- if (!\getenv('ES_TEST')) {
- $projectType = \basename(Components::getProjectPaths('wpContent'));
- }
-
- if (isset($args['project_type'])) {
- $projectType = $args['project_type'];
- }
-
- $this->fileContents = \str_replace(
- 'themes',
- $projectType,
- $this->fileContents
- );
-
- return $this;
+ $this->cliLog('Removing old compeser.lock', 'C');
+ WP_CLI::runcommand("eval 'shell_exec(\"rm composer.lock\");'");
+ $this->cliLog('--------------------------------------------------', 'C');
+ $this->cliLog('Running composer install', 'C');
+ WP_CLI::runcommand("eval 'shell_exec(\"composer install\");'");
+ $this->cliLog('--------------------------------------------------', 'C');
+ $this->cliLog('Running npm install', 'C');
+ WP_CLI::runcommand("eval 'shell_exec(\"npm install\");'");
+ $this->cliLog('--------------------------------------------------', 'C');
}
/**
@@ -709,75 +700,21 @@ public function searchReplaceString(string $oldString, string $newString): self
/**
* Get composer from project or lib
*
- * @param array $args CLI args array.
+ * @param string $path Path to composer file.
*
* @return array
*/
- public function getComposer(array $args = []): array
+ public function getComposer(string $path): array
{
- if (!isset($args['config_path'])) {
- $composerPath = Components::getProjectPaths('root', 'composer.json');
- } else {
- $composerPath = $args['config_path'];
- }
+ $composerFile = \file_get_contents($path);
- $composerFile = \file_get_contents($composerPath);
-
- if ($composerFile === false) {
- self::cliError("Composer was not found at\n{$composerPath}");
+ if (!$composerFile) {
+ self::cliError("Composer was not found at\n{$path}");
}
return \json_decode((string)$composerFile, true);
}
- /**
- * Get composers defined namespace
- *
- * @param array $args CLI args array.
- *
- * @return string
- */
- public function getNamespace(array $args = []): string
- {
- $namespace = '';
-
- if (isset($args['namespace'])) {
- $namespace = $args['namespace'];
- }
-
- if (empty($namespace)) {
- $composer = $this->getComposer($args);
-
- $namespace = \rtrim(\array_key_first($composer['autoload']['psr-4']), '\\');
- }
-
- return $namespace;
- }
-
- /**
- * Get composers defined vendor prefix
- *
- * @param array $args CLI args array.
- *
- * @return string
- */
- public function getVendorPrefix(array $args = []): string
- {
- $vendorPrefix = '';
-
- if (isset($args['vendor_prefix'])) {
- $vendorPrefix = $args['vendor_prefix'];
- }
-
- if (empty($vendorPrefix)) {
- $composer = $this->getComposer($args);
-
- $vendorPrefix = $composer['extra']['strauss']['namespace_prefix'] ?? 'EightshiftLibs';
- }
-
- return $vendorPrefix;
- }
-
/**
* Convert user input string to slug safe format
*
@@ -798,47 +735,35 @@ public function prepareSlug(string $stringToConvert): string
}
/**
- * Loop array of classes and output the commands
+ * Get full dir files.
*
- * @param class-string[] $items Array of classes.
- * @param array $args CLI command args.
+ * @param string $path Path to scan.
+ * @param string $sufix Sufix to add to path.
*
- * @return void
- * @throws ReflectionException Reflection exception.
+ * @return string[]
*/
- public function getEvalLoop(array $items = [], array $args = []): void
+ public function getFullDirFiles(string $path, string $sufix = ''): array
{
- foreach ($items as $item) {
- $reflectionClass = new ReflectionClass($item);
-
- $class = $reflectionClass->newInstanceArgs(['null']);
+ $scanDir = Helpers::joinPaths([$path, $sufix]);
- if (\method_exists($class, 'getCommandName') && \method_exists($class, 'getCommandParentName')) {
- WP_CLI::runcommand("{$this->commandParentName} {$class->getCommandParentName()} {$class->getCommandName()} {$this->prepareArgsManual($args)}");
- }
+ if (!\is_dir($scanDir)) {
+ return [$path];
}
- }
- /**
- * Full blocks files list used for renaming
- *
- * @param string $name Block name.
- *
- * @return string[]
- */
- public function getFullBlocksFiles(string $name): array
- {
- $ds = \DIRECTORY_SEPARATOR;
- return [
- "{$name}.php",
- "{$name}-block.js",
- "{$name}-hooks.js",
- "{$name}-transforms.js",
- "{$name}.js",
- "components{$ds}{$name}-editor.js",
- "components{$ds}{$name}-toolbar.js",
- "components{$ds}{$name}-options.js",
- ];
+ $dir = \array_diff(\scandir($scanDir), ['..', '.']);
+
+ return \array_filter(\array_map(
+ static function ($item) use ($path, $sufix) {
+ if (!\is_dir(Helpers::joinPaths([$path, $sufix, $item]))) {
+ if ($sufix) {
+ return "{$sufix}/{$item}";
+ } else {
+ return $item;
+ }
+ }
+ },
+ $dir
+ ));
}
/**
@@ -850,7 +775,7 @@ public function getFullBlocksFiles(string $name): array
*/
public function getSkipExisting(array $args): bool
{
- return isset($args['skip_existing']) && $args['skip_existing'];
+ return isset($args[self::ARG_SKIP_EXISTING]) && $args[self::ARG_SKIP_EXISTING];
}
/**
@@ -1028,4 +953,35 @@ public function getManifestDirect(string $path): array
return \json_decode(\implode(' ', (array)\file($manifest)), true);
}
+
+ /**
+ * Convert string to valid namespace.
+ *
+ * @param string $name Name to convert.
+ *
+ * @return string
+ */
+ public function convertToNamespace(string $name): string
+ {
+ // Replace all non-alphanumeric characters with underscores.
+ $namespace = \preg_replace('/[^a-zA-Z0-9_]/', '_', $name);
+
+ // Replace multiple underscores with a single underscore.
+ $namespace = \preg_replace('/_+/', '_', $namespace);
+
+ // Trim underscores from the start and end of the namespace.
+ $namespace = \trim($namespace, '_');
+
+ // Ensure the namespace does not start with a digit.
+ if (\ctype_digit($namespace[0])) {
+ $namespace = 'N' . $namespace;
+ }
+
+ // Convert to PascalCase as an optional style.
+ $namespace = \str_replace('_', ' ', $namespace);
+ $namespace = \ucwords($namespace);
+ $namespace = \str_replace(' ', '', $namespace);
+
+ return $namespace;
+ }
}
diff --git a/src/Cli/Cli.php b/src/Cli/Cli.php
index 40bf99ef1..1d4c54a15 100644
--- a/src/Cli/Cli.php
+++ b/src/Cli/Cli.php
@@ -34,7 +34,6 @@
use EightshiftLibs\Config\ConfigThemeCli;
use EightshiftLibs\Config\ConfigPluginCli;
use EightshiftLibs\ConfigProject\ConfigProjectCli;
-use EightshiftLibs\Setup\PluginManageCli;
use EightshiftLibs\View\EscapedViewCli;
use EightshiftLibs\CustomMeta\AcfMetaCli;
use EightshiftLibs\Setup\SetupCli;
@@ -62,6 +61,7 @@
use EightshiftLibs\Init\InitPluginCli;
use EightshiftLibs\Init\InitProjectCli;
use EightshiftLibs\Init\InitThemeCli;
+use EightshiftLibs\Init\InitThemeSetupCli;
use EightshiftLibs\Media\RegenerateWebPMediaCli;
use EightshiftLibs\Media\UseWebPMediaCli;
use EightshiftLibs\Misc\VersionCli;
@@ -103,8 +103,8 @@ class Cli
ReusableBlocksHeaderFooterCli::class,
AnalyticsGdprCli::class,
WebPMediaColumnCli::class,
- ConfigThemeCli::class,
ConfigPluginCli::class,
+ ConfigThemeCli::class,
ConfigProjectCli::class,
AcfMetaCli::class,
PostTypeCli::class,
@@ -143,7 +143,6 @@ class Cli
RegenerateWebPMediaCli::class,
UseWebPMediaCli::class,
VersionCli::class,
- PluginManageCli::class,
];
/**
@@ -175,6 +174,7 @@ class Cli
InitPluginCli::class,
InitProjectCli::class,
InitThemeCli::class,
+ InitThemeSetupCli::class,
];
/**
@@ -188,7 +188,7 @@ public function getCommandsClasses(): array
...static::CREATE_COMMANDS,
...static::BLOCKS_COMMANDS,
...static::INIT_COMMANDS,
- ...static::RUN_COMMANDS
+ ...static::RUN_COMMANDS,
];
}
diff --git a/src/Cli/CliHelpers.php b/src/Cli/CliHelpers.php
index b037edcdf..6ff874b49 100644
--- a/src/Cli/CliHelpers.php
+++ b/src/Cli/CliHelpers.php
@@ -10,7 +10,7 @@
namespace EightshiftLibs\Cli;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI;
use WP_CLI\ExitException;
@@ -145,7 +145,7 @@ protected static function cliLogAlert(string $msg, string $type = 'success', str
*/
protected function getShortenCliPathOutput(string $path, string $ref = 'projectRoot'): string
{
- return \str_replace(Components::getProjectPaths($ref), '', $path);
+ return \str_replace(Helpers::getProjectPaths($ref), '', $path);
}
/**
diff --git a/src/Columns/Media/WebPMediaColumnCli.php b/src/Columns/Media/WebPMediaColumnCli.php
index 28e63715d..bcd1a1888 100644
--- a/src/Columns/Media/WebPMediaColumnCli.php
+++ b/src/Columns/Media/WebPMediaColumnCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class WebPMediaColumnCli.
@@ -69,6 +69,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,9 +78,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'Columns' . \DIRECTORY_SEPARATOR . 'Media'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'Columns' . \DIRECTORY_SEPARATOR . 'Media'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Columns/Media/WebPMediaColumnExample.php b/src/Columns/Media/WebPMediaColumnExample.php
index 86873cdc1..1f91f85ca 100644
--- a/src/Columns/Media/WebPMediaColumnExample.php
+++ b/src/Columns/Media/WebPMediaColumnExample.php
@@ -3,15 +3,15 @@
/**
* File that holds class for WebP Media Column registration.
*
- * @package EightshiftBoilerplate\CustomMeta
+ * @package %g_namespace%\CustomMeta
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Columns\Media;
+namespace %g_namespace%\Columns\Media;
-use EightshiftLibs\Columns\Media\AbstractMediaColumns;
-use EightshiftLibs\Helpers\Components;
+use %g_use_libs%\Columns\Media\AbstractMediaColumns;
+use %g_use_libs%\Helpers\Helpers;
/**
* Class WebP Media Column.
@@ -34,7 +34,7 @@ class WebPMediaColumnExample extends AbstractMediaColumns
*/
public function addColumnName(array $columns): array
{
- $columns[self::COLUMN_KEY] = \esc_html__('WebP', 'eightshift-libs');
+ $columns[self::COLUMN_KEY] = \esc_html__('WebP', '%g_textdomain%');
return $columns;
}
@@ -49,7 +49,7 @@ public function addColumnName(array $columns): array
public function renderColumnContent(string $columnName, int $postId): string
{
if ($columnName === self::COLUMN_KEY) {
- $icon = Components::existsWebPMedia($postId) ? 'yes' : 'no';
+ $icon = Helpers::existsWebPMedia($postId) ? 'yes' : 'no';
echo ''; // phpcs:ignore
}
@@ -65,7 +65,7 @@ public function renderColumnContent(string $columnName, int $postId): string
*/
public function sortAddedColumns(array $columns): array
{
- $columns[self::COLUMN_KEY] = \esc_html__('WebP', 'eightshift-libs');
+ $columns[self::COLUMN_KEY] = \esc_html__('WebP', '%g_textdomain%');
return $columns;
}
diff --git a/src/Config/ConfigPluginCli.php b/src/Config/ConfigPluginCli.php
index 9f9cd7b64..53b9032ce 100644
--- a/src/Config/ConfigPluginCli.php
+++ b/src/Config/ConfigPluginCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class ConfigPluginCli
@@ -79,6 +79,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -87,10 +89,9 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $className)
->renameClassNameWithPrefix($className, $newName)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs);
+ ->renameGlobals($assocArgs);
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'Config'), "{$newName}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'Config'), "{$newName}.php", $assocArgs);
}
}
diff --git a/src/Config/ConfigPluginExample.php b/src/Config/ConfigPluginExample.php
index 60fbfe208..602e17b73 100644
--- a/src/Config/ConfigPluginExample.php
+++ b/src/Config/ConfigPluginExample.php
@@ -6,14 +6,14 @@
* A class definition that includes attributes and functions used across both the
* public side of the site and the admin area.
*
- * @package EightshiftBoilerplate\Config
+ * @package %g_namespace%\Config
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Config;
+namespace %g_namespace%\Config;
-use EightshiftLibs\Helpers\Helpers;
+use %g_use_libs%\Helpers\Helpers;
/**
* The project config class.
diff --git a/src/Config/ConfigThemeCli.php b/src/Config/ConfigThemeCli.php
index e286656f9..09251540f 100644
--- a/src/Config/ConfigThemeCli.php
+++ b/src/Config/ConfigThemeCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class ConfigThemeCli
@@ -79,6 +79,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -87,10 +89,9 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $className)
->renameClassNameWithPrefix($className, $newName)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs);
+ ->renameGlobals($assocArgs);
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'Config'), "{$newName}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'Config'), "{$newName}.php", $assocArgs);
}
}
diff --git a/src/Config/ConfigThemeExample.php b/src/Config/ConfigThemeExample.php
index 2ac9a8611..f5378b189 100644
--- a/src/Config/ConfigThemeExample.php
+++ b/src/Config/ConfigThemeExample.php
@@ -6,14 +6,14 @@
* A class definition that includes attributes and functions used across both the
* public side of the site and the admin area.
*
- * @package EightshiftBoilerplate\Config
+ * @package %g_namespace%\Config
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Config;
+namespace %g_namespace%\Config;
-use EightshiftLibs\Helpers\Helpers;
+use %g_use_libs%\Helpers\Helpers;
/**
* The project config class.
diff --git a/src/ConfigProject/ConfigProjectCli.php b/src/ConfigProject/ConfigProjectCli.php
index c17cc05f7..4a4d842af 100644
--- a/src/ConfigProject/ConfigProjectCli.php
+++ b/src/ConfigProject/ConfigProjectCli.php
@@ -12,7 +12,8 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
+use WP_CLI;
/**
* Class ConfigProjectCli
@@ -47,7 +48,7 @@ public function getCommandName(): string
public function getDefaultArgs(): array
{
return [
- 'path' => Components::getProjectPaths('projectRoot'),
+ 'path' => Helpers::getProjectPaths('projectRoot'),
];
}
@@ -90,6 +91,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
// Get Props.
@@ -97,28 +100,16 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $this->getClassShortName())
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs);
+ ->renameGlobals($assocArgs);
// Output final class to new file/folder and finish.
$class->outputWrite($path, 'wp-config-project.php', $assocArgs);
- $this->cliLog('', 'B');
- $this->cliLog('Please do the following steps manually to complete the `wp-config-project.php` setup:', 'B');
- $this->cliLog("1. Open `wp-config.php` file located in the root of your project.", 'B');
- $this->cliLog("2. Make sure to define `WP_ENVIRONMENT_TYPE` constant to 'development' like so: `.", 'B');
- $this->cliLog("3. Make sure to require `wp-config-project.php` (at the end of the file) but before the `wp-settings.php`. Like this:`);", 'B');
- $this->cliLog("
- /** Absolute path to the WordPress directory. */
- if ( !\defined('ABSPATH') ) {
- define('ABSPATH', \dirname(__FILE__) . '/');
+ if (!\defined('WP_DEBUG')) {
+ WP_CLI::runcommand('config delete WP_DEBUG');
}
- // Include wp config for your project.
- require_once(ABSPATH . 'wp-config-project.php');
-
- /** Sets up WordPress vars and included files. */
- require_once(ABSPATH . 'wp-settings.php');
- ", 'B');
+ WP_CLI::runcommand('config set WP_ENVIRONMENT_TYPE development');
+ WP_CLI::runcommand("config set \"configProject\" \"require_once(ABSPATH . 'wp-config-project.php')\" --raw --type='variable'");
}
}
diff --git a/src/ConfigProject/ConfigProjectExample.php b/src/ConfigProject/ConfigProjectExample.php
index 5f3bdb5cd..339d33212 100644
--- a/src/ConfigProject/ConfigProjectExample.php
+++ b/src/ConfigProject/ConfigProjectExample.php
@@ -6,7 +6,7 @@
* Define global environment variable, and define certain
* settings based on it.
*
- * @package EightshiftBoilerplate
+ * @package %g_namespace%
*/
// phpcs:disable
diff --git a/src/CustomMeta/AcfMetaCli.php b/src/CustomMeta/AcfMetaCli.php
index 9c5d658da..57db3e708 100644
--- a/src/CustomMeta/AcfMetaCli.php
+++ b/src/CustomMeta/AcfMetaCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class AcfMetaCli
@@ -93,6 +93,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
// Get Props.
@@ -105,8 +107,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'CustomMeta'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'CustomMeta'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/CustomMeta/AcfMetaExample.php b/src/CustomMeta/AcfMetaExample.php
index 63727b098..a547bda6b 100644
--- a/src/CustomMeta/AcfMetaExample.php
+++ b/src/CustomMeta/AcfMetaExample.php
@@ -3,14 +3,14 @@
/**
* File that holds class for AcfMetaExample custom meta registration.
*
- * @package EightshiftBoilerplate\CustomMeta
+ * @package %g_namespace%\CustomMeta
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\CustomMeta;
+namespace %g_namespace%\CustomMeta;
-use EightshiftLibs\CustomMeta\AbstractAcfMeta;
+use %g_use_libs%\CustomMeta\AbstractAcfMeta;
/**
* Class AcfMetaExample.
diff --git a/src/CustomPostType/PostTypeCli.php b/src/CustomPostType/PostTypeCli.php
index 42ff68d45..6d217a854 100644
--- a/src/CustomPostType/PostTypeCli.php
+++ b/src/CustomPostType/PostTypeCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class PostTypeCli
@@ -142,6 +142,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
// Get Props.
@@ -161,9 +163,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('slug'), $slug)
->searchReplaceString($this->getArgTemplate('rewrite_url'), $rewriteUrl)
->searchReplaceString($this->getArgTemplate('rest_endpoint_slug'), $restEndpointSlug)
@@ -183,6 +183,6 @@ public function __invoke(array $args, array $assocArgs)
}
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'CustomPostType'), "{$className}.php", $assocArgs);
+ $class->outputWrite(Helpers::getProjectPaths('srcDestination', 'CustomPostType'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/CustomPostType/PostTypeExample.php b/src/CustomPostType/PostTypeExample.php
index 6b8243b75..3e5578660 100644
--- a/src/CustomPostType/PostTypeExample.php
+++ b/src/CustomPostType/PostTypeExample.php
@@ -3,14 +3,14 @@
/**
* File that holds class for PostTypeExample custom post type registration.
*
- * @package EightshiftBoilerplate\CustomPostType
+ * @package %g_namespace%\CustomPostType
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\CustomPostType;
+namespace %g_namespace%\CustomPostType;
-use EightshiftLibs\CustomPostType\AbstractPostType;
+use %g_use_libs%\CustomPostType\AbstractPostType;
/**
* Class PostTypeExample.
@@ -82,12 +82,12 @@ protected function getPostTypeArguments(): array
'name' => esc_html_x(
'%label%',
'post type plural name',
- 'eightshift-libs'
+ '%g_textdomain%'
),
'singular_name' => esc_html_x(
'%plural_label%',
'post type singular name',
- 'eightshift-libs'
+ '%g_textdomain%'
),
],
// phpcs:enable
diff --git a/src/CustomTaxonomy/TaxonomyCli.php b/src/CustomTaxonomy/TaxonomyCli.php
index c4224bfb6..6a0a372c8 100644
--- a/src/CustomTaxonomy/TaxonomyCli.php
+++ b/src/CustomTaxonomy/TaxonomyCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class TaxonomyCli
@@ -117,6 +117,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
// Get Props.
@@ -133,14 +135,12 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $this->getClassShortName())
->renameClassNameWithPrefix($this->getClassShortName(), $className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('slug'), $slug)
->searchReplaceString($this->getArgTemplate('rest_endpoint_slug'), $restEndpointSlug)
->searchReplaceString($this->getArgTemplate('post_type_slug'), $postTypeSlug)
->searchReplaceString($this->getArgTemplate('label'), $label)
->searchReplaceString($this->getArgTemplate('plural_label'), $pluralLabel)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'CustomTaxonomy'), "{$className}.php", $assocArgs);
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'CustomTaxonomy'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/CustomTaxonomy/TaxonomyExample.php b/src/CustomTaxonomy/TaxonomyExample.php
index 754b4edd6..5d997f1a3 100644
--- a/src/CustomTaxonomy/TaxonomyExample.php
+++ b/src/CustomTaxonomy/TaxonomyExample.php
@@ -3,14 +3,14 @@
/**
* The Blog_Taxonomy specific functionality.
*
- * @package EightshiftBoilerplate\CustomTaxonomy
+ * @package %g_namespace%\CustomTaxonomy
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\CustomTaxonomy;
+namespace %g_namespace%\CustomTaxonomy;
-use EightshiftLibs\CustomTaxonomy\AbstractTaxonomy;
+use %g_use_libs%\CustomTaxonomy\AbstractTaxonomy;
/**
* Class TaxonomyExample
@@ -71,12 +71,12 @@ protected function getTaxonomyArguments(): array
'name' => esc_html_x(
'%label%',
'taxonomy plural name',
- 'eightshift-libs'
+ '%g_textdomain%'
),
'singular_name' => esc_html_x(
'%plural_label%',
'taxonomy singular name',
- 'eightshift-libs'
+ '%g_textdomain%'
),
],
// phpcs:enable
diff --git a/src/Db/ExportCli.php b/src/Db/ExportCli.php
index c2025ed2b..fee6c4665 100644
--- a/src/Db/ExportCli.php
+++ b/src/Db/ExportCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliRun;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI\ExitException;
/**
@@ -107,13 +107,15 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
- require Components::getProjectPaths('libs', 'src/Db/DbExport.php');
+ require Helpers::getProjectPaths('libs', 'src/Db/DbExport.php');
try {
dbExport( // phpcs:ignore
- Components::getProjectPaths('projectRoot'),
+ Helpers::getProjectPaths('projectRoot'),
[
'skip_db' => $this->getArg($assocArgs, 'skip_db'),
'skip_uploads' => $this->getArg($assocArgs, 'skip_uploads'),
diff --git a/src/Db/ImportCli.php b/src/Db/ImportCli.php
index 56b6a654e..3c6354d8b 100644
--- a/src/Db/ImportCli.php
+++ b/src/Db/ImportCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliRun;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use WP_CLI\ExitException;
/**
@@ -50,7 +50,7 @@ public function getDefaultArgs(): array
return [
'from' => '',
'to' => '',
- 'setup_file' => Components::getProjectPaths('projectRoot', 'setup.json'),
+ 'setup_file' => Helpers::getProjectPaths('projectRoot', 'setup.json'),
];
}
@@ -108,9 +108,11 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
- require Components::getProjectPaths('libs', 'src/Db/DbImport.php');
+ require Helpers::getProjectPaths('libs', 'src/Db/DbImport.php');
try {
dbImport( // phpcs:ignore
diff --git a/src/Enqueue/AbstractAssets.php b/src/Enqueue/AbstractAssets.php
index 1eea25104..b532d7791 100644
--- a/src/Enqueue/AbstractAssets.php
+++ b/src/Enqueue/AbstractAssets.php
@@ -190,7 +190,7 @@ public function setAssetsItem(string $key): string
{
$data = $this->manifestCache->getManifestCacheTopItem(AbstractManifestCache::ASSETS_KEY, AbstractManifestCache::TYPE_ASSETS);
- if (!isset($data[$key])) {
+ if (!isset($data[$key]) && !\defined('WP_CLI')) {
throw InvalidManifest::missingManifestKeyException($key, 'public');
}
diff --git a/src/Enqueue/Admin/EnqueueAdminCli.php b/src/Enqueue/Admin/EnqueueAdminCli.php
index 8028ab5d9..bf19bfc3d 100644
--- a/src/Enqueue/Admin/EnqueueAdminCli.php
+++ b/src/Enqueue/Admin/EnqueueAdminCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class EnqueueAdminCli
@@ -69,6 +69,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,8 +78,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Admin'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Admin'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Enqueue/Admin/EnqueueAdminExample.php b/src/Enqueue/Admin/EnqueueAdminExample.php
index d1c12ab63..fc0ef1fd2 100644
--- a/src/Enqueue/Admin/EnqueueAdminExample.php
+++ b/src/Enqueue/Admin/EnqueueAdminExample.php
@@ -3,15 +3,15 @@
/**
* The Admin Enqueue specific functionality.
*
- * @package EightshiftBoilerplate\Enqueue\Admin
+ * @package %g_namespace%\Enqueue\Admin
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Enqueue\Admin;
+namespace %g_namespace%\Enqueue\Admin;
-use EightshiftBoilerplate\Config\Config;
-use EightshiftLibs\Enqueue\Admin\AbstractEnqueueAdmin;
+use %g_namespace%\Config\Config;
+use %g_use_libs%\Enqueue\Admin\AbstractEnqueueAdmin;
/**
* Class EnqueueAdminExample
diff --git a/src/Enqueue/Blocks/EnqueueBlocksCli.php b/src/Enqueue/Blocks/EnqueueBlocksCli.php
index 66aee8f8d..488f2c793 100644
--- a/src/Enqueue/Blocks/EnqueueBlocksCli.php
+++ b/src/Enqueue/Blocks/EnqueueBlocksCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class EnqueueBlocksCli
@@ -69,6 +69,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,8 +78,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Blocks'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Blocks'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Enqueue/Blocks/EnqueueBlocksExample.php b/src/Enqueue/Blocks/EnqueueBlocksExample.php
index 59f36fffc..d287445f0 100644
--- a/src/Enqueue/Blocks/EnqueueBlocksExample.php
+++ b/src/Enqueue/Blocks/EnqueueBlocksExample.php
@@ -3,15 +3,15 @@
/**
* Enqueue class used to define all script and style enqueues for Gutenberg blocks.
*
- * @package EightshiftBoilerplate\Enqueue\Blocks
+ * @package %g_namespace%\Enqueue\Blocks
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Enqueue\Blocks;
+namespace %g_namespace%\Enqueue\Blocks;
-use EightshiftBoilerplate\Config\Config;
-use EightshiftLibs\Enqueue\Blocks\AbstractEnqueueBlocks;
+use %g_namespace%\Config\Config;
+use %g_use_libs%\Enqueue\Blocks\AbstractEnqueueBlocks;
/**
* Enqueue_Blocks class.
diff --git a/src/Enqueue/Theme/EnqueueThemeCli.php b/src/Enqueue/Theme/EnqueueThemeCli.php
index 393ee06b4..a89195f89 100644
--- a/src/Enqueue/Theme/EnqueueThemeCli.php
+++ b/src/Enqueue/Theme/EnqueueThemeCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class EnqueueThemeCli
@@ -69,6 +69,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
@@ -76,8 +78,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Theme'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'Enqueue' . \DIRECTORY_SEPARATOR . 'Theme'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Enqueue/Theme/EnqueueThemeExample.php b/src/Enqueue/Theme/EnqueueThemeExample.php
index 69ae82e47..1dac4a78d 100644
--- a/src/Enqueue/Theme/EnqueueThemeExample.php
+++ b/src/Enqueue/Theme/EnqueueThemeExample.php
@@ -3,15 +3,15 @@
/**
* The Theme/Frontend Enqueue specific functionality.
*
- * @package EightshiftBoilerplate\Enqueue\Theme
+ * @package %g_namespace%\Enqueue\Theme
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Enqueue\Theme;
+namespace %g_namespace%\Enqueue\Theme;
-use EightshiftBoilerplate\Config\Config;
-use EightshiftLibs\Enqueue\Theme\AbstractEnqueueTheme;
+use %g_namespace%\Config\Config;
+use %g_use_libs%\Enqueue\Theme\AbstractEnqueueTheme;
/**
* Class EnqueueThemeExample
diff --git a/src/Geolocation/GeolocationCli.php b/src/Geolocation/GeolocationCli.php
index 4d25745fc..d01309a77 100644
--- a/src/Geolocation/GeolocationCli.php
+++ b/src/Geolocation/GeolocationCli.php
@@ -14,7 +14,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class GeolocationCli
@@ -96,6 +96,8 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
// Get Arguments.
@@ -107,12 +109,11 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$class = $this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->renameTextDomain($assocArgs)
+ ->renameGlobals($assocArgs)
->searchReplaceString($this->getArgTemplate('cookie_name'), $cookieName);
// Output final class to new file/folder and finish.
- $class->outputWrite(Components::getProjectPaths('srcDestination', 'Geolocation'), "{$className}.php", $assocArgs);
+ $class->outputWrite(
+ Helpers::getProjectPaths('srcDestination', 'Geolocation'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/Geolocation/GeolocationExample.php b/src/Geolocation/GeolocationExample.php
index aa7b4c224..ded2cb48f 100644
--- a/src/Geolocation/GeolocationExample.php
+++ b/src/Geolocation/GeolocationExample.php
@@ -3,14 +3,14 @@
/**
* Class that adds Geolocation detection.
*
- * @package EightshiftBoilerplate\Geolocation
+ * @package %g_namespace%\Geolocation
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\Geolocation;
+namespace %g_namespace%\Geolocation;
-use EightshiftLibs\Geolocation\AbstractGeolocation;
+use %g_use_libs%\Geolocation\AbstractGeolocation;
/**
* Class Geolocation
diff --git a/src/GitIgnore/GitIgnoreCli.php b/src/GitIgnore/GitIgnoreCli.php
index 62986a9dd..24069f174 100644
--- a/src/GitIgnore/GitIgnoreCli.php
+++ b/src/GitIgnore/GitIgnoreCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class GitIgnoreCli
@@ -47,7 +47,7 @@ public function getCommandName(): string
public function getDefaultArgs(): array
{
return [
- 'path' => Components::getProjectPaths('projectRoot'),
+ 'path' => Helpers::getProjectPaths('projectRoot'),
];
}
@@ -83,7 +83,7 @@ public function getDoc(): array
## RESOURCES
File will be created from this example:
- https://github.com/infinum/eightshift-libs/blob/develop/src/GitIgnore/.gitignore
+ https://github.com/infinum/eightshift-libs/blob/develop/src/GitIgnore/GitIgnoreExample.php
"),
];
}
@@ -91,13 +91,19 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
+ // Get full class name.
+ $className = $this->getClassShortName();
+
// Get Props.
$path = $this->getArg($assocArgs, 'path');
// Read the template contents, and replace the placeholders with provided variables.
- $this->getExampleTemplate(__DIR__, '.gitignore')
+ $this->getExampleTemplate(__DIR__, $className)
+ ->renameGlobals($assocArgs)
->outputWrite($path, '.gitignore', $assocArgs);
}
}
diff --git a/src/GitIgnore/.gitignore b/src/GitIgnore/GitIgnoreExample.php
similarity index 97%
rename from src/GitIgnore/.gitignore
rename to src/GitIgnore/GitIgnoreExample.php
index 6473d9132..d68754c78 100644
--- a/src/GitIgnore/.gitignore
+++ b/src/GitIgnore/GitIgnoreExample.php
@@ -1,4 +1,4 @@
-# Wordpress files
+# WordPress files
wp-admin
wp-includes
/license.txt
diff --git a/src/Helpers/DeprecatedTrait.php b/src/Helpers/DeprecatedTrait.php
index e1b6d6a14..b6b4501af 100644
--- a/src/Helpers/DeprecatedTrait.php
+++ b/src/Helpers/DeprecatedTrait.php
@@ -88,7 +88,7 @@ public static function renderPartial(
*
* @param string $path Absolute path.
*
- * @deprecated 8.0.0 Use Components::getManifestByDir() instead. This method will be removed in the next major release.
+ * @deprecated 8.0.0 Use Helpers::getManifestByDir() instead. This method will be removed in the next major release.
*
* @return array
*/
diff --git a/src/Helpers/Helpers.php b/src/Helpers/Helpers.php
index 781d9e4db..5f3525291 100644
--- a/src/Helpers/Helpers.php
+++ b/src/Helpers/Helpers.php
@@ -180,7 +180,7 @@ public static function getManifestByDir(string $path): array
$sep = \DIRECTORY_SEPARATOR;
$root = Helpers::getProjectPaths('srcDestination');
$newPath = \str_replace($root, '', $path);
- $newPath = \explode($sep, $newPath);
+ $newPath = \array_filter(\explode($sep, $newPath));
if (!isset($newPath[0]) && $newPath[0] !== 'Blocks') {
throw InvalidManifest::notAllowedManifestPathException($path);
@@ -225,6 +225,7 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
$libsPath = ["vendor", "infinum", "eightshift-libs"];
$libsPrefixedPath = ["vendor-prefixed", "infinum", "eightshift-libs"];
$testsDataPath = ["tests", "data"];
+ $testsDatasetsPath = ["tests", "Datasets"];
$srcPath = "src";
$blocksPath = [$srcPath, "Blocks"];
$assetsPath = "assets";
@@ -240,6 +241,12 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
$internalPrefix = \dirname(__FILE__, 3);
}
break;
+ case 'testsDatasetsPath':
+ if (\getenv('ES_TEST')) {
+ $internalPrefix = \dirname(__FILE__, 3);
+ $path = self::joinPaths([...$testsDatasetsPath]);
+ }
+ break;
case 'testsData':
if (\getenv('ES_TEST')) {
$internalPrefix = \dirname(__FILE__, 3);
diff --git a/src/Helpers/ProjectInfoTrait.php b/src/Helpers/ProjectInfoTrait.php
index 05a64d718..58988904d 100644
--- a/src/Helpers/ProjectInfoTrait.php
+++ b/src/Helpers/ProjectInfoTrait.php
@@ -52,7 +52,7 @@ public static function getPluginTextDomain(): string
*/
public static function getThemeVersion(): string
{
- return \wp_get_theme()->get('Version');
+ return \wp_get_theme()->get('Version') ?: ''; // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
}
/**
@@ -62,7 +62,7 @@ public static function getThemeVersion(): string
*/
public static function getThemeName(): string
{
- return \wp_get_theme()->get('Name');
+ return \wp_get_theme()->get('Name') ?: ''; // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
}
/**
@@ -72,7 +72,7 @@ public static function getThemeName(): string
*/
public static function getThemeTextDomain(): string
{
- return \wp_get_theme()->get('TextDomain');
+ return \wp_get_theme()->get('TextDomain') ?: ''; // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
}
/**
diff --git a/src/I18n/I18nCli.php b/src/I18n/I18nCli.php
index 9e65617ee..cfb136f5c 100644
--- a/src/I18n/I18nCli.php
+++ b/src/I18n/I18nCli.php
@@ -12,7 +12,7 @@
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliCreate;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
/**
* Class I18nCli
@@ -69,13 +69,15 @@ public function getDoc(): array
/* @phpstan-ignore-next-line */
public function __invoke(array $args, array $assocArgs)
{
+ $assocArgs = $this->prepareArgs($assocArgs);
+
$this->getIntroText($assocArgs);
$className = $this->getClassShortName();
$sep = \DIRECTORY_SEPARATOR;
- $sourceLanguages = Components::getProjectPaths('srcDestination', "I18n{$sep}languages");
+ $sourceLanguages = Helpers::getProjectPaths('srcDestination', "I18n{$sep}languages");
if (!\is_dir($sourceLanguages)) {
\mkdir($sourceLanguages, 0755, true);
@@ -84,8 +86,7 @@ public function __invoke(array $args, array $assocArgs)
// Read the template contents, and replace the placeholders with provided variables.
$this->getExampleTemplate(__DIR__, $className)
->renameClassName($className)
- ->renameNamespace($assocArgs)
- ->renameUse($assocArgs)
- ->outputWrite(Components::getProjectPaths('srcDestination', 'I18n'), "{$className}.php", $assocArgs);
+ ->renameGlobals($assocArgs)
+ ->outputWrite(Helpers::getProjectPaths('srcDestination', 'I18n'), "{$className}.php", $assocArgs);
}
}
diff --git a/src/I18n/I18nExample.php b/src/I18n/I18nExample.php
index 3c4a77c6a..d207d35cf 100644
--- a/src/I18n/I18nExample.php
+++ b/src/I18n/I18nExample.php
@@ -3,16 +3,16 @@
/**
* The Language specific functionality.
*
- * @package EightshiftBoilerplate\I18n
+ * @package %g_namespace%\I18n
*/
declare(strict_types=1);
-namespace EightshiftBoilerplate\I18n;
+namespace %g_namespace%\I18n;
-use EightshiftBoilerplate\Config\Config;
-use EightshiftLibs\Helpers\Helpers;
-use EightshiftLibs\Services\ServiceInterface;
+use %g_namespace%\Config\Config;
+use %g_use_libs%\Helpers\Helpers;
+use %g_use_libs%\Services\ServiceInterface;
/**
* Class i18n
@@ -57,6 +57,7 @@ public function loadThemeTextdomain(): void
*/
public function setScriptTranslations(): void
{
+ $sep = \DIRECTORY_SEPARATOR;
$assetsPrefix = Config::getProjectName();
$handle = "{$assetsPrefix}-block-editor-scripts";
\wp_set_script_translations(
diff --git a/src/Init/InitAllCli.php b/src/Init/InitAllCli.php
index 05f8b9e91..14fbb031b 100644
--- a/src/Init/InitAllCli.php
+++ b/src/Init/InitAllCli.php
@@ -87,6 +87,8 @@ public function __invoke(array $args, array $assocArgs)
{
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
diff --git a/src/Init/InitBlocksCli.php b/src/Init/InitBlocksCli.php
index fdc52ec20..5d55e6ccd 100644
--- a/src/Init/InitBlocksCli.php
+++ b/src/Init/InitBlocksCli.php
@@ -20,7 +20,7 @@
use EightshiftLibs\Blocks\UseWrapperCli;
use EightshiftLibs\Cli\AbstractCli;
use EightshiftLibs\Cli\ParentGroups\CliInit;
-use EightshiftLibs\Helpers\Components;
+use EightshiftLibs\Helpers\Helpers;
use ReflectionClass;
/**
@@ -148,6 +148,8 @@ public function __invoke(array $args, array $assocArgs)
$groupOutput = $assocArgs['groupOutput'] ?? false;
$all = $assocArgs['use_all'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
@@ -163,13 +165,13 @@ public function __invoke(array $args, array $assocArgs)
foreach (\array_keys(static::COMMANDS) as $command) {
switch ($command) {
case UseBlockCli::class:
- $commands[$command][$type] = $this->getFolderItems(Components::getProjectPaths('blocksSourceCustom'));
+ $commands[$command][$type] = $this->getFolderItems(Helpers::getProjectPaths('blocksSourceCustom'));
break;
case UseComponentCli::class:
- $commands[$command][$type] = $this->getFolderItems(Components::getProjectPaths('blocksSourceComponents'));
+ $commands[$command][$type] = $this->getFolderItems(Helpers::getProjectPaths('blocksSourceComponents'));
break;
case UseVariationCli::class:
- $commands[$command][$type] = $this->getFolderItems(Components::getProjectPaths('blocksSourceVariations'));
+ $commands[$command][$type] = $this->getFolderItems(Helpers::getProjectPaths('blocksSourceVariations'));
break;
default:
$commands[$command] = [];
diff --git a/src/Init/InitHeaderFooter.php b/src/Init/InitHeaderFooter.php
index f693fccbd..1c53d7a3d 100644
--- a/src/Init/InitHeaderFooter.php
+++ b/src/Init/InitHeaderFooter.php
@@ -70,6 +70,8 @@ public function __invoke(array $args, array $assocArgs)
{
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
diff --git a/src/Init/InitPluginCli.php b/src/Init/InitPluginCli.php
index 7d498edc7..cf48b5783 100644
--- a/src/Init/InitPluginCli.php
+++ b/src/Init/InitPluginCli.php
@@ -86,6 +86,8 @@ public function __invoke(array $args, array $assocArgs)
{
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
diff --git a/src/Init/InitProjectCli.php b/src/Init/InitProjectCli.php
index 2acc69d8d..a7b0df35d 100644
--- a/src/Init/InitProjectCli.php
+++ b/src/Init/InitProjectCli.php
@@ -17,6 +17,7 @@
use EightshiftLibs\Readme\ReadmeCli;
use EightshiftLibs\Setup\SetupCli;
use ReflectionClass;
+use WP_CLI;
/**
* Class InitProjectCli
@@ -96,6 +97,8 @@ public function __invoke(array $args, array $assocArgs)
{
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
@@ -126,8 +129,8 @@ public function __invoke(array $args, array $assocArgs)
}
if (!$groupOutput) {
- $this->cliLog('--------------------------------------------------');
- $this->cliLog('We have moved everything you need to start creating your awesome WordPress project. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
+ WP_CLI::runcommand("eval 'shell_exec(\"npm run build\");'");
+ $this->cliLog('We have moved everything you need to start creating your awesome WordPress project.', "M");
$this->cliLog('Happy developing!', "M");
}
}
diff --git a/src/Init/InitThemeCli.php b/src/Init/InitThemeCli.php
index bf3b77cc8..4a65f5be2 100644
--- a/src/Init/InitThemeCli.php
+++ b/src/Init/InitThemeCli.php
@@ -21,6 +21,7 @@
use EightshiftLibs\Enqueue\Theme\EnqueueThemeCli;
use EightshiftLibs\Main\MainCli;
use ReflectionClass;
+use WP_CLI;
/**
* Class InitThemeCli
@@ -83,9 +84,7 @@ public function getCommandName(): string
*/
public function getDefaultArgs(): array
{
- return [
- AbstractCli::THEME_NAME_ARG => 'Boilerplate',
- ];
+ return [];
}
/**
@@ -97,15 +96,6 @@ public function getDoc(): array
{
return [
'shortdesc' => 'Kickstart your WordPress theme with this simple command.',
- 'synopsis' => [
- [
- 'type' => 'assoc',
- 'name' => AbstractCli::THEME_NAME_ARG,
- 'description' => 'Define theme name.',
- 'optional' => true,
- 'default' => $this->getDefaultArg(AbstractCli::THEME_NAME_ARG),
- ],
- ],
'longdesc' => $this->prepareLongDesc("
## USAGE
@@ -113,7 +103,7 @@ public function getDoc(): array
## EXAMPLES
- # Setup theme:
+ # Setup theme files:
$ wp {$this->commandParentName} {$this->getCommandParentName()} {$this->getCommandName()}
"),
];
@@ -124,15 +114,12 @@ public function __invoke(array $args, array $assocArgs)
{
$groupOutput = $assocArgs['groupOutput'] ?? false;
+ $assocArgs = $this->prepareArgs($assocArgs);
+
if (!$groupOutput) {
$this->getIntroText();
}
- $themeName = $this->getArg($assocArgs, AbstractCli::THEME_NAME_ARG);
- if ($themeName) {
- unset($assocArgs[AbstractCli::THEME_NAME_ARG]);
- }
-
foreach (static::COMMANDS as $item) {
$label = $item['label'] ?? '';
$items = $item['items'] ?? [];
@@ -152,7 +139,6 @@ public function __invoke(array $args, array $assocArgs)
[
'groupOutput' => $type === 'blocks',
'introOutput' => false,
- AbstractCli::PROJECT_NAME_ARG => $themeName,
]
));
}
@@ -162,8 +148,9 @@ public function __invoke(array $args, array $assocArgs)
}
if (!$groupOutput) {
- $this->cliLogAlert('All the files have been copied, you can start working on your awesome theme!\n\nRun `npm start` to build all the assets.', 'success', \__('Ready to go!', 'eightshift-libs'));
- $this->cliLogAlert('If you want to set up the default header and footer, run `wp boilerplate init header-footer` after building assets.', 'info', \__('Note', 'eightshift-libs'));
+ WP_CLI::runcommand("eval 'shell_exec(\"npm run build\");'");
+
+ $this->cliLogAlert('All the files have been copied, you can start working on your awesome theme!', 'success', \__('Ready to go!', 'eightshift-libs'));
}
}
}
diff --git a/src/Init/InitThemeSetupCli.php b/src/Init/InitThemeSetupCli.php
new file mode 100644
index 000000000..d6d2bed71
--- /dev/null
+++ b/src/Init/InitThemeSetupCli.php
@@ -0,0 +1,148 @@
+
+ */
+ public function getDefaultArgs(): array
+ {
+ return [];
+ }
+
+ /**
+ * Get WPCLI command doc
+ *
+ * @return array>|string>
+ */
+ public function getDoc(): array
+ {
+ return [
+ 'shortdesc' => 'Setup theme project with initial boilerplate used with npx command. This command should never be run manually.',
+ 'synopsis' => [
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_PROJECT_NAME,
+ 'description' => 'Define your projects name.',
+ 'optional' => false,
+ ],
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_PROJECT_DESCRIPTION,
+ 'description' => 'Define your projects description.',
+ 'optional' => true,
+ ],
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_PROJECT_AUTHOR,
+ 'description' => 'Define your projects author.',
+ 'optional' => true,
+ ],
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_PROJECT_AUTHOR_URL,
+ 'description' => 'Define your projects author url.',
+ 'optional' => true,
+ ],
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_PROJECT_VERSION,
+ 'description' => 'Define your projects version.',
+ 'optional' => true,
+ ],
+ [
+ 'type' => 'assoc',
+ 'name' => self::ARG_SITE_URL,
+ 'description' => 'Define your projects url for webpack build.',
+ 'optional' => true,
+ ],
+ ],
+ 'longdesc' => $this->prepareLongDesc("
+ ## USAGE
+
+ Used to setup theme from the initial boilerplate.
+ This command should never be run manually as it will break your project.
+
+ ## EXAMPLES
+
+ # Setup theme project with initial boilerplate:
+ $ wp {$this->commandParentName} {$this->getCommandParentName()} {$this->getCommandName()}
+ "),
+ ];
+ }
+
+ /* @phpstan-ignore-next-line */
+ public function __invoke(array $args, array $assocArgs)
+ {
+ $assocArgs['actionOutput'] = 'file created';
+
+ $assocArgs = $this->prepareSetupArgs($assocArgs);
+
+ $this->getIntroText($assocArgs);
+
+ $sep = \DIRECTORY_SEPARATOR;
+ $dir = __DIR__ . "{$sep}theme";
+ $files = \array_diff(\scandir($dir), ['..', '.']);
+
+ $destionation = Helpers::getProjectPaths('themeRoot');
+
+ $this->cleanUpInitialBoilerplate();
+
+ foreach ($files as $file) {
+ if ($file === '.' || $file === '..') {
+ continue;
+ }
+
+ $this->getExampleTemplate($dir, $file)
+ ->renameGlobals($assocArgs)
+ ->outputWrite($destionation, $file, $assocArgs);
+ }
+
+ \rename($destionation, Helpers::joinPaths([\dirname($destionation), $assocArgs[self::ARG_TEXTDOMAIN]])); // phpcs:ignore WordPress.WP.AlternativeFunctions.rename_rename
+
+ $this->initMandatoryAfter();
+
+ WP_CLI::runcommand('theme activate ' . $assocArgs[self::ARG_TEXTDOMAIN]);
+ WP_CLI::runcommand('boilerplate init theme');
+ }
+}
diff --git a/src/Init/theme/.browserslistrc b/src/Init/theme/.browserslistrc
new file mode 100644
index 000000000..bdc10da10
--- /dev/null
+++ b/src/Init/theme/.browserslistrc
@@ -0,0 +1,3 @@
+defaults
+not IE 11
+not op_mini all
diff --git a/src/Init/theme/.eslintignore b/src/Init/theme/.eslintignore
new file mode 100644
index 000000000..9f9b48d05
--- /dev/null
+++ b/src/Init/theme/.eslintignore
@@ -0,0 +1 @@
+public/**/*.js
diff --git a/src/Init/theme/.eslintrc b/src/Init/theme/.eslintrc
new file mode 100644
index 000000000..91ec3573f
--- /dev/null
+++ b/src/Init/theme/.eslintrc
@@ -0,0 +1,3 @@
+{
+ "extends": "./node_modules/@eightshift/frontend-libs/linters/eslint.config.js"
+}
diff --git a/src/Init/theme/.stylelintrc b/src/Init/theme/.stylelintrc
new file mode 100644
index 000000000..3a127493d
--- /dev/null
+++ b/src/Init/theme/.stylelintrc
@@ -0,0 +1,4 @@
+{
+ "extends": "./node_modules/@eightshift/frontend-libs/linters/stylelint.config.js",
+ "ignoreFiles": "public/**/*.css"
+}
diff --git a/src/Init/theme/404.php b/src/Init/theme/404.php
new file mode 100644
index 000000000..0b7c129a0
--- /dev/null
+++ b/src/Init/theme/404.php
@@ -0,0 +1,13 @@
+=8.0",
+ "infinum/eightshift-libs": "dev-feature/cli"
+ },
+ "autoload": {
+ "psr-4": {
+ "%g_namespace%\\": "src/"
+ }
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "config": {
+ "sort-packages": true,
+ "optimize-autoloader": true,
+ "process-timeout": 2000,
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
+ },
+ "scripts": {
+ "test:types": "@php ./vendor/bin/phpstan analyze",
+ "test:standards": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-",
+ "test": [
+ "@test:standards",
+ "@test:types"
+ ],
+ "prefix-namespaces": [
+ "@php strauss.phar",
+ "composer dump-autoload"
+ ],
+ "post-install-cmd": [
+ "@php strauss.phar",
+ "composer dump-autoload"
+ ],
+ "post-update-cmd": [
+ "@php strauss.phar",
+ "composer dump-autoload"
+ ]
+ },
+ "extra": {
+ "strauss": {
+ "namespace_prefix": "%g_namespace_vendor_prefix%",
+ "exclude_from_prefix": {
+ "file_patterns": ["/Example.php$/"]
+ }
+ }
+ }
+}
diff --git a/src/Init/theme/footer.php b/src/Init/theme/footer.php
new file mode 100644
index 000000000..e9e6c7137
--- /dev/null
+++ b/src/Init/theme/footer.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+