This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
@@ -0,0 +1,98 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Splash_Page;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Service_Provider;
use Gravity_Forms\Gravity_Forms\Splash_Page\Config\GF_Splash_Page_Config;
use Gravity_Forms\Gravity_Forms\GF_Service_Container;
use Gravity_Forms\Gravity_Forms\GF_Service_Provider;
use Gravity_Forms\Gravity_Forms\Splash_Page_Template_Tags\GF_Splash_Page_Template_Tags;
/**
* Class Splash_Page_Service_Provider
*
* Service provider for the splash page.
*
* @package Gravity_Forms\Gravity_Forms\Splash_Page;
*/
class GF_Splash_Page_Service_Provider extends GF_Service_Provider {
const SPLASH_PAGE = 'splash_page';
const SPLASH_PAGE_TEMPLATE_TAGS = 'splash_page_template_tags';
/**
* Register services to the container.
*
* @since 2.6
*
* @param GF_Service_Container $container
*/
public function register( GF_Service_Container $container ) {
require_once( plugin_dir_path( __FILE__ ) . 'class-gf-splash-page-template-tags.php' );
require_once( plugin_dir_path( __FILE__ ) . '/class-gf-splash-page.php' );
$this->splash_page( $container );
}
/**
* Initialize any actions or hooks.
*
* @since 2.6
*
* @param GF_Service_Container $container
*
* @return void
*/
public function init( GF_Service_Container $container ) {
add_action( 'admin_enqueue_scripts', function () use ( $container ) {
$container->get( self::SPLASH_PAGE )->splash_page_styles();
} );
add_filter( 'admin_body_class', function ( $classes ) use ( $container ) {
return $container->get( self::SPLASH_PAGE )->body_class( $classes );
}, 10, 1 );
add_filter( 'admin_title', function ( $title ) use ( $container ) {
return $container->get( self::SPLASH_PAGE )->admin_title( $title );
}, 10, 1 );
add_filter( 'gform_system_status_menu', function ( $subviews ) use ( $container ) {
return $container->get( self::SPLASH_PAGE )->system_status_link( $subviews );
}, 10, 1 );
add_action( 'gform_system_status_page_about', function () use ( $container ) {
$container->get( self::SPLASH_PAGE )->about_page();
} );
add_action( 'gform_post_upgrade', function ( $version, $from_db_version, $force_upgrade ) use ( $container ) {
$container->get( self::SPLASH_PAGE )->set_upgrade_transient( $version, $from_db_version, $force_upgrade );
}, 10, 3 );
add_action( 'admin_footer', function () use ( $container ) {
echo $container->get( self::SPLASH_PAGE )->about_page_modal(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}, 10, 0 );
}
/**
* Register Splash Page services.
*
* @since 2.6
*
* @param GF_Service_Container $container
*
* @return void
*/
private function splash_page( GF_Service_Container $container ) {
$container->add( self::SPLASH_PAGE_TEMPLATE_TAGS, function () {
return new GF_Splash_Page_Template_Tags();
} );
$container->add( self::SPLASH_PAGE, function () use ( $container ) {
$tags = $container->get( self::SPLASH_PAGE_TEMPLATE_TAGS );
return new GF_Splash_Page( $tags );
} );
}
}
@@ -0,0 +1,168 @@
<?php
/**
* Creates the template parts for use on the splash page
*
* @package Gravity_Forms\Gravity_Forms\Splash_Page
*/
namespace Gravity_Forms\Gravity_Forms\Splash_Page_Template_Tags;
use \GFForms;
use \GFCommon;
/**
* Class GF_Splash_Page_Template_Tags
*
* @since 2.6
*
* Template tags for displaying content on the splash page.
*/
class GF_Splash_Page_Template_Tags {
/**
* Display a headline.
*
* @since 2.6
*
* @param array $args Associative array of arguments with key and value.
*
* @return string HTML that will be displayed
*/
public function headline( $args ) {
$args = wp_parse_args(
$args,
array(
'container_classes' => '',
'text' => '',
)
);
$classes = "gform-splash__section gform-splash__section--headline {$args['container_classes']}";
return "<div class='{$classes}'><h2>{$args['text']}</h2></div>";
}
/**
* Display text next to an image.
*
* @since 2.6
*
* @param array $args Associative array of arguments with key and value.
*
* @return string HTML that will be displayed
*/
public function text_and_image( $args ) {
$args = wp_parse_args(
$args,
array(
'container_classes' => '',
'image' => array(),
'image_placement' => '',
'text' => '',
)
);
$image_html = $this->build_image_html( $args['image'] );
$classes = "gform-splash__section gform-splash__section--text-and-image gform-splash__section--image-{$args['image_placement']} {$args['container_classes']}";
return "<div class='{$classes}'><div class='gform-splash-text'>{$args['text']}</div><div class='gform-splash-image-wrapper'>{$image_html}</div></div>";
}
/**
* Display a full-width image.
*
* @since 2.6
*
* @param array $args Associative array of arguments with key and value.
*
* @return string HTML that will be displayed
*/
public function full_width_image( $args ) {
$args = wp_parse_args(
$args,
array(
'container_classes' => '',
'image' => array(),
)
);
$image_html = $this->build_image_html( $args['image'] );
$classes = "gform-splash__section gform-splash__section--full-width-image {$args['container_classes']}";
return "<div class='{$classes}'>{$image_html}</div>";
}
/**
* Display full-width text.
*
* @since 2.6
*
* @param array $args Associative array of arguments with key and value.
*
* @return string HTML that will be displayed
*/
public function full_width_text( $args ) {
$args = wp_parse_args(
$args,
array(
'container_classes' => '',
'text' => '',
)
);
$classes = "gform-splash__section gform-splash__section--full-width-text {$args['container_classes']}";
return "<div class='{$classes}'>{$args['text']}</div>";
}
/**
* Display text in equal-width columns.
*
* @since 2.6
*
* @param array $args Associative array of arguments with key and value.
*
* @return string HTML that will be displayed
*/
public function equal_columns( $args ) {
$args = wp_parse_args(
$args,
array(
'container_classes' => '',
'columns' => array(),
)
);
$classes = "gform-splash__section gform-splash__section--columns {$args['container_classes']}";
$columns_html = '<div class="columns">';
foreach ( $args['columns'] as $column ) {
$columns_html .= "<div class='column'><div class='column-contents'>{$column}</div></div>";
}
$columns_html .= '</div>';
return "<div class='{$classes}'>{$columns_html}</div>";
}
/**
* Take an array of image attributes and turn it into an HTML <img> tag.
*
* @since 2.6
*
* @param string|array $image Either the image URL as a string, or an array of image attributes.
*
* @return string HTML that will be displayed
*/
public function build_image_html( $image ) {
if ( is_array( $image ) ) {
$attrs = '';
foreach ( $image as $attr => $value ) {
$attrs .= $attr . '="' . $value . '" ';
}
$image_html = '<div class="gform-splash-image"><img ' . $attrs . '/></div>';
} else {
$image_html = '<div class="gform-splash-image"><img src="' . $image . '"></div>';
}
return $image_html;
}
}
@@ -0,0 +1,223 @@
<?php
/**
* Displays a splash page when a user updates to a new version.
*
* @package Gravity_Forms\Gravity_Forms\Splash_Page
*/
namespace Gravity_Forms\Gravity_Forms\Splash_Page;
use \GFForms;
use \GFCommon;
use \Gravity_Forms\Gravity_Forms\Splash_Page_Template_Tags;
/**
* Class GF_Splash_Page
*
* @since 2.6
*
* Displays a splash page when a user updates to a new version.
*/
class GF_Splash_Page {
/**
* The latest version that has a splash page.
*
* @var string
*/
protected $about_version;
/**
* The class that generates template tags.
*
* @var Splash_Page_Template_Tags\GF_Splash_Page_Template_Tags
*/
protected $tags;
/**
* The directory where splash page images are stored.
*
* @var string
*/
protected $img_dir;
/**
* GF_Splash_Page_Constructor
*
* @param Splash_Page_Template_Tags\GF_Splash_Page_Template_Tags $tags
*/
public function __construct( $tags ) {
$this->about_version = '2.9';
$this->tags = $tags;
$this->img_dir = 'https://cdn.gravity.com/gravityforms/about-page/2.9/';
}
/**
* Conditional test for if we're on the splash page.
*
* @since 2.6
*
* @return bool
*/
public function is_splash_page() {
$screen = get_current_screen();
$is_system_status = ( 'forms_page_gf_system_status' === $screen->base ) || ( 'gf_system_status' === rgget( 'page' ) );
return ( $is_system_status ) && ( 'about' === rgget( 'subview' ) );
}
/**
* Enqueue splash page styles.
*
* @since 2.6
*/
public function splash_page_styles() {
if ( ! $this->should_display() && ! $this->is_splash_page() ) {
return;
}
wp_enqueue_style( 'gform_admin' );
}
/**
* Add a body class to the splash page.
*
* @since 2.6
*
* @param $classes
*
* @return string
*/
public function body_class( $classes ) {
if ( $this->is_splash_page() ) {
$classes .= ' toplevel_page_gf_splash';
}
return $classes;
}
/**
* Add "About" to the title tag.
*
* If you add a submenu page without a parent page, it doesn't get a title, so we need to add one manually.
*
* @since 2.6
*
* @param $title
*
* @return mixed|string
*/
public function admin_title( $title ) {
if ( $this->is_splash_page() ) {
/* translators: About page title. 1: Version number. */
$title = sprintf( __( 'About %1$s &lsaquo; System Status &lsaquo; Gravity Forms &#8212; WordPress', 'gravityforms' ), $this->about_version );
}
return $title;
}
/**
* Set a transient if we need to show the splash page.
*
* @since 2.6
*
* @param $version
* @param $from_db_version
* @param $force_upgrade
*/
public function set_upgrade_transient( $version, $from_db_version, $force_upgrade ) {
if ( $force_upgrade ) {
return;
}
if ( $this->need_splash_page( $from_db_version, GFForms::$version, $this->about_version ) ) {
set_transient( 'gf_updated', $this->about_version );
}
}
/**
* Determine whether we need to display a splash page.
*
* If the old version is earlier than $this->about_version, and the new version is the same or later than $this->about_version,
* we need to show the splash page.
*
* @since 2.6
*
* @param $old_version
* @param $new_version
* @param $about_version
*
* @return bool
*/
public function need_splash_page( $old_version, $new_version, $about_version ) {
$old_version = implode( '.', array_slice( preg_split( '/[.-]/', $old_version ), 0, 2 ) );
$new_version = implode( '.', array_slice( preg_split( '/[.-]/', $new_version ), 0, 2 ) );
return version_compare( $old_version, $about_version, '<' ) && $new_version >= $about_version;
}
/**
* Add a link to the splash page in the system status menu.
*
* @since 2.6
*
* @param array $subviews
*/
public function system_status_link( $subviews ) {
$subviews[19] = array(
'name' => 'about',
'label' => esc_html__( 'About', 'gravityforms' ),
'url' => 'https://www.gravityforms.com/tag/security-release/?utm_campaign=43447468-releases&utm_source=gravity-forms-plugin&utm_medium=wp-admin',
'target' => '_blank',
'is_external' => true,
);
return $subviews;
}
/**
* Display the splash page.
*
* @since 2.6
*/
public function about_page() {
if ( get_transient( 'gf_updated' ) ) {
delete_transient( 'gf_updated' );
}
ob_start();
include __DIR__ . '/gf_splash.php';
echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Display the splash page as a modal.
*
* @since 2.6
*
* @return string
*/
public function about_page_modal() {
if ( ! $this->should_display() ) {
return null;
}
ob_start();
$this->about_page();
$markup = ob_get_clean();
return sprintf( '<script type="text/template" data-js="gf-splash-template">%s</script>', $markup );
}
/**
* Whether the splash page should display.
*
* @since 2.6
*
* @return bool
*/
public function should_display() {
return $this->about_version == get_transient( 'gf_updated' ) && GFForms::is_gravity_page() && GFCommon::current_user_can_any( GFCommon::all_caps() );
}
}
@@ -0,0 +1,176 @@
<article class="gform-splash" data-js="gform-splash-page">
<header class="gform-splash__header">
<img class="gform-logo" src="<?php echo esc_url( GFCommon::get_base_url() ); ?>/images/logos/gravity-logo-white.svg" alt="Gravity Forms"/>
<h1><?php esc_html_e( 'New Fields Added in Gravity Forms 2.9!', 'gravityforms' ); ?></h1>
<p><?php esc_html_e( 'The new Image Choice and Multiple Choice fields give you more flexibility and control when creating forms.', 'gravityforms' ); ?></p>
<a class="gform-button gform-button--size-height-xxl gform-button--white gform-button--width-auto gform-button--icon-trailing" href="<?php echo esc_url( admin_url( 'admin.php?page=gf_new_form' ) ); ?>" title="<?php esc_attr_e( 'Get started with a new form', 'gravityforms' ); ?>">
<span class="gform-button__text gform-button__text--inactive gform-typography--size-text-md"><?php esc_html_e( 'Get Started', 'gravityforms' ); ?></span>
<span class="gform-common-icon gform-common-icon--arrow-narrow-right gform-button__icon" aria-hidden="true"></span>
</a>
<div class="gform-reviews">
<ul class="gform-reviews__list">
<li class="gform-reviews__list-item gform-reviews__list-item--g2">
<a
href="https://www.g2.com/products/gravity-forms/reviews"
title="<?php esc_html_e( 'Read reviews of Gravity Forms on G2', 'gravityforms' ); ?>"
target="_blank"
class="gform-reviews__link"
>
<span class="screen-reader-text"><?php echo esc_html__( '(opens in a new tab)', 'gravityforms' ); ?></span>
<img
src="<?php echo esc_attr( $this->img_dir ) . 'g2.svg'; ?>"
alt="<?php esc_attr_e( 'G2 logo', 'gravityforms' ); ?>"
class="gform-reviews__logo"
/>
<span class="gform-reviews__stars gform-reviews__stars--icon" aria-hidden="true">
<span class="gform-common-icon gform-common-icon--star"></span>
<span class="gform-common-icon gform-common-icon--star"></span>
<span class="gform-common-icon gform-common-icon--star"></span>
<span class="gform-common-icon gform-common-icon--star"></span>
<span class="gform-common-icon gform-common-icon--star"></span>
</span>
200+ <?php esc_html_e( '4.7 Stars', 'gravityforms' ); ?>
</a>
</li>
<li class="gform-reviews__list-item gform-reviews__list-item--trustpilot">
<a
href="https://www.trustpilot.com/review/gravityforms.com"
title="<?php esc_html_e( 'Read reviews of Gravity Forms on Trustpilot', 'gravityforms' ); ?>"
class="gform-reviews__link"
target="_blank"
>
<span class="screen-reader-text"><?php echo esc_html__( '(opens in a new tab)', 'gravityforms' ); ?></span>
<img
src="<?php echo esc_attr( $this->img_dir ) . 'trustpilot.svg'; ?>"
alt="<?php esc_attr_e( 'Trustpilot logo', 'gravityforms' ); ?>"
class="gform-reviews__logo"
/>
<span class="gform-reviews__stars gform-reviews__stars--image">
<img
src="<?php echo esc_attr( $this->img_dir ) . 'trustpilot-rating.svg'; ?>"
alt="<?php esc_attr_e( 'Trustpilot rating', 'gravityforms' ); ?>"
class="gform-reviews__stars-image"
/>
</span>
50+ <?php esc_html_e( '4.4 Stars', 'gravityforms' ); ?>
</a>
</li>
</ul>
</div>
</header>
<div class="gform-splash__body">
<div class="gform-splash__sections">
<?php
$text = '<h3>' . esc_html__( 'Image Choice Field', 'gravityforms' ) . '</h3>
<p>' . esc_html__( 'A picture is worth a thousand words! The new Image Choice field lets you add stylish images straight from the media library to your choices. Easily create beautiful forms with eye-catching images that speak to your users.', 'gravityforms' ) . '</p>
<a href="https://docs.gravityforms.com/image-choice-field/" target="_blank" class="gform-button gform-button--size-height-xl gform-button--primary-new gform-button--width-auto" title="' . esc_attr__( 'Read more about the Image Choice field', 'gravityforms' ) . '">
<span class="gform-button__text gform-button__text--inactive gform-typography--size-text-sm">' . esc_html__( 'Read More', 'gravityforms' ) . '</span>
<span class="screen-reader-text">' . esc_html__( 'About the Image Choice field', 'gravityforms' ) . '</span>
<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'gravityforms' ) . '</span>
&nbsp;<span class="gform-icon gform-icon--external-link" aria-hidden="true"></span></a>';
$image = array(
'src' => $this->img_dir . 'image-choice-field.png',
'alt' => esc_attr__( 'Screenshot of the Image Choice field in Gravity Forms 2.9', 'gravityforms' ),
);
echo wp_kses_post(
$this->tags->equal_columns(
array(
'columns' => array(
$this->tags->build_image_html( $image ),
$text,
),
'container_classes' => 'column--vertical-center',
),
)
);
$text = '<h3>' . esc_html__( 'Multiple Choice Field', 'gravityforms' ) . '</h3>
<p>' . esc_html__( 'The Multiple Choice field is a new, flexible way to let users choose one or many options. Gather the information you need, while ensuring a high-end experience for those submitting the form.', 'gravityforms' ) . '</p>
<a href="https://docs.gravityforms.com/multiple-choice-field/" target="_blank" class="gform-button gform-button--size-height-xl gform-button--primary-new gform-button--width-auto" title="' . esc_attr__( 'Read more about the Multiple Choice field', 'gravityforms' ) . '">
<span class="gform-button__text gform-button__text--inactive gform-typography--size-text-sm">' . esc_html__( 'Read More', 'gravityforms' ) . '</span>
<span class="screen-reader-text">' . esc_html__( 'About the Multiple Choice field', 'gravityforms' ) . '</span>
<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'gravityforms' ) . '</span>
&nbsp;<span class="gform-icon gform-icon--external-link" aria-hidden="true"></span></a>';
$image = array(
'src' => $this->img_dir . 'multiple-choice-field.png',
'alt' => esc_attr__( 'Screenshot of the Multiple Choice field in Gravity Forms 2.9', 'gravityforms' ),
);
echo wp_kses_post(
$this->tags->equal_columns(
array(
'columns' => array(
$text,
$this->tags->build_image_html( $image ),
),
'container_classes' => 'column--vertical-center',
),
)
);
$col1_icon = $style_icon = $this->tags->build_image_html(
array(
'src' => $this->img_dir . 'editor-design-improvements-icon.svg',
'alt' => esc_attr__( 'Icon of color swatches', 'gravityforms' ),
'width' => '52px',
'height' => '52px',
'class' => 'image--width-auto',
)
);
$col1 = $col1_icon . '<h4>' . esc_html__( 'Editor Design Improvements', 'gravityforms' ) . '</h4>
<p>' . esc_html__( 'Weve brought our beautiful Orbital form theme into the form editor! With 2.9 youll find a more consistent and visually-pleasing form editing experience, closely mirroring how your form will look on the front end.', 'gravityforms' ) . ' <a href="https://docs.gravityforms.com/gravity-forms-2-9-key-features/" title="' . esc_attr__( 'Read more about the Gravity Forms 2.9 editor design improvements', 'gravityforms' ) . '" target="_blank">' . esc_html__( 'Read More', 'gravityforms' ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'gravityforms' ) . '</span>&nbsp;<span class="gform-icon gform-icon--external-link" aria-hidden="true"></span></a></p>';
$col2_icon = $style_icon = $this->tags->build_image_html(
array(
'src' => $this->img_dir . 'editor-accessibility-improvements-icon.svg',
'alt' => esc_attr__( 'Icon of accessibility symbol', 'gravityforms' ),
'width' => '52px',
'height' => '52px',
'class' => 'image--width-auto',
)
);
$col2 = $col2_icon . '<h4>' . esc_html__( 'Editor Accessibility Improvements', 'gravityforms' ) . '</h4>
<p>' . esc_html__( 'As part of our continuing commitment to make form building available to everyone, we have improved the accessibility of the form editor. If you rely on keyboard navigation or screen readers, youll now have an easier time navigating the field settings.', 'gravityforms' ) . ' <a href="https://docs.gravityforms.com/gravity-forms-2-9-key-features/" title="' . esc_attr__( 'Read more about the Gravity Forms 2.9 editor accessibility improvements', 'gravityforms' ) . '" target="_blank">' . esc_html__( 'Read More', 'gravityforms' ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'gravityforms' ) . '</span>&nbsp;<span class="gform-icon gform-icon--external-link" aria-hidden="true"></span></a></p>';
echo wp_kses_post(
$this->tags->equal_columns(
array(
'columns' => array(
$col1,
$col2,
),
'container_classes' => 'column--vertical-center',
),
)
);
?>
</div>
<footer class="gform-splash__footer">
<h4>
<?php esc_html_e( 'Ready to get started?', 'gravityforms' ); ?>
</h4>
<p>
<?php esc_html_e( 'We believe there\'s a better way to manage your data and forms. Are you ready to create a form? Let\'s go!', 'gravityforms' ); ?>
</p>
<a class="gform-button gform-button--size-height-xxl gform-button--white gform-button--width-auto gform-button--icon-trailing" href="<?php echo esc_url( admin_url( 'admin.php?page=gf_new_form' ) ); ?>" title="<?php esc_attr_e( 'Get started with a new form', 'gravityforms' ); ?>">
<span class="gform-button__text gform-button__text--inactive gform-typography--size-text-md"><?php esc_html_e( 'Get Started', 'gravityforms' ); ?></span>
<span class="gform-common-icon gform-common-icon--arrow-narrow-right gform-button__icon" aria-hidden="true"></span>
</a>
</footer>
<div class="gform-splash__background gform-splash__background-one"></div>
<div class="gform-splash__background gform-splash__background-two"></div>
<div class="gform-splash__background gform-splash__background-three"></div>
<div class="gform-splash__background gform-splash__background-four"></div>
<div class="gform-splash__background gform-splash__background-five"></div>
<div class="gform-splash__background gform-splash__background-six"></div>
<div class="gform-splash__background gform-splash__background-seven"></div>
</div>
</article>