Skip to content

Commit

Permalink
app updates
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Jul 3, 2024
1 parent fe3793c commit ada5bf3
Show file tree
Hide file tree
Showing 43 changed files with 785 additions and 2,339 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
"scripts": {
"fix": "vendor/bin/phpcbf --standard=phpcs.xml .",
"lint": "vendor/bin/phpcs --standard=phpcs.xml -s .",
"i18n-pot": "vendor/bin/wp i18n make-pot . ./languages/wp-plugin-crazy-domains.pot --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/newfold-labs/wp-plugin-crazy-domains/issues\",\"POT-Creation-Date\":\"2023-01-11T20:21:44+00:00\"}' --exclude=assets,tests,src",
"i18n-po": "vendor/bin/wp i18n update-po ./languages/wp-plugin-crazy-domains.pot ./languages",
"i18n-pot": "vendor/bin/wp i18n make-pot . ./languages/wp-plugin-web.pot --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/newfold-labs/wp-plugin-web/issues\",\"POT-Creation-Date\":\"2023-01-11T20:21:44+00:00\"}' --exclude=assets,tests,src",
"i18n-po": "vendor/bin/wp i18n update-po ./languages/wp-plugin-web.pot ./languages",
"i18n-mo": "vendor/bin/wp i18n make-mo ./languages",
"i18n-json": "rm languages/*.json && vendor/bin/wp i18n make-json ./languages --no-purge --pretty-print",
"i18n": [
"@i18n-pot",
"@i18n-po",
"@i18n-mo",
"@i18n-json"
"@i18n-mo"
]
},
"scripts-descriptions": {
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = defineConfig({
excludeSpecPattern: [
'vendor/newfold-labs/wp-module-coming-soon/tests/cypress/integration/', // until ecommerce module is added use the local coming soon test instead
],
experimentalRunAllSpecs: true,
},
retries: 1,
experimentalMemoryManagement: true,
Expand Down
62 changes: 46 additions & 16 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace Web;

use Web\Data;
use function NewfoldLabs\WP\Module\Features\isEnabled;

/**
* \Web\Admin
*/
Expand All @@ -25,7 +28,7 @@ public function __construct() {
/* Add inline style to hide subnav link */
\add_action( 'admin_head', array( __CLASS__, 'admin_nav_style' ) );
/* Add runtime for data store */
\add_filter('newfold_runtime', array( __CLASS__, 'add_to_runtime' ) );
\add_filter( 'newfold_runtime', array( __CLASS__, 'add_to_runtime' ) );

if ( isset( $_GET['page'] ) && strpos( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ), 'web' ) >= 0 ) { // phpcs:ignore
\add_action( 'admin_footer_text', array( __CLASS__, 'add_brand_to_admin_footer' ) );
Expand All @@ -34,6 +37,10 @@ public function __construct() {

/**
* Add to runtime
*
* @param array $sdk - runtime properties from module
*
* @return array
*/
public static function add_to_runtime( $sdk ) {
include WEB_PLUGIN_DIR . '/inc/Data.php';
Expand All @@ -48,12 +55,32 @@ public static function add_to_runtime( $sdk ) {
* @return array
*/
public static function subpages() {
return array(
'web#/home' => __( 'Home', 'wp-plugin-web' ),

$home = array(
'web#/home' => __( 'Home', 'wp-plugin-web' ),
);
$marketplace = array(
'web#/marketplace' => __( 'Marketplace', 'wp-plugin-web' ),
'web#/performance' => __( 'Performance', 'wp-plugin-web' ),
'web#/settings' => __( 'Settings', 'wp-plugin-web' ),
'web#/help' => __( 'Help', 'wp-plugin-web' ),
);
// add performance if enabled
$performance = isEnabled( 'performance' )
? array(
'web#/performance' => __( 'Performance', 'wp-plugin-web' )
)
: array();
$settings = array(
'web#/settings' => __( 'Settings', 'wp-plugin-web' ),
);
$help = array(
'web#/help' => __( 'Help', 'wp-plugin-web' ),
);

return array_merge(
$home,
$marketplace,
$performance,
$settings,
$help,
);
}

Expand Down Expand Up @@ -88,15 +115,18 @@ public static function page() {
0
);

foreach ( self::subpages() as $route => $title ) {
\add_submenu_page(
'web',
$title,
$title,
'manage_options',
$route,
array( __CLASS__, 'render' )
);
// If we're outside of App, add subpages to App menu
if ( false === ( isset( $_GET['page'] ) && strpos( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ), 'web' ) >= 0 ) ) { // phpcs:ignore
foreach ( self::subpages() as $route => $title ) {
\add_submenu_page(
'web',
$title,
$title,
'manage_options',
$route,
array( __CLASS__, 'render' )
);
}
}
}

Expand Down Expand Up @@ -145,7 +175,7 @@ public static function assets() {
\wp_register_script(
'web-script',
WEB_BUILD_URL . '/index.js',
array_merge( $asset['dependencies'], ['nfd-runtime'] ),
array_merge( $asset['dependencies'], array( 'newfold-features', 'nfd-runtime' ) ),
$asset['version'],
true
);
Expand Down
10 changes: 6 additions & 4 deletions inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ public static function runtime() {
global $web_module_container;

$runtime = array(
'url' => WEB_BUILD_URL,
'version' => WEB_PLUGIN_VERSION,
'assets' => WEB_PLUGIN_URL . 'assets/',
'brand' => $web_module_container->plugin()->brand,
'plugin' => array(
'url' => WEB_BUILD_URL,
'version' => WEB_PLUGIN_VERSION,
'assets' => WEB_PLUGIN_URL . 'assets/',
'brand' => $web_module_container->plugin()->brand,
),
);

return $runtime;
Expand Down
Loading

0 comments on commit ada5bf3

Please sign in to comment.