From 40bd2434e2582fb5611735958cc3f308c37e7e2c Mon Sep 17 00:00:00 2001 From: Peter Petrov Date: Wed, 30 Oct 2024 17:26:52 +0200 Subject: [PATCH] Replace foundation with cornerstone --- .../cornerstone-pages.tsx} | 8 ++-- .../lib/stores/cornerstone-pages.ts} | 16 +++---- .../meta/meta.module.scss | 0 .../meta/meta.tsx | 45 ++++++++++--------- .../lib/stores/suggest-regenerate.ts | 4 +- .../regenerate-critical-css-suggestion.tsx | 7 ++- .../context-tooltip/context-tooltip.tsx | 2 +- .../js/features/speed-score/speed-score.tsx | 6 +-- .../app/assets/src/js/pages/index/index.tsx | 4 +- .../plugins/boost/app/class-jetpack-boost.php | 6 +-- ..._Entry.php => Cornerstone_Pages_Entry.php} | 4 +- ...dation_Pages.php => Cornerstone_Pages.php} | 22 ++++----- .../app/lib/Environment_Change_Detector.php | 30 ++++++------- .../source-providers/Source_Providers.php | 6 +-- ..._Provider.php => Cornerstone_Provider.php} | 28 ++++++------ .../boost/changelog/add-cornerstone-pages | 4 ++ .../boost/changelog/add-cornerstone-pages-ui | 5 +++ .../boost/changelog/add-foundation-pages | 4 -- .../boost/changelog/add-foundation-pages-ui | 5 --- ...one-pages-suggest-regenerate-list-updated} | 2 +- ...dicate-cornerstone-page-in-wp-post-listing | 5 +++ ...ndicate-foundation-page-in-wp-post-listing | 5 --- ...css-regen-after-updating-cornerstone-page} | 2 +- projects/plugins/boost/wp-js-data-sync.php | 4 +- 24 files changed, 115 insertions(+), 109 deletions(-) rename projects/plugins/boost/app/assets/src/js/features/{foundation-pages/foundation-pages.tsx => cornerstone-pages/cornerstone-pages.tsx} (74%) rename projects/plugins/boost/app/assets/src/js/features/{foundation-pages/lib/stores/foundation-pages.ts => cornerstone-pages/lib/stores/cornerstone-pages.ts} (59%) rename projects/plugins/boost/app/assets/src/js/features/{foundation-pages => cornerstone-pages}/meta/meta.module.scss (100%) rename projects/plugins/boost/app/assets/src/js/features/{foundation-pages => cornerstone-pages}/meta/meta.tsx (81%) rename projects/plugins/boost/app/data-sync/{Foundation_Pages_Entry.php => Cornerstone_Pages_Entry.php} (90%) rename projects/plugins/boost/app/lib/{Foundation_Pages.php => Cornerstone_Pages.php} (81%) rename projects/plugins/boost/app/lib/critical-css/source-providers/providers/{Foundation_Provider.php => Cornerstone_Provider.php} (72%) create mode 100644 projects/plugins/boost/changelog/add-cornerstone-pages create mode 100644 projects/plugins/boost/changelog/add-cornerstone-pages-ui delete mode 100644 projects/plugins/boost/changelog/add-foundation-pages delete mode 100644 projects/plugins/boost/changelog/add-foundation-pages-ui rename projects/plugins/boost/changelog/{update-boost-foundation-pages-suggest-regenerate-list-updated => update-boost-cornerstone-pages-suggest-regenerate-list-updated} (79%) create mode 100644 projects/plugins/boost/changelog/update-boost-indicate-cornerstone-page-in-wp-post-listing delete mode 100644 projects/plugins/boost/changelog/update-boost-indicate-foundation-page-in-wp-post-listing rename projects/plugins/boost/changelog/{update-boost-prompt-critical-css-regen-after-updating-foundation-page => update-boost-prompt-critical-css-regen-after-updating-cornerstone-page} (71%) diff --git a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/foundation-pages.tsx b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/cornerstone-pages.tsx similarity index 74% rename from projects/plugins/boost/app/assets/src/js/features/foundation-pages/foundation-pages.tsx rename to projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/cornerstone-pages.tsx index 50abd7af0f2cc..03803537bd521 100644 --- a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/foundation-pages.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/cornerstone-pages.tsx @@ -3,7 +3,7 @@ import Meta from './meta/meta'; import SettingsItem from '$features/ui/settings-item/settings-item'; import Pill from '$features/ui/pill/pill'; -const FoundationPages = () => { +const CornerstonePages = () => { const { developmentFeatures } = Jetpack_Boost; if ( ! developmentFeatures ) { @@ -14,14 +14,14 @@ const FoundationPages = () => { - { __( 'Foundation Pages', 'jetpack-boost' ) } + { __( 'Cornerstone Pages', 'jetpack-boost' ) } } description={

{ __( - 'List the most important pages of your site. They will be optimized. The Page Speed scores are based on the first foundation page.', + 'List the most important pages of your site. They will be optimized. The Page Speed scores are based on the first cornerstone page.', 'jetpack-boost' ) }

@@ -32,4 +32,4 @@ const FoundationPages = () => { ); }; -export default FoundationPages; +export default CornerstonePages; diff --git a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/lib/stores/foundation-pages.ts b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/lib/stores/cornerstone-pages.ts similarity index 59% rename from projects/plugins/boost/app/assets/src/js/features/foundation-pages/lib/stores/foundation-pages.ts rename to projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/lib/stores/cornerstone-pages.ts index cbcb863cb0396..1d75f28636ce4 100644 --- a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/lib/stores/foundation-pages.ts +++ b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/lib/stores/cornerstone-pages.ts @@ -2,15 +2,15 @@ import { useDataSync } from '@automattic/jetpack-react-data-sync-client'; import { z } from 'zod'; /** - * Hook to get the Foundation Pages. + * Hook to get the Cornerstone Pages. */ -export function useFoundationPages(): [ +export function useCornerstonePages(): [ string[], ( newValue: string[], onSuccessCallback?: () => void ) => void, ] { const [ { data }, { mutate } ] = useDataSync( 'jetpack_boost_ds', - 'foundation_pages_list', + 'cornerstone_pages_list', z.array( z.string() ) ); @@ -23,16 +23,16 @@ export function useFoundationPages(): [ return [ data || [], updatePages ]; } -const FoundationPagesProperties = z.object( { +const CornerstonePagesProperties = z.object( { max_pages: z.number(), } ); -type FoundationPagesProperties = z.infer< typeof FoundationPagesProperties >; +type CornerstonePagesProperties = z.infer< typeof CornerstonePagesProperties >; -export function useFoundationPagesProperties(): FoundationPagesProperties | undefined { +export function useCornerstonePagesProperties(): CornerstonePagesProperties | undefined { const [ { data } ] = useDataSync( 'jetpack_boost_ds', - 'foundation_pages_properties', - FoundationPagesProperties + 'cornerstone_pages_properties', + CornerstonePagesProperties ); return data; diff --git a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/meta/meta.module.scss b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/meta/meta.module.scss similarity index 100% rename from projects/plugins/boost/app/assets/src/js/features/foundation-pages/meta/meta.module.scss rename to projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/meta/meta.module.scss diff --git a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/meta/meta.tsx b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/meta/meta.tsx similarity index 81% rename from projects/plugins/boost/app/assets/src/js/features/foundation-pages/meta/meta.tsx rename to projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/meta/meta.tsx index 94d56b17ef039..77727e0a1415b 100644 --- a/projects/plugins/boost/app/assets/src/js/features/foundation-pages/meta/meta.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/cornerstone-pages/meta/meta.tsx @@ -5,7 +5,10 @@ import ChevronUp from '$svg/chevron-up'; import React, { useEffect, useState } from 'react'; import clsx from 'clsx'; import styles from './meta.module.scss'; -import { useFoundationPages, useFoundationPagesProperties } from '../lib/stores/foundation-pages'; +import { + useCornerstonePages, + useCornerstonePagesProperties, +} from '../lib/stores/cornerstone-pages'; import { createInterpolateElement } from '@wordpress/element'; import { recordBoostEvent } from '$lib/utils/analytics'; import getSupportLink from '$lib/utils/get-support-link'; @@ -15,29 +18,29 @@ import { useNavigate } from 'react-router-dom'; const Meta = () => { const [ isExpanded, setIsExpanded ] = useState( false ); - const [ foundationPages, setFoundationPages ] = useFoundationPages(); - const foundationPagesProperties = useFoundationPagesProperties(); + const [ cornerstonePages, setCornerstonePages ] = useCornerstonePages(); + const cornerstonePagesProperties = useCornerstonePagesProperties(); const [ { refetch: refetchRegenerationReason } ] = useRegenerationReason(); const premiumFeatures = usePremiumFeatures(); const isPremium = premiumFeatures.includes( 'support' ); const navigate = useNavigate(); - const updateFoundationPages = ( newValue: string ) => { + const updateCornerstonePages = ( newValue: string ) => { const newItems = newValue.split( '\n' ).map( line => line.trim() ); - setFoundationPages( newItems, () => { + setCornerstonePages( newItems, () => { refetchRegenerationReason(); } ); }; let content = null; - if ( foundationPagesProperties !== undefined ) { + if ( cornerstonePagesProperties !== undefined ) { content = ( { createInterpolateElement( @@ -60,7 +63,7 @@ const Meta = () => { { createInterpolateElement( __( - 'Free users can add only one foundation page. Upgrade to add more.', + 'Free users can add only one cornerstone page. Upgrade to add more.', 'jetpack-boost' ), { @@ -69,7 +72,7 @@ const Meta = () => { { - recordBoostEvent( 'foundation_pages_upgrade_link_clicked', {} ); + recordBoostEvent( 'cornerstone_pages_upgrade_link_clicked', {} ); navigate( '/upgrade' ); } } /> @@ -104,7 +107,7 @@ const Meta = () => { target="_blank" rel="noopener noreferrer" onClick={ () => { - recordBoostEvent( 'foundation_pages_properties_failed', {} ); + recordBoostEvent( 'cornerstone_pages_properties_failed', {} ); } } /> ), @@ -116,15 +119,15 @@ const Meta = () => { } return ( -
+
- { foundationPagesProperties && + { cornerstonePagesProperties && sprintf( - /* translators: %1$d is the number of foundation pages added, %2$d is the maximum number allowed */ + /* translators: %1$d is the number of cornerstone pages added, %2$d is the maximum number allowed */ __( '%1$d / %2$d added', 'jetpack-boost' ), - foundationPages.length, - foundationPagesProperties.max_pages + cornerstonePages.length, + cornerstonePagesProperties.max_pages ) }
@@ -181,10 +184,10 @@ const List: React.FC< ListProps > = ( { items, setItems, maxItems, description } // Check if the number of items exceeds maxItems if ( lines.length > maxItems ) { const message = sprintf( - /* translators: %d is the maximum number of foundation page URLs. */ + /* translators: %d is the maximum number of cornerstone page URLs. */ _n( - 'You can add only %d foundation page URL.', - 'You can add up to %d foundation page URLs.', + 'You can add only %d cornerstone page URL.', + 'You can add up to %d cornerstone page URLs.', maxItems, 'jetpack-boost' ), @@ -232,7 +235,7 @@ const List: React.FC< ListProps > = ( { items, setItems, maxItems, description } value={ inputValue } rows={ inputRows } onChange={ e => validateInputValue( e.target.value ) } - id="jb-foundation-pages" + id="jb-cornerstone-pages" /> { inputInvalid &&

{ validationError?.message }

} { description &&
{ description }
} diff --git a/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/stores/suggest-regenerate.ts b/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/stores/suggest-regenerate.ts index 7cf835ac549b0..72a322915d5c0 100644 --- a/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/stores/suggest-regenerate.ts +++ b/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/stores/suggest-regenerate.ts @@ -7,8 +7,8 @@ const allowedSuggestions = [ 'post_saved', 'switched_theme', 'plugin_change', - 'foundation_page_saved', - 'foundation_pages_list_updated', + 'cornerstone_page_saved', + 'cornerstone_pages_list_updated', ] as const; export type RegenerationReason = ( typeof allowedSuggestions )[ number ] | null; diff --git a/projects/plugins/boost/app/assets/src/js/features/critical-css/regenerate-critical-css-suggestion/regenerate-critical-css-suggestion.tsx b/projects/plugins/boost/app/assets/src/js/features/critical-css/regenerate-critical-css-suggestion/regenerate-critical-css-suggestion.tsx index 90a85f5adfbd4..58bd08b545cba 100644 --- a/projects/plugins/boost/app/assets/src/js/features/critical-css/regenerate-critical-css-suggestion/regenerate-critical-css-suggestion.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/critical-css/regenerate-critical-css-suggestion/regenerate-critical-css-suggestion.tsx @@ -19,8 +19,11 @@ const suggestionMap: { [ key: string ]: string } = { "We noticed you've recently updated a plugin that may affect your site's HTML/CSS structure.", 'jetpack-boost' ), - foundation_page_saved: __( 'A Foundation page was updated.', 'jetpack-boost' ), - foundation_pages_list_updated: __( 'The list of Foundation pages was updated.', 'jetpack-boost' ), + cornerstone_page_saved: __( 'A Cornerstone page was updated.', 'jetpack-boost' ), + cornerstone_pages_list_updated: __( + 'The list of Cornerstone pages was updated.', + 'jetpack-boost' + ), }; const getSuggestionMessage = ( type: RegenerationReason | null ) => { diff --git a/projects/plugins/boost/app/assets/src/js/features/speed-score/context-tooltip/context-tooltip.tsx b/projects/plugins/boost/app/assets/src/js/features/speed-score/context-tooltip/context-tooltip.tsx index 6fb0876969741..72baade1535bf 100644 --- a/projects/plugins/boost/app/assets/src/js/features/speed-score/context-tooltip/context-tooltip.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/speed-score/context-tooltip/context-tooltip.tsx @@ -13,7 +13,7 @@ const ContextTooltip = () => { >

{ __( - "Your Overall Score is a summary of your first Foundation Page across both mobile and desktop devices. It gives a general idea of your site's overall performance.", + "Your Overall Score is a summary of your first Cornerstone Page across both mobile and desktop devices. It gives a general idea of your site's overall performance.", 'jetpack-boost' ) }

diff --git a/projects/plugins/boost/app/assets/src/js/features/speed-score/speed-score.tsx b/projects/plugins/boost/app/assets/src/js/features/speed-score/speed-score.tsx index dc835da58151d..6232fe0a30050 100644 --- a/projects/plugins/boost/app/assets/src/js/features/speed-score/speed-score.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/speed-score/speed-score.tsx @@ -20,13 +20,13 @@ import { useLocalCriticalCssGeneratorStatus } from '$features/critical-css/local import { queryClient } from '@automattic/jetpack-react-data-sync-client'; import ErrorBoundary from '$features/error-boundary/error-boundary'; import PopOut from './pop-out/pop-out'; -import { useFoundationPages } from '$features/foundation-pages/lib/stores/foundation-pages'; +import { useCornerstonePages } from '$features/cornerstone-pages/lib/stores/cornerstone-pages'; const SpeedScore = () => { - const [ foundationPages ] = useFoundationPages(); + const [ cornerstonePages ] = useCornerstonePages(); const { site, developmentFeatures } = Jetpack_Boost; const pageSpeedUrl = - developmentFeatures && foundationPages.length > 0 ? foundationPages[ 0 ] : site.url; + developmentFeatures && cornerstonePages.length > 0 ? cornerstonePages[ 0 ] : site.url; const [ { status, error, scores }, loadScore ] = useSpeedScores( pageSpeedUrl ); const scoreLetter = scores ? getScoreLetter( scores.current.mobile, scores.current.desktop ) : ''; const showPrevScores = scores && didScoresChange( scores ) && ! scores.isStale; diff --git a/projects/plugins/boost/app/assets/src/js/pages/index/index.tsx b/projects/plugins/boost/app/assets/src/js/pages/index/index.tsx index 68b0f326c83b9..372f6b5bd7f09 100644 --- a/projects/plugins/boost/app/assets/src/js/pages/index/index.tsx +++ b/projects/plugins/boost/app/assets/src/js/pages/index/index.tsx @@ -11,7 +11,7 @@ import MinifyMeta from '$features/minify-meta/minify-meta'; import { QualitySettings, ImageCdnLiar } from '$features/image-cdn'; import styles from './index.module.scss'; import { RecommendationsMeta } from '$features/image-size-analysis'; -import FoundationPages from '$features/foundation-pages/foundation-pages'; +import CornerstonePages from '$features/cornerstone-pages/cornerstone-pages'; import { useRegenerateCriticalCssAction } from '$features/critical-css/lib/stores/critical-css-state'; import PremiumTooltip from '$features/premium-tooltip/premium-tooltip'; import Upgraded from '$features/ui/upgraded/upgraded'; @@ -38,7 +38,7 @@ const Index = () => { return (
- + init_admin( $modules_setup ); diff --git a/projects/plugins/boost/app/data-sync/Foundation_Pages_Entry.php b/projects/plugins/boost/app/data-sync/Cornerstone_Pages_Entry.php similarity index 90% rename from projects/plugins/boost/app/data-sync/Foundation_Pages_Entry.php rename to projects/plugins/boost/app/data-sync/Cornerstone_Pages_Entry.php index 0735fd0247ba8..a6c9f674788ea 100644 --- a/projects/plugins/boost/app/data-sync/Foundation_Pages_Entry.php +++ b/projects/plugins/boost/app/data-sync/Cornerstone_Pages_Entry.php @@ -6,7 +6,7 @@ use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Entry_Can_Set; use Automattic\Jetpack_Boost\Lib\Environment_Change_Detector; -class Foundation_Pages_Entry implements Entry_Can_Get, Entry_Can_Set { +class Cornerstone_Pages_Entry implements Entry_Can_Get, Entry_Can_Set { private $option_key; @@ -34,7 +34,7 @@ public function set( $value ) { $updated = update_option( $this->option_key, $value ); if ( $updated ) { - ( new Environment_Change_Detector() )->handle_foundation_pages_list_update(); + ( new Environment_Change_Detector() )->handle_cornerstone_pages_list_update(); } } diff --git a/projects/plugins/boost/app/lib/Foundation_Pages.php b/projects/plugins/boost/app/lib/Cornerstone_Pages.php similarity index 81% rename from projects/plugins/boost/app/lib/Foundation_Pages.php rename to projects/plugins/boost/app/lib/Cornerstone_Pages.php index 491999f47d0d6..28d10ab944401 100644 --- a/projects/plugins/boost/app/lib/Foundation_Pages.php +++ b/projects/plugins/boost/app/lib/Cornerstone_Pages.php @@ -4,9 +4,9 @@ use Automattic\Jetpack\Schema\Schema; use Automattic\Jetpack_Boost\Contracts\Has_Setup; -use Automattic\Jetpack_Boost\Data_Sync\Foundation_Pages_Entry; +use Automattic\Jetpack_Boost\Data_Sync\Cornerstone_Pages_Entry; -class Foundation_Pages implements Has_Setup { +class Cornerstone_Pages implements Has_Setup { const PREMIUM_MAX_PAGES = 10; const FREE_MAX_PAGES = 1; @@ -23,8 +23,8 @@ public function setup() { public function register_ds_stores() { $schema = Schema::as_array( Schema::as_string() )->fallback( self::default_pages() ); - jetpack_boost_register_option( 'foundation_pages_list', $schema, new Foundation_Pages_Entry( 'foundation_pages_list' ) ); - jetpack_boost_register_readonly_option( 'foundation_pages_properties', array( $this, 'get_properties' ) ); + jetpack_boost_register_option( 'cornerstone_pages_list', $schema, new Cornerstone_Pages_Entry( 'cornerstone_pages_list' ) ); + jetpack_boost_register_readonly_option( 'cornerstone_pages_properties', array( $this, 'get_properties' ) ); } public function remove_ccss_front_page_provider( $providers ) { @@ -112,7 +112,7 @@ public function get_pages() { return array(); } - return jetpack_boost_ds_get( 'foundation_pages_list' ); + return jetpack_boost_ds_get( 'cornerstone_pages_list' ); } public function get_properties() { @@ -122,13 +122,13 @@ public function get_properties() { } public function add_display_post_states( $post_states, $post ) { - $foundation_pages = $this->get_pages(); - if ( ! empty( $foundation_pages ) ) { - $post_url = untrailingslashit( get_permalink( $post ) ); - $foundation_pages = array_map( 'untrailingslashit', $foundation_pages ); + $cornerstone_pages = $this->get_pages(); + if ( ! empty( $cornerstone_pages ) ) { + $post_url = untrailingslashit( get_permalink( $post ) ); + $cornerstone_pages = array_map( 'untrailingslashit', $cornerstone_pages ); - if ( in_array( $post_url, $foundation_pages, true ) ) { - $post_states[] = __( 'Foundation Page', 'jetpack-boost' ); + if ( in_array( $post_url, $cornerstone_pages, true ) ) { + $post_states[] = __( 'Cornerstone Page', 'jetpack-boost' ); } } diff --git a/projects/plugins/boost/app/lib/Environment_Change_Detector.php b/projects/plugins/boost/app/lib/Environment_Change_Detector.php index a7ab760f83c39..0eca32a5992b2 100644 --- a/projects/plugins/boost/app/lib/Environment_Change_Detector.php +++ b/projects/plugins/boost/app/lib/Environment_Change_Detector.php @@ -14,13 +14,13 @@ */ class Environment_Change_Detector { - const ENV_CHANGE_LEGACY = '1'; - const ENV_CHANGE_PAGE_SAVED = 'page_saved'; - const ENV_CHANGE_POST_SAVED = 'post_saved'; - const ENV_CHANGE_SWITCHED_THEME = 'switched_theme'; - const ENV_CHANGE_PLUGIN_CHANGE = 'plugin_change'; - const ENV_CHANGE_FOUNDATION_PAGE_SAVED = 'foundation_page_saved'; - const ENV_CHANGE_FOUNDATION_PAGES_LIST_UPDATED = 'foundation_pages_list_updated'; + const ENV_CHANGE_LEGACY = '1'; + const ENV_CHANGE_PAGE_SAVED = 'page_saved'; + const ENV_CHANGE_POST_SAVED = 'post_saved'; + const ENV_CHANGE_SWITCHED_THEME = 'switched_theme'; + const ENV_CHANGE_PLUGIN_CHANGE = 'plugin_change'; + const ENV_CHANGE_CORNERSTONE_PAGE_SAVED = 'cornerstone_page_saved'; + const ENV_CHANGE_CORNERSTONE_PAGES_LIST_UPDATED = 'cornerstone_pages_list_updated'; /** * Initialize the change detection hooks. @@ -59,8 +59,8 @@ public function handle_plugin_change() { $this->do_action( false, $this::ENV_CHANGE_PLUGIN_CHANGE ); } - public function handle_foundation_pages_list_update() { - $this->do_action( false, $this::ENV_CHANGE_FOUNDATION_PAGES_LIST_UPDATED ); + public function handle_cornerstone_pages_list_update() { + $this->do_action( false, $this::ENV_CHANGE_CORNERSTONE_PAGES_LIST_UPDATED ); } /** @@ -107,12 +107,12 @@ private function is_post_type_invalidating( $post_type ) { * @return string The change type. */ private function get_post_change_type( $post ) { - $foundation_pages = ( new Foundation_Pages() )->get_pages(); - if ( $foundation_pages ) { - $foundation_pages_sanitized = array_map( 'untrailingslashit', $foundation_pages ); - $current_url = untrailingslashit( get_permalink( $post ) ); - if ( in_array( $current_url, $foundation_pages_sanitized, true ) ) { - return $this::ENV_CHANGE_FOUNDATION_PAGE_SAVED; + $cornerstone_pages = ( new Cornerstone_Pages() )->get_pages(); + if ( $cornerstone_pages ) { + $cornerstone_pages_sanitized = array_map( 'untrailingslashit', $cornerstone_pages ); + $current_url = untrailingslashit( get_permalink( $post ) ); + if ( in_array( $current_url, $cornerstone_pages_sanitized, true ) ) { + return $this::ENV_CHANGE_CORNERSTONE_PAGE_SAVED; } } diff --git a/projects/plugins/boost/app/lib/critical-css/source-providers/Source_Providers.php b/projects/plugins/boost/app/lib/critical-css/source-providers/Source_Providers.php index 8e1f8dd95a894..d840760796146 100644 --- a/projects/plugins/boost/app/lib/critical-css/source-providers/Source_Providers.php +++ b/projects/plugins/boost/app/lib/critical-css/source-providers/Source_Providers.php @@ -4,7 +4,7 @@ use Automattic\Jetpack_Boost\Lib\Critical_CSS\Critical_CSS_Storage; use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Archive_Provider; -use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Foundation_Provider; +use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Cornerstone_Provider; use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Post_ID_Provider; use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Provider; use Automattic\Jetpack_Boost\Lib\Critical_CSS\Source_Providers\Providers\Singular_Post_Provider; @@ -43,7 +43,7 @@ class Source_Providers { Singular_Post_Provider::class, Archive_Provider::class, Taxonomy_Provider::class, - Foundation_Provider::class, + Cornerstone_Provider::class, ); public function get_providers() { @@ -136,7 +136,7 @@ public function get_provider_sources( $context_posts = array() ) { // This removes the home and blog pages from the list of pages, // so they don't belong to two separate groups. - if ( ! in_array( $provider, array( WP_Core_Provider::class, Foundation_Provider::class ), true ) ) { + if ( ! in_array( $provider, array( WP_Core_Provider::class, Cornerstone_Provider::class ), true ) ) { $urls = array_values( array_diff( $urls, $flat_wp_core_urls ) ); } diff --git a/projects/plugins/boost/app/lib/critical-css/source-providers/providers/Foundation_Provider.php b/projects/plugins/boost/app/lib/critical-css/source-providers/providers/Cornerstone_Provider.php similarity index 72% rename from projects/plugins/boost/app/lib/critical-css/source-providers/providers/Foundation_Provider.php rename to projects/plugins/boost/app/lib/critical-css/source-providers/providers/Cornerstone_Provider.php index cdd8b3176389f..fa122fbced614 100644 --- a/projects/plugins/boost/app/lib/critical-css/source-providers/providers/Foundation_Provider.php +++ b/projects/plugins/boost/app/lib/critical-css/source-providers/providers/Cornerstone_Provider.php @@ -1,36 +1,36 @@ get_pages(); + $urls = $cornerstone_pages->get_pages(); $groups = array(); foreach ( $urls as $url ) { @@ -41,7 +41,7 @@ public static function get_critical_source_urls( $_context_posts = array() ) { } /** - * Get the current storage keys for foundation pages. + * Get the current storage keys for cornerstone pages. * * @return array */ @@ -62,13 +62,13 @@ private static function get_request_url() { } /** - * Get the keys for foundation pages. + * Get the keys for cornerstone pages. * * @return array */ public static function get_keys() { - $foundation_pages = new Foundation_Pages(); - $urls = $foundation_pages->get_pages(); + $cornerstone_pages = new Cornerstone_Pages(); + $urls = $cornerstone_pages->get_pages(); return array_map( array( __CLASS__, 'get_hash_for_url' ), $urls ); } @@ -86,7 +86,7 @@ public static function get_hash_for_url( $url ) { * @inheritdoc */ public static function describe_key( $_key ) { - return __( 'Foundation page', 'jetpack-boost' ); + return __( 'Cornerstone page', 'jetpack-boost' ); } /** diff --git a/projects/plugins/boost/changelog/add-cornerstone-pages b/projects/plugins/boost/changelog/add-cornerstone-pages new file mode 100644 index 0000000000000..913df505d02d2 --- /dev/null +++ b/projects/plugins/boost/changelog/add-cornerstone-pages @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Cornerstone Pages: Added cornerstone pages functionality diff --git a/projects/plugins/boost/changelog/add-cornerstone-pages-ui b/projects/plugins/boost/changelog/add-cornerstone-pages-ui new file mode 100644 index 0000000000000..44b1e37a53478 --- /dev/null +++ b/projects/plugins/boost/changelog/add-cornerstone-pages-ui @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Add UI for Cornerstone pages. + + diff --git a/projects/plugins/boost/changelog/add-foundation-pages b/projects/plugins/boost/changelog/add-foundation-pages deleted file mode 100644 index 95745ea51bf07..0000000000000 --- a/projects/plugins/boost/changelog/add-foundation-pages +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: added - -Foundation Pages: Added foundation pages functionality diff --git a/projects/plugins/boost/changelog/add-foundation-pages-ui b/projects/plugins/boost/changelog/add-foundation-pages-ui deleted file mode 100644 index c39f8f4ba6639..0000000000000 --- a/projects/plugins/boost/changelog/add-foundation-pages-ui +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: added -Comment: Add UI for Foundation pages. - - diff --git a/projects/plugins/boost/changelog/update-boost-foundation-pages-suggest-regenerate-list-updated b/projects/plugins/boost/changelog/update-boost-cornerstone-pages-suggest-regenerate-list-updated similarity index 79% rename from projects/plugins/boost/changelog/update-boost-foundation-pages-suggest-regenerate-list-updated rename to projects/plugins/boost/changelog/update-boost-cornerstone-pages-suggest-regenerate-list-updated index bc1b830c2e100..7814c821b1c47 100644 --- a/projects/plugins/boost/changelog/update-boost-foundation-pages-suggest-regenerate-list-updated +++ b/projects/plugins/boost/changelog/update-boost-cornerstone-pages-suggest-regenerate-list-updated @@ -1,5 +1,5 @@ Significance: patch Type: added -Comment: Add a notice prompting critical css regen after updating foundation pages list. +Comment: Add a notice prompting critical css regen after updating cornerstone pages list. diff --git a/projects/plugins/boost/changelog/update-boost-indicate-cornerstone-page-in-wp-post-listing b/projects/plugins/boost/changelog/update-boost-indicate-cornerstone-page-in-wp-post-listing new file mode 100644 index 0000000000000..2e1af5304ae37 --- /dev/null +++ b/projects/plugins/boost/changelog/update-boost-indicate-cornerstone-page-in-wp-post-listing @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Add "Cornerstone Page" indication next to pages in WPs page listing screen. + + diff --git a/projects/plugins/boost/changelog/update-boost-indicate-foundation-page-in-wp-post-listing b/projects/plugins/boost/changelog/update-boost-indicate-foundation-page-in-wp-post-listing deleted file mode 100644 index 945a55cea1ab0..0000000000000 --- a/projects/plugins/boost/changelog/update-boost-indicate-foundation-page-in-wp-post-listing +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: added -Comment: Add "Foundation Page" indication next to pages in WPs page listing screen. - - diff --git a/projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-foundation-page b/projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-cornerstone-page similarity index 71% rename from projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-foundation-page rename to projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-cornerstone-page index 725048f79d83e..67e9b4a03ad46 100644 --- a/projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-foundation-page +++ b/projects/plugins/boost/changelog/update-boost-prompt-critical-css-regen-after-updating-cornerstone-page @@ -1,5 +1,5 @@ Significance: patch Type: added -Comment: Add notice to prompt user to do critical css regeneration when they update a foundation page. +Comment: Add notice to prompt user to do critical css regeneration when they update a cornerstone page. diff --git a/projects/plugins/boost/wp-js-data-sync.php b/projects/plugins/boost/wp-js-data-sync.php index 6c5f24c0ad3d7..20805ad9db3d1 100644 --- a/projects/plugins/boost/wp-js-data-sync.php +++ b/projects/plugins/boost/wp-js-data-sync.php @@ -174,8 +174,8 @@ function jetpack_boost_initialize_datasync() { 'post_saved', 'switched_theme', 'plugin_change', - 'foundation_page_saved', - 'foundation_pages_list_updated', + 'cornerstone_page_saved', + 'cornerstone_pages_list_updated', ) )->nullable();