diff --git a/assets/js/admin-views.js b/assets/js/admin-views.js index 74a69a6a3..8fe7aa7a5 100644 --- a/assets/js/admin-views.js +++ b/assets/js/admin-views.js @@ -1298,7 +1298,7 @@ vcfg.selectTemplateContinue( slugmatch ); } } else { - // revert back to how things before before clicking "use a form preset" + // revert back to how things were before clicking "use a form preset" vcfg.toggleViewTypeMetabox(); vcfg.showViewConfig(); } diff --git a/composer.lock b/composer.lock index ed5f90dad..7824f60a4 100644 --- a/composer.lock +++ b/composer.lock @@ -237,12 +237,12 @@ "source": { "type": "git", "url": "git@github.com:GravityKit/Foundation.git", - "reference": "ba5647b8a31250271df545c04734fa934a07d5ac" + "reference": "68ab192a262f83b46b4c2957010971d0d476563c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GravityKit/Foundation/zipball/ba5647b8a31250271df545c04734fa934a07d5ac", - "reference": "ba5647b8a31250271df545c04734fa934a07d5ac", + "url": "https://api.github.com/repos/GravityKit/Foundation/zipball/68ab192a262f83b46b4c2957010971d0d476563c", + "reference": "68ab192a262f83b46b4c2957010971d0d476563c", "shasum": "" }, "require": { @@ -321,10 +321,10 @@ } ], "support": { - "source": "https://github.com/GravityKit/Foundation/tree/v1.0.12", + "source": "https://github.com/GravityKit/Foundation/tree/v1.1.0", "issues": "https://github.com/GravityKit/Foundation/issues" }, - "time": "2023-05-03T13:55:16+00:00" + "time": "2023-06-19T14:18:31+00:00" }, { "name": "illuminate/container", diff --git a/future/includes/class-gv-entry.php b/future/includes/class-gv-entry.php index 565476b85..c59c8ef77 100644 --- a/future/includes/class-gv-entry.php +++ b/future/includes/class-gv-entry.php @@ -113,6 +113,17 @@ public function get_permalink( \GV\View $view = null, \GV\Request $request = nul $args = array(); + /** + * @filter `gravityview/entry_link/add_query_args` Modify whether to include passed $_GET parameters to the end of the url + * @since 2.10 + * @param bool $add_query_params Whether to include passed $_GET parameters to the end of the Entry Link URL. Default: true. + */ + $add_query_args = apply_filters( 'gravityview/entry_link/add_query_args', true ); + + if ( $add_query_args ) { + $args = gv_get_query_args(); + } + $view_id = is_null ( $view ) ? null : $view->ID; $permalink = null; @@ -121,7 +132,7 @@ public function get_permalink( \GV\View $view = null, \GV\Request $request = nul if ( ! $request->is_view( false ) ) { /** Must be an embed of some sort. */ - if ( is_object( $post ) && is_numeric( $post->ID ) ) { + if ( $post instanceof \WP_Post && is_numeric( $post->ID ) ) { $permalink = get_permalink( $post->ID ); $view_collection = View_Collection::from_post( $post ); diff --git a/future/includes/class-gv-plugin.php b/future/includes/class-gv-plugin.php index b5ce30478..31625b2aa 100644 --- a/future/includes/class-gv-plugin.php +++ b/future/includes/class-gv-plugin.php @@ -54,13 +54,6 @@ final class Plugin { */ public static $min_gf_version = GV_MIN_GF_VERSION; - /** - * @var string Minimum PHP version. - * - * GravityView requires at least this version of PHP to function properly. - */ - private static $min_php_version = GV_MIN_PHP_VERSION; - /** * @var string|bool Minimum future PHP version. * @@ -380,23 +373,7 @@ public function url( $path = '/' ) { */ public function is_compatible() { - return - $this->is_compatible_php() - && $this->is_compatible_wordpress() - && $this->is_compatible_gravityforms(); - } - - /** - * Is this version of GravityView compatible with the current version of PHP? - * - * @since 2.0 - * - * @return bool true if compatible, false otherwise. - * @api - */ - public function is_compatible_php() { - - return version_compare( $this->get_php_version(), self::$min_php_version, '>=' ); + return $this->is_compatible_wordpress() && $this->is_compatible_gravityforms(); } /** @@ -407,9 +384,8 @@ public function is_compatible_php() { * @return bool true if compatible, false otherwise. * @api */ - public function is_compatible_future_php() { - - return version_compare( $this->get_php_version(), self::$future_min_php_version, '>=' ); + public function is_compatible_future_php(): bool { + return version_compare( phpversion(), self::$future_min_php_version, '>=' ); } /** @@ -476,19 +452,6 @@ public function is_compatible_future_gravityforms() { return $version ? version_compare( $version, self::$future_min_gf_version, '>=' ) : false; } - /** - * Retrieve the current PHP version. - * - * Overridable with GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE during testing. - * - * @return string The version of PHP. - */ - private function get_php_version() { - - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); - } - /** * Retrieve the current WordPress version. * diff --git a/future/includes/class-gv-utils.php b/future/includes/class-gv-utils.php index 2462e7a60..3819c936a 100644 --- a/future/includes/class-gv-utils.php +++ b/future/includes/class-gv-utils.php @@ -70,10 +70,16 @@ public static function _SERVER( $name, $default = null ) { * @return mixed The value or $default if not found. */ public static function get( $array, $key, $default = null ) { + if ( ! is_array( $array ) && ! is_object( $array ) ) { return $default; } + // Only allow string or integer keys. No null, array, etc. + if ( ! is_string( $key ) && ! is_int( $key ) ) { + return $default; + } + /** * Try direct key. */ diff --git a/future/includes/rest/class-gv-rest-views-route.php b/future/includes/rest/class-gv-rest-views-route.php index c1572b0f0..7fd7c84e0 100644 --- a/future/includes/rest/class-gv-rest-views-route.php +++ b/future/includes/rest/class-gv-rest-views-route.php @@ -209,14 +209,13 @@ public function prepare_entry_for_response( $view, $entry, \WP_REST_Request $req * @return \WP_Error|\WP_REST_Response */ public function get_sub_items( $request ) { + global $post; $url = $request->get_url_params(); $view_id = intval( $url['id'] ); $format = \GV\Utils::get( $url, 'format', 'json' ); if( $post_id = $request->get_param('post_id') ) { - global $post; - $post = get_post( $post_id ); if ( ! $post || is_wp_error( $post ) ) { @@ -232,6 +231,10 @@ public function get_sub_items( $request ) { $view = \GV\View::by_id( $view_id ); + if ( null !== $view ) { + $post = $view->get_post(); + } + if ( 'html' === $format ) { $renderer = new \GV\View_Renderer(); diff --git a/future/loader.php b/future/loader.php index d8ad339f8..06ce196a0 100644 --- a/future/loader.php +++ b/future/loader.php @@ -10,55 +10,6 @@ die(); } -/** - * Do not allow activation if PHP version is lower than GV_MIN_PHP_VERSION - */ -if ( version_compare( phpversion(), GV_MIN_PHP_VERSION, '<' ) ) { - $php_notices = array( - esc_html__( 'GravityView requires PHP [php_required_version] or newer.', 'gk-gravityview' ), - esc_html__( 'You are using version [php_installed_version].', 'gk-gravityview' ), - esc_html__( 'Please ask your host to upgrade PHP on the server.', 'gk-gravityview' ), - ); - - foreach ( $php_notices as &$notice ) { - $notice = strtr( - $notice, - array( - '[php_required_version]' => GV_MIN_PHP_VERSION, - '[php_installed_version]' => phpversion() - ) - ); - } - - if ( 'cli' === php_sapi_name() ) { - printf( join( ' ', $php_notices ) ); - } else { - add_action( 'admin_notices', function () use ( $php_notices ) { - $floaty_image = plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); - $floaty_image_alt = esc_attr__( 'The GravityKit Astronaut Says:', 'gk-gravityview' ); - - list( $requires, $installed, $call_to_action ) = $php_notices; - - echo << -
- {$floaty_image_alt} -

- {$requires} -

-

{$installed}

-

{$call_to_action}

-
- -HTML; - } ); - } - - deactivate_plugins( GRAVITYVIEW_FILE ); - - return; -} - require_once GRAVITYVIEW_DIR . 'vendor/autoload.php'; require_once GRAVITYVIEW_DIR . 'vendor_prefixed/autoload.php'; diff --git a/gravityview.php b/gravityview.php index de78623e4..d646ba1fb 100644 --- a/gravityview.php +++ b/gravityview.php @@ -3,7 +3,7 @@ * Plugin Name: GravityView * Plugin URI: https://www.gravitykit.com * Description: The best, easiest way to display Gravity Forms entries on your website. - * Version: 2.17.8 + * Version: 2.18 * Author: GravityKit * Author URI: https://www.gravitykit.com * Text Domain: gk-gravityview @@ -22,16 +22,12 @@ return; } -if ( ! GravityKit\GravityView\Foundation\meets_min_php_version_requirement( __FILE__, '7.2.0' ) ) { - return; -} - /** Constants */ /** * The plugin version. */ -define( 'GV_PLUGIN_VERSION', '2.17.8' ); +define( 'GV_PLUGIN_VERSION', '2.18' ); /** * Full path to the GravityView file @@ -71,12 +67,6 @@ */ define( 'GV_FUTURE_MIN_WP_VERSION', '5.3' ); -/** - * GravityView requires at least this version of PHP to function properly. - * @since 1.12 - */ -define( 'GV_MIN_PHP_VERSION', '7.2.0' ); - /** * GravityView will require this version of PHP soon. False if no future PHP version changes are planned. * @since 1.19.2 diff --git a/includes/admin/metaboxes/class-gravityview-admin-metaboxes.php b/includes/admin/metaboxes/class-gravityview-admin-metaboxes.php index 7a34e1e24..509109669 100644 --- a/includes/admin/metaboxes/class-gravityview-admin-metaboxes.php +++ b/includes/admin/metaboxes/class-gravityview-admin-metaboxes.php @@ -16,11 +16,6 @@ class GravityView_Admin_Metaboxes { * */ function __construct() { - - if ( ! GravityView_Compatibility::is_valid() ) { - return; - } - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; @@ -28,7 +23,6 @@ function __construct() { include_once self::$metaboxes_dir . 'class-gravityview-metabox-tabs.php'; $this->initialize(); - } /** diff --git a/includes/class-admin-welcome.php b/includes/class-admin-welcome.php index 1f707b621..1ae1f60d9 100644 --- a/includes/class-admin-welcome.php +++ b/includes/class-admin-welcome.php @@ -65,6 +65,7 @@ public function admin_menus( $foundation ) { 'capability' => $this->minimum_capability, 'callback' => array( $this, 'changelog_screen' ), 'order' => 40, + 'hide' => true, ], 'center' ); // Changelog Page @@ -75,16 +76,18 @@ public function admin_menus( $foundation ) { 'capability' => $this->minimum_capability, 'callback' => array( $this, 'credits_screen' ), 'order' => 50, + 'hide' => true, ], 'center' ); // Add Getting Started page to GravityView menu $admin_menu::add_submenu_item( [ - 'id' => 'gv-getting-started', - 'page_title' => __( 'GravityView: Getting Started', 'gk-gravityview' ), - 'menu_title' => __( 'Getting Started', 'gk-gravityview' ), - 'capability' => $this->minimum_capability, - 'callback' => array( $this, 'getting_started_screen' ), - 'order' => 60, // Make it the last so that the border divider remains + 'id' => 'gv-getting-started', + 'page_title' => __( 'GravityView: Getting Started', 'gk-gravityview' ), + 'menu_title' => __( 'Getting Started', 'gk-gravityview' ), + 'capability' => $this->minimum_capability, + 'callback' => array( $this, 'getting_started_screen' ), + 'order' => 60, // Make it the last so that the border divider remains + 'exclude_from_top_level_menu_action' => true, ], 'center' ); } @@ -114,13 +117,6 @@ public function is_dashboard_page( $is_page = false, $hook = NULL ) { * @return void */ public function admin_head() { - - /** @var \GravityKit\GravityView\Foundation\WP\AdminMenu $admin_menu */ - $admin_menu = GravityKitFoundation::admin_menu(); - - $admin_menu::remove_submenu_item( 'gv-credits' ); - $admin_menu::remove_submenu_item( 'gv-changelog' ); - if( ! $this->is_dashboard_page() ) { return; } @@ -185,7 +181,7 @@ public function getting_started_screen() {
-

Read more: Setting Up Your First View

+

Read more: Setting Up Your First View

@@ -277,6 +273,25 @@ public function changelog_screen() {

+

2.18 on June 20, 2023

+ + + +

Developer Notes:

+ + +

2.17.8 on May 16, 2023