From 91465aee671e8106ef60012eb0de5886b7b48fa4 Mon Sep 17 00:00:00 2001 From: Wouter Vernaillen Date: Tue, 10 Sep 2024 16:21:19 +0200 Subject: [PATCH] v0.0.3 --- package-lock.json | 4 +-- package.json | 5 ++-- wpnuxt-plugin.php | 75 ++++++++++++++++++++++++++++++----------------- 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc59da1..67538a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wpnuxt-plugin", - "version": "0.0.2", + "version": "0.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wpnuxt-plugin", - "version": "0.0.2", + "version": "0.0.3", "devDependencies": { "@changesets/cli": "^2.26.0", "@wordpress/jest-console": "^6.4.0", diff --git a/package.json b/package.json index 5da0f17..e75fc93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "wpnuxt-plugin", "private": true, - "version": "0.0.2", + "version": "0.0.3", "engines": { "node": ">=16.0.0" }, @@ -21,7 +21,8 @@ }, "files": [ "README.md", - "wpnuxt-plugin.php" + "wpnuxt-plugin.php", + "assets/styles.css" ], "devDependencies": { "@changesets/cli": "^2.26.0", diff --git a/wpnuxt-plugin.php b/wpnuxt-plugin.php index 73fe751..75edaec 100644 --- a/wpnuxt-plugin.php +++ b/wpnuxt-plugin.php @@ -11,7 +11,7 @@ * Plugin Name: WPNuxt * Plugin URI: https://wpnuxt.com * Description: A plugin to prepare WordPress as a headless CMS to use with WPNuxt - * Version: 0.0.2 + * Version: 0.0.3 * Requires at least: 6.0 * Tested up to: 6.5 * Requires PHP: 7.4 @@ -29,21 +29,20 @@ exit(); } -define('WPNUXT_PLUGIN_VERSION', '0.0.1'); -define('WP_GRAPHQL_VERSION', '1.27.0'); -define('WP_GRAPHQL_CONTENT_BLOCKS_VERSION', 'v4.0.0'); -define('FAUST_WP_VERSION', '1.3.1'); -define('ADVANCED_CUSTOM_FIELDS_VERSION', '6.3.1'); -define('WP_GRAPHQL_FOR_ACF_VERSION', '2.2.0'); +define('WPNUXT_PLUGIN_VERSION', '0.0.3'); +define('WPNUXT_WP_GRAPHQL_VERSION', '1.28.1'); +define('WPNUXT_WP_GRAPHQL_CONTENT_BLOCKS_VERSION', 'v4.1.0'); +define('WPNUXT_FAUST_WP_VERSION', '1.3.2'); +define('WPNUXT_ADVANCED_CUSTOM_FIELDS_VERSION', '6.3.6'); +define('WPNUXT_WP_GRAPHQL_FOR_ACF_VERSION', '2.4.1'); // Define Globals -global $plugin_list; +global $wpnuxt_plugin_list; global $github_version; add_action('admin_enqueue_scripts', function () { if (isset($_GET['page']) && $_GET['page'] === 'wpnuxt') { - wp_enqueue_style('admin_css_wpnuxt', plugins_url('assets/styles.css', __FILE__), false, WPNUXT_PLUGIN_VERSION); - wp_enqueue_script('admin_js', plugins_url('/assets/admin.js', __FILE__), ['jquery'], WPNUXT_PLUGIN_VERSION, true); + wp_enqueue_style('admin_css_wpnuxt', plugins_url('/assets/styles.css', __FILE__), false, WPNUXT_PLUGIN_VERSION); } }); @@ -69,11 +68,11 @@ function plugin_action_links_wpnuxt($links) require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; -$plugin_list = [ +$wpnuxt_plugin_list = [ 'wp-graphql' => [ 'name' => 'WPGraphQL', 'description' => 'A GraphQL API for WordPress with a built-in GraphiQL playground.', - 'url' => 'https://downloads.wordpress.org/plugin/wp-graphql.' . WP_GRAPHQL_VERSION . '.zip', + 'url' => 'https://downloads.wordpress.org/plugin/wp-graphql.' . WPNUXT_WP_GRAPHQL_VERSION . '.zip', 'file' => 'wp-graphql/wp-graphql.php', 'icon' => 'https://www.wpgraphql.com/logo-wpgraphql.svg', 'slug' => 'wp-graphql', @@ -83,7 +82,7 @@ function plugin_action_links_wpnuxt($links) 'wp-graphql-content-blocks' => [ 'name' => 'WPGraphQL Content Blocks', 'description' => 'WordPress plugin that extends WPGraphQL to support querying (Gutenberg) Blocks as data.', - 'url' => 'https://github.com/wpengine/wp-graphql-content-blocks/releases/download/' . WP_GRAPHQL_CONTENT_BLOCKS_VERSION . '/wp-graphql-content-blocks.zip', + 'url' => 'https://github.com/wpengine/wp-graphql-content-blocks/releases/download/' . WPNUXT_WP_GRAPHQL_CONTENT_BLOCKS_VERSION . '/wp-graphql-content-blocks.zip', 'file' => 'wp-graphql-content-blocks/wp-graphql-content-blocks.php', 'icon' => 'https://www.wpgraphql.com/logo-wpgraphql.svg', 'slug' => 'wp-graphql-content-blocks', @@ -103,7 +102,7 @@ function plugin_action_links_wpnuxt($links) 'advanced-custom-fields' => [ 'name' => 'Advanced Custom Fields', 'description' => 'Advanced Custom Fields (ACF) turns WordPress sites into a fully-fledged content management system by giving you all the tools to do more with your data.', - 'url' => 'https://downloads.wordpress.org/plugin/advanced-custom-fields.' . ADVANCED_CUSTOM_FIELDS_VERSION . '.zip', + 'url' => 'https://downloads.wordpress.org/plugin/advanced-custom-fields.' . WPNUXT_ADVANCED_CUSTOM_FIELDS_VERSION . '.zip', 'file' => 'advanced-custom-fields/acf.php', 'icon' => 'https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3096880', 'slug' => 'advanced-custom-fields', @@ -113,7 +112,7 @@ function plugin_action_links_wpnuxt($links) 'wpgraphql-acf' => [ 'name' => 'WPGraphQL for ACF', 'description' => 'WPGraphQL for Advanced Custom Fields', - 'url' => 'https://downloads.wordpress.org/plugin/wpgraphql-acf.' . WP_GRAPHQL_FOR_ACF_VERSION . '.zip', + 'url' => 'https://downloads.wordpress.org/plugin/wpgraphql-acf.' . WPNUXT_WP_GRAPHQL_FOR_ACF_VERSION . '.zip', 'file' => 'wpgraphql-acf/wpgraphql-acf.php', 'icon' => 'https://ps.w.org/wpgraphql-acf/assets/icon-128x128.png?rev=3012214', 'slug' => 'wpgraphql-acf', @@ -182,29 +181,29 @@ function wpNuxtOptionsPageHtml() add_action('admin_init', 'registerWPNuxtSettings'); function registerWPNuxtSettings() { - global $plugin_list; + global $wpnuxt_plugin_list; register_setting('wpnuxt_options', 'wpnuxt_options'); // Return true if all plugins are active - $is_all_plugins_active = array_reduce($plugin_list, function ($carry, $plugin) { + $is_all_plugins_active = array_reduce($wpnuxt_plugin_list, function ($carry, $plugin) { return $carry && ($plugin['required'] == 'false' || is_plugin_active($plugin['file'])); }, true); // if all plugins are active don't show required plugins section // if (!$is_all_plugins_active) { - add_settings_section('required_plugins', 'Plugins', 'requiredPluginsCallback', 'wpnuxt'); + add_settings_section('required_plugins', 'Plugins', 'requiredWPNuxtPluginsCallback', 'wpnuxt'); // } else { //} - add_settings_section('global_setting', 'Global Settings', 'global_setting_callback', 'wpnuxt'); + add_settings_section('global_setting', 'Global Settings', 'globalWPNuxtSettingCallback', 'wpnuxt'); } // Section callback -function requiredPluginsCallback() +function requiredWPNuxtPluginsCallback() { - global $plugin_list; + global $wpnuxt_plugin_list; // Return true if all plugins are active - $is_all_plugins_active = array_reduce($plugin_list, function ($carry, $plugin) { + $is_all_plugins_active = array_reduce($wpnuxt_plugin_list, function ($carry, $plugin) { return $carry && ($plugin['required'] == 'false' || is_plugin_active($plugin['file'])); }, true); ?> @@ -213,7 +212,7 @@ function requiredPluginsCallback()

Required plugins:

Recommended plugins: