-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
133 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php // phpcs:ignore | ||
require_once __DIR__ . '/cpt/index.php'; | ||
require_once __DIR__ . '/class-cpt.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Front-end Entry | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace J7\WpReactPlugin\FrontEnd; | ||
|
||
use Micropackage\Singleton\Singleton; | ||
use J7\WpReactPlugin\Utils\Base; | ||
/** | ||
* Class Entry | ||
*/ | ||
final class Entry extends Singleton { | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
\add_action( 'wp_footer', array( $this, 'render_app' ) ); | ||
} | ||
|
||
/** | ||
* Render application's markup | ||
*/ | ||
public function render_app(): void { | ||
// phpcs:ignore | ||
echo '<div id="' . Base::APP1_SELECTOR . '"></div>'; | ||
} | ||
} | ||
|
||
Entry::get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,2 @@ | ||
<?php | ||
/** | ||
* Front-end | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace J7\WpReactPlugin; | ||
|
||
/** | ||
* Class FrontEnd | ||
*/ | ||
final class FrontEnd { | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
\add_action( 'wp_footer', array( $this, 'render_app' ) ); | ||
} | ||
|
||
/** | ||
* Render application's markup | ||
*/ | ||
public function render_app(): void { | ||
// phpcs:ignore | ||
echo '<div id="' . Utils::APP1_SELECTOR . '"></div>'; | ||
} | ||
} | ||
|
||
new FrontEnd(); | ||
<?php // phpcs:ignore | ||
require_once __DIR__ . '/class-entry.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Base | ||
*/ | ||
|
||
declare (strict_types = 1); | ||
|
||
namespace J7\WpReactPlugin\Utils; | ||
|
||
/** | ||
* Class Base | ||
*/ | ||
abstract class Base { | ||
const BASE_URL = '/'; | ||
const APP1_SELECTOR = 'my_app'; | ||
const APP2_SELECTOR = 'my_app_metabox'; | ||
const API_TIMEOUT = '30000'; | ||
const DEFAULT_IMAGE = 'http://1.gravatar.com/avatar/1c39955b5fe5ae1bf51a77642f052848?s=96&d=mm&r=g'; | ||
|
||
/** | ||
* Is HPOS enabled | ||
* | ||
* @return bool | ||
*/ | ||
public static function is_hpos_enabled(): bool { | ||
return class_exists( \Automattic\WooCommerce\Utilities\OrderUtil::class ) && \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php // phpcs:ignore | ||
require_once __DIR__ . '/class-base.php'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters