remove old files

This commit is contained in:
paul sealock 2024-04-14 21:56:21 +12:00
parent 5e8644d7a5
commit ddabdb1bc2
12 changed files with 1 additions and 433 deletions

View File

@ -135,25 +135,6 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'autoload' => false,
),
Features::is_enabled( 'launch-your-store' ) ? array(
'title' => __( 'Coming soon page', 'woocommerce' ),
'desc' => __( 'TBD', 'woocommerce' ),
'id' => 'woocommerce_coming_soon_page_id',
'type' => 'single_select_page_with_search',
'default' => '',
'class' => 'wc-page-search',
'css' => 'min-width:300px;',
'args' => array(
'exclude' =>
array(
wc_get_page_id( 'checkout' ),
wc_get_page_id( 'myaccount' ),
),
),
'desc_tip' => true,
'autoload' => false,
) : array(),
array(
'type' => 'sectionend',
'id' => 'advanced_page_options',

View File

@ -226,7 +226,6 @@ class Options extends \WC_REST_Data_Controller {
'woocommerce_private_link',
'woocommerce_share_key',
'woocommerce_show_lys_tour',
'woocommerce_coming_soon_page_id',
// WC Test helper options.
'wc-admin-test-helper-rest-api-filters',
'wc_admin_helper_feature_values',

View File

@ -14,7 +14,6 @@ class LaunchYourStore {
*/
public function __construct() {
add_action( 'woocommerce_update_options_site-visibility', array( $this, 'save_site_visibility_options' ) );
add_action( 'current_screen', array( $this, 'maybe_create_coming_soon_page' ) );
if ( is_admin() ) {
add_filter( 'woocommerce_admin_shared_settings', array( $this, 'preload_settings' ) );
}
@ -39,10 +38,6 @@ class LaunchYourStore {
'woocommerce_private_link' => array( 'yes', 'no' ),
);
if ( isset( $_POST['woocommerce_store_pages_only'] ) ) {
$this->possibly_update_coming_soon_page( wc_clean( wp_unslash( $_POST['woocommerce_store_pages_only'] ) ) );
}
$at_least_one_saved = false;
foreach ( $options as $name => $option ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@ -58,135 +53,6 @@ class LaunchYourStore {
}
}
/**
* Update the contents of the coming soon page on settings change. Do not update if the post request
* doesn't change the store pages only setting, if the setting is unchanged, or if the page has been edited.
*
* @param string $next_store_pages_only The next store pages only setting.
* @return void
*/
public function possibly_update_coming_soon_page( $next_store_pages_only ) {
$option_name = 'woocommerce_store_pages_only';
$current_store_pages_only = get_option( $option_name, null );
// If the current and next store pages only values are the same, return.
if ( $current_store_pages_only && $current_store_pages_only === $next_store_pages_only ) {
return;
}
$page_id = get_option( 'woocommerce_coming_soon_page_id' );
$page = get_post( $page_id );
$original_page_content = 'yes' === $current_store_pages_only
? $this->get_store_only_coming_soon_content()
: $this->get_entire_site_coming_soon_content();
// If the page exists and the content is not the same as the original content, its been edited from its original state. Return early to respect any changes.
if ( $page && $page->post_content !== $original_page_content ) {
return;
}
if ( $page_id ) {
$next_page_content = 'yes' === $next_store_pages_only
? $this->get_store_only_coming_soon_content()
: $this->get_entire_site_coming_soon_content();
wp_update_post(
array(
'ID' => $page_id,
'post_content' => $next_page_content,
)
);
$template_id = 'yes' === $next_store_pages_only
? 'coming-soon-store-only'
: 'coming-soon-entire-site';
update_post_meta( $page_id, '_wp_page_template', $template_id );
}
}
/**
* Create a pattern for the store only coming soon page.
*
* @return string
*/
public function get_store_only_coming_soon_content() {
$heading = __( 'Great things coming soon', 'woocommerce' );
$subheading = __( 'Something big is brewing! Our store is in the works - Launching shortly!', 'woocommerce' );
return sprintf(
'<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:heading {"textAlign":"center","level":1} -->
<h1 class="wp-block-heading has-text-align-center">%s</h1>
<!-- /wp:heading -->
<!-- wp:spacer {"height":"10px"} -->
<div style="height:10px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">%s</p>
<!-- /wp:paragraph -->
<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer --></div>
<!-- /wp:group -->',
$heading,
$subheading
);
}
/**
* Create a pattern for the entire site coming soon page.
*
* @return string
*/
public function get_entire_site_coming_soon_content() {
$heading = __( 'Pardon our dust! We\'re working on something amazing -- check back soon!', 'woocommerce' );
return sprintf(
'<!-- wp:group {"className":"woocommerce-coming-soon-banner-container","layout":{"type":"constrained"}} -->
<div class="wp-block-group woocommerce-coming-soon-banner-container"><!-- wp:heading {"textAlign":"center","level":1,"align":"wide","className":"woocommerce-coming-soon-banner"} -->
<h1 class="wp-block-heading alignwide has-text-align-center woocommerce-coming-soon-banner">%s</h1>
<!-- /wp:heading --></div>
<!-- /wp:group -->',
$heading
);
}
/**
* Add `coming soon` page when it hasn't been created yet.
*
* @param WP_Screen $current_screen Current screen object.
*
* @return void
*/
public function maybe_create_coming_soon_page( $current_screen ) {
$option_name = 'woocommerce_coming_soon_page_id';
$current_page = PageController::get_instance()->get_current_page();
$is_home = isset( $current_page['id'] ) && 'woocommerce-home' === $current_page['id'];
$page_id_option = get_option( $option_name, false );
if ( $current_screen && 'woocommerce_page_wc-admin' === $current_screen->id && $is_home && ! $page_id_option ) {
$store_pages_only = 'yes' === get_option( 'woocommerce_store_pages_only', 'no' );
$page_id = wc_create_page(
esc_sql( _x( 'Coming Soon', 'Page slug', 'woocommerce' ) ),
$option_name,
_x( 'Coming Soon', 'Page title', 'woocommerce' ),
$store_pages_only ? $this->get_store_only_coming_soon_content() : $this->get_entire_site_coming_soon_content(),
);
$template_id = $store_pages_only ? 'coming-soon-store-only' : 'coming-soon-entire-site';
update_post_meta( $page_id, '_wp_page_template', $template_id );
// wc_create_page doesn't create options with autoload = yes.
// Since we'll querying the option on WooCommerce home,
// we should update the option to set autoload to yes.
$page_id_option = get_option( $option_name );
update_option( $option_name, $page_id_option, true );
}
}
/**
* Preload settings for Site Visibility.
*
@ -239,13 +105,6 @@ class LaunchYourStore {
return false;
}
// No need to show the banner on the Coming soon page itself.
$page_id = get_the_ID();
$coming_soon_page_id = intval( get_option( 'woocommerce_coming_soon_page_id' ) );
if ( $page_id === $coming_soon_page_id ) {
return false;
}
$link = admin_url( 'admin.php?page=wc-settings#wc_settings_general_site_visibility_slotfill' );
$text = sprintf(

View File

@ -47,8 +47,6 @@ class BlockTemplatesRegistry {
CartTemplate::SLUG => new CartTemplate(),
CheckoutTemplate::SLUG => new CheckoutTemplate(),
ComingSoonTemplate::SLUG => new ComingSoonTemplate(),
ComingSoonEntireSiteTemplate::SLUG => new ComingSoonEntireSiteTemplate(),
ComingSoonStoreOnlyTemplate::SLUG => new ComingSoonStoreOnlyTemplate(),
OrderConfirmationTemplate::SLUG => new OrderConfirmationTemplate(),
SingleProductTemplate::SLUG => new SingleProductTemplate(),
);

View File

@ -1,56 +0,0 @@
<?php
namespace Automattic\WooCommerce\Blocks\Templates;
/**
* ComingSoonEntireSiteTemplate class.
*
* @internal
*/
class ComingSoonEntireSiteTemplate extends AbstractPageTemplate {
/**
* The slug of the template.
*
* @var string
*/
const SLUG = 'page-coming-soon-entire-site';
/**
* Returns the title of the template.
*
* @return string
*/
public function get_template_title() {
return _x( 'Page: Coming soon entire site', 'Template name', 'woocommerce' );
}
/**
* Returns the description of the template.
*
* @return string
*/
public function get_template_description() {
return __( 'Page template for Coming soon page when access is restricted for entire site.', 'woocommerce' );
}
/**
* Returns the page object assigned to this template/page.
*
* @return \WP_Post|null Post object or null.
*/
protected function get_placeholder_page() {
$page_id = get_option( 'woocommerce_coming_soon_page_id' );
return $page_id ? get_post( $page_id ) : null;
}
/**
* True when viewing the coming soon page.
*
* @return boolean
*/
protected function is_active_template() {
global $post;
$placeholder = $this->get_placeholder_page();
return null !== $placeholder && $post instanceof \WP_Post && $placeholder->post_name === $post->post_name;
}
}

View File

@ -1,56 +0,0 @@
<?php
namespace Automattic\WooCommerce\Blocks\Templates;
/**
* ComingSoonStoreOnlyTemplate class.
*
* @internal
*/
class ComingSoonStoreOnlyTemplate extends AbstractPageTemplate {
/**
* The slug of the template.
*
* @var string
*/
const SLUG = 'page-coming-soon-store-only';
/**
* Returns the title of the template.
*
* @return string
*/
public function get_template_title() {
return _x( 'Page: Coming soon store only', 'Template name', 'woocommerce' );
}
/**
* Returns the description of the template.
*
* @return string
*/
public function get_template_description() {
return __( 'Page template for Coming soon page when access is restricted for store pages.', 'woocommerce' );
}
/**
* Returns the page object assigned to this template/page.
*
* @return \WP_Post|null Post object or null.
*/
protected function get_placeholder_page() {
$page_id = get_option( 'woocommerce_coming_soon_page_id' );
return $page_id ? get_post( $page_id ) : null;
}
/**
* True when viewing the coming soon page.
*
* @return boolean
*/
protected function is_active_template() {
global $post;
$placeholder = $this->get_placeholder_page();
return null !== $placeholder && $post instanceof \WP_Post && $placeholder->post_name === $post->post_name;
}
}

View File

@ -39,6 +39,7 @@ class ComingSoonTemplate extends AbstractPageTemplate {
* @return \WP_Post|null Post object or null.
*/
protected function get_placeholder_page() {
// not sure what to do about this.
$page_id = get_option( 'woocommerce_coming_soon_page_id' );
return $page_id ? get_post( $page_id ) : null;
}

View File

@ -298,8 +298,6 @@ class BlockTemplateUtils {
public static function get_template_paths( $template_type ) {
$wp_template_filenames = array(
'archive-product.html',
'coming-soon-entire-site.html',
'coming-soon-store-only.html',
'coming-soon.html',
'order-confirmation.html',
'page-cart.html',

View File

@ -1,75 +0,0 @@
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"20px","bottom":"20px"}},"color":{"background":"#bea0f2"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide has-background" style="background-color:#bea0f2;padding-top:20px;padding-bottom:20px"><!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between","flexWrap":"wrap"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex"}} -->
<div class="wp-block-group"><!-- wp:site-logo {"width":60} /-->
<!-- wp:group {"style":{"spacing":{"blockGap":"0px"}}} -->
<div class="wp-block-group"><!-- wp:site-title {"level":0} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"48px"}},"className":"woocommerce-coming-soon-social-login","layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group woocommerce-coming-soon-social-login"><!-- wp:social-links {"iconColor":"contrast","iconColorValue":"#111111","style":{"layout":{"selfStretch":"fit","flexSize":null},"spacing":{"blockGap":{"left":"18px"}}},"className":"is-style-logos-only"} -->
<ul class="wp-block-social-links has-icon-color is-style-logos-only"><!-- wp:social-link {"url":"https://www.linkedin.com/","service":"linkedin"} /-->
<!-- wp:social-link {"url":"https://www.instagram.com","service":"instagram"} /-->
<!-- wp:social-link {"url":"https://www.facebook.com","service":"facebook"} /--></ul>
<!-- /wp:social-links -->
<!-- wp:loginout /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:spacer {"height":"25px"} -->
<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:post-content {"align":"wide"} /-->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|10"}}},"className":"woocommerce-coming-soon-powered-by-woo","layout":{"type":"constrained"}} -->
<div class="wp-block-group woocommerce-coming-soon-powered-by-woo" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--10)"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"0"}}}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:0"><!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}},"textColor":"contrast-2","fontSize":"small"} -->
<p class="has-text-align-center has-contrast-2-color has-text-color has-link-color has-small-font-size">
Powered by
<a style="text-decoration: none;" href="https://woocommerce.com" rel="nofollow">WooCommerce</a>
</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<style>
body.page-template-coming-soon-entire-site {
background-color: #bea0f2;
}
.page-template-coming-soon-entire-site .wp-block-loginout {
background-color: #000000;
padding: 7px 17px;
border-radius: 6px;
}
.page-template-coming-soon-entire-site .wp-block-loginout a {
color: #ffffff;
text-decoration: none;
line-height: 17px;
font-size: 14px;
font-weight: 500;
}
.woocommerce-coming-soon-powered-by-woo {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}
body .is-layout-constrained > .woocommerce-coming-soon-banner.alignwide {
max-width: 820px;
}
.woocommerce-coming-soon-banner-container {
width: 100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.woocommerce-coming-soon-banner {
font-size: 48px;
font-weight: 400;
line-height: 58px;
}
</style>

View File

@ -1,3 +0,0 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:post-content {"align":"wide"} /-->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->

View File

@ -1,75 +0,0 @@
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"20px","bottom":"20px"}},"color":{"background":"#bea0f2"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide has-background" style="background-color:#bea0f2;padding-top:20px;padding-bottom:20px"><!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between","flexWrap":"wrap"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|20"},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex"}} -->
<div class="wp-block-group"><!-- wp:site-logo {"width":60} /-->
<!-- wp:group {"style":{"spacing":{"blockGap":"0px"}}} -->
<div class="wp-block-group"><!-- wp:site-title {"level":0} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"blockGap":"48px"}},"className":"woocommerce-coming-soon-social-login","layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group woocommerce-coming-soon-social-login"><!-- wp:social-links {"iconColor":"contrast","iconColorValue":"#111111","style":{"layout":{"selfStretch":"fit","flexSize":null},"spacing":{"blockGap":{"left":"18px"}}},"className":"is-style-logos-only"} -->
<ul class="wp-block-social-links has-icon-color is-style-logos-only"><!-- wp:social-link {"url":"https://www.linkedin.com/","service":"linkedin"} /-->
<!-- wp:social-link {"url":"https://www.instagram.com","service":"instagram"} /-->
<!-- wp:social-link {"url":"https://www.facebook.com","service":"facebook"} /--></ul>
<!-- /wp:social-links -->
<!-- wp:loginout /--></div>
<!-- /wp:group --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:spacer {"height":"25px"} -->
<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:post-content {"align":"wide"} /-->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|10"}}},"className":"woocommerce-coming-soon-powered-by-woo","layout":{"type":"constrained"}} -->
<div class="wp-block-group woocommerce-coming-soon-powered-by-woo" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--10)"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"0"}}}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:0"><!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}},"textColor":"contrast-2","fontSize":"small"} -->
<p class="has-text-align-center has-contrast-2-color has-text-color has-link-color has-small-font-size">
Powered by
<a style="text-decoration: none;" href="https://woocommerce.com" rel="nofollow">WooCommerce</a>
</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<style>
body.page-template-coming-soon-entire-site {
background-color: #bea0f2;
}
.page-template-coming-soon-entire-site .wp-block-loginout {
background-color: #000000;
padding: 7px 17px;
border-radius: 6px;
}
.page-template-coming-soon-entire-site .wp-block-loginout a {
color: #ffffff;
text-decoration: none;
line-height: 17px;
font-size: 14px;
font-weight: 500;
}
.woocommerce-coming-soon-powered-by-woo {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}
body .is-layout-constrained > .woocommerce-coming-soon-banner.alignwide {
max-width: 820px;
}
.woocommerce-coming-soon-banner-container {
width: 100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.woocommerce-coming-soon-banner {
font-size: 48px;
font-weight: 400;
line-height: 58px;
}
</style>

View File

@ -1,3 +0,0 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:post-content {"align":"wide"} /-->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->