first commit

This commit is contained in:
2026-03-24 00:31:47 +01:00
commit 2506f6f9c7
3328 changed files with 1172155 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Core\DocumentTypes\Page;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Add_Logo extends Step_Base {
const STEP_ID = 'add_logo';
const SITE_IDENTITY_TAB = 'settings-site-identity';
public function get_id(): string {
return self::STEP_ID;
}
public function is_absolute_completed(): bool {
return $this->wordpress_adapter->has_custom_logo();
}
public function get_title(): string {
return esc_html__( 'Add your logo', 'elementor' );
}
public function get_description(): string {
return __( 'Let\'s start by adding your logo and filling in the site identity settings. This will establish your initial presence and also improve SEO.', 'elementor' );
}
public function get_cta_text(): string {
return esc_html__( 'Go to Site Identity', 'elementor' );
}
public function get_cta_url(): string {
return Page::get_site_settings_url_config( self::SITE_IDENTITY_TAB )['url'];
}
public function get_is_completion_immutable(): bool {
return false;
}
public function get_image_src(): string {
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-1.jpg';
}
public function get_learn_more_url(): string {
return 'http://go.elementor.com/app-website-checklist-logo-article';
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Assign_Homepage extends Step_Base {
const STEP_ID = 'assign_homepage';
public function get_id(): string {
return self::STEP_ID;
}
public function is_absolute_completed(): bool {
$front_page_id = (int) ( $this->wordpress_adapter->get_option( 'page_on_front' ) ?? 0 );
return (bool) $front_page_id;
}
public function get_title(): string {
return esc_html__( 'Assign a homepage', 'elementor' );
}
public function get_description(): string {
return esc_html__( 'Before your launch, make sure to assign a homepage so visitors have a clear entry point into your site.', 'elementor' );
}
public function get_cta_text(): string {
return esc_html__( 'Assign homepage', 'elementor' );
}
public function get_cta_url(): string {
return admin_url( 'options-reading.php' );
}
public function get_is_completion_immutable(): bool {
return false;
}
public function get_image_src(): string {
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-6.jpg';
}
public function get_learn_more_url(): string {
return 'http://go.elementor.com/app-website-checklist-assign-home-article';
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Create_Pages extends Step_Base {
const STEP_ID = 'create_pages';
public function get_id(): string {
return self::STEP_ID;
}
public function is_absolute_completed(): bool {
$pages = $this->wordpress_adapter->get_pages( [
'meta_key' => '_elementor_version',
'number' => 3,
] ) ?? [];
return count( $pages ) >= 3;
}
public function get_title(): string {
return esc_html__( 'Create your first 3 pages', 'elementor' );
}
public function get_description(): string {
return esc_html__( 'Jumpstart your creation with professional designs from the Template Library or start from scratch.', 'elementor' );
}
public function get_cta_text(): string {
return esc_html__( 'Create a new page', 'elementor' );
}
public function get_cta_url(): string {
return Plugin::$instance->documents->get_create_new_post_url( 'page' );
}
public function get_learn_more_url(): string {
return 'http://go.elementor.com/app-website-checklist-pages-article';
}
public function get_is_completion_immutable(): bool {
return true;
}
public function get_image_src(): string {
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-3.jpg';
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Core\DocumentTypes\Page;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Set_Fonts_And_Colors extends Step_Base {
const STEP_ID = 'set_fonts_and_colors';
public function get_id(): string {
return self::STEP_ID;
}
public function is_absolute_completed(): bool {
$settings = $this->elementor_adapter->get_kit_settings();
$custom_color = $settings['custom_colors'] ?? '';
$custom_fonts = $settings['custom_typography'] ?? '';
return ! empty( $custom_color ) && ! empty( $custom_fonts );
}
public function get_title(): string {
return __( 'Set up your Global Fonts & Colors', 'elementor' );
}
public function get_description(): string {
return esc_html__( 'Global colors and fonts ensure a cohesive look across your site. Start by defining one color and one font.', 'elementor' );
}
public function get_cta_text(): string {
return esc_html__( 'Go to Site Identity', 'elementor' );
}
public function get_cta_url(): string {
$settings = $this->elementor_adapter->get_kit_settings();
$tab = ! $settings['custom_colors'] ? 'global-typography' : 'global-colors';
return Page::get_site_settings_url_config( $tab )['url'];
}
public function get_is_completion_immutable(): bool {
return false;
}
public function get_image_src(): string {
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-2.jpg';
}
public function get_learn_more_url(): string {
return 'http://go.elementor.com/app-website-checklist-global-article';
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Setup_Header extends Step_Base {
const STEP_ID = 'setup_header';
public function __construct( $module, $wordpress_adapter = null, $elementor_adapter = null, $should_promote = true ) {
$promotion_data = $should_promote
? $this->render_promotion()
: null;
parent::__construct( $module, $wordpress_adapter, $elementor_adapter, $promotion_data );
}
public function get_id(): string {
return self::STEP_ID;
}
public function is_visible(): bool {
if ( Utils::has_pro() ) {
return false;
}
return parent::is_visible();
}
public function is_absolute_completed(): bool {
$args = [
'post_type' => 'elementor_library',
'meta_query' => [
'relation' => 'AND',
[
'key' => '_elementor_template_type',
'value' => 'header',
'compare' => '=',
],
[
'key' => '_elementor_conditions',
],
],
'posts_per_page' => 1,
'fields' => 'ids',
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
];
$query = $this->wordpress_adapter->get_query( $args );
$header_templates = $query->posts ?? [];
return count( $header_templates ) >= 1;
}
public function get_title(): string {
return esc_html__( 'Set up a header', 'elementor' );
}
public function get_description(): string {
return esc_html__( 'This element applies across different pages, so visitors can easily navigate around your site.', 'elementor' );
}
public function get_cta_text(): string {
return esc_html__( 'Add a header', 'elementor' );
}
public function get_cta_url(): string {
return '';
}
public function get_image_src(): string {
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-4.jpg';
}
public function get_is_completion_immutable(): bool {
return false;
}
public function get_learn_more_url(): string {
return 'https://go.elementor.com/app-website-checklist-header-article';
}
private function render_promotion() {
return Filtered_Promotions_Manager::get_filtered_promotion_data(
[
'url' => 'https://go.elementor.com/go-pro-website-checklist-header',
'text' => esc_html__( 'Upgrade Now', 'elementor' ),
'icon' => 'default',
],
'elementor/checklist/promotion',
'upgrade_url'
);
}
}

View File

@@ -0,0 +1,208 @@
<?php
namespace Elementor\Modules\Checklist\Steps;
use Elementor\Core\Isolation\Wordpress_Adapter;
use Elementor\Core\Isolation\Wordpress_Adapter_Interface;
use Elementor\Core\Isolation\Elementor_Adapter;
use Elementor\Core\Isolation\Elementor_Adapter_Interface;
use Elementor\Modules\Checklist\Module as Checklist_Module;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Step_Base {
/**
* @var string
* This is the key to be set to true if the step can be completed, and still be considered completed even if the user later did something to the should have it marked as not completed
*/
const IS_COMPLETION_IMMUTABLE = 'is_completion_immutable';
const MARKED_AS_COMPLETED_KEY = 'is_marked_completed';
const IMMUTABLE_COMPLETION_KEY = 'is_immutable_completed';
const ABSOLUTE_COMPLETION_KEY = 'is_absolute_completed';
private array $user_progress;
protected Wordpress_Adapter_Interface $wordpress_adapter;
protected Elementor_Adapter_Interface $elementor_adapter;
protected ?array $promotion_data;
protected Checklist_Module $module;
/**
* Returns a steps current completion status
*
* @return bool
*/
abstract protected function is_absolute_completed(): bool;
/**
* @return string
*/
abstract public function get_id(): string;
/**
* @return string
*/
abstract public function get_title(): string;
/**
* @return string
*/
abstract public function get_description(): string;
/**
* For instance; 'Create 3 pages'
*
* @return string
*/
abstract public function get_cta_text(): string;
/**
* @return string
*/
abstract public function get_cta_url(): string;
/**
* @return bool
*/
abstract public function get_is_completion_immutable(): bool;
/**
* @return string
*/
abstract public function get_image_src(): string;
/**
* Step_Base constructor.
*
* @param Checklist_Module $module
* @param ?Wordpress_Adapter_Interface $wordpress_adapter
* @param ?Elementor_Adapter_Interface $elementor_adapter
* @return void
*/
public function __construct( Checklist_Module $module, ?Wordpress_Adapter_Interface $wordpress_adapter = null, ?Elementor_Adapter_Interface $elementor_adapter = null, $promotion_data = null ) {
$this->module = $module;
$this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter();
$this->elementor_adapter = $elementor_adapter ?? new Elementor_Adapter();
$this->promotion_data = $promotion_data;
$this->user_progress = $module->get_step_progress( $this->get_id() ) ?? $this->get_step_initial_progress();
}
/**
* Returns step visibility (by-default step is visible)
*
* @return bool
*/
public function is_visible(): bool {
return true;
}
public function get_learn_more_text(): string {
return esc_html__( 'Learn more', 'elementor' );
}
public function get_learn_more_url(): string {
return 'https://go.elementor.com/getting-started-with-elementor/';
}
public function update_step( array $step_data ): void {
$allowed_properties = [
self::MARKED_AS_COMPLETED_KEY => $step_data[ self::MARKED_AS_COMPLETED_KEY ] ?? null,
self::IMMUTABLE_COMPLETION_KEY => $step_data[ self::IMMUTABLE_COMPLETION_KEY ] ?? null,
self::ABSOLUTE_COMPLETION_KEY => $step_data[ self::ABSOLUTE_COMPLETION_KEY ] ?? null,
];
foreach ( $allowed_properties as $key => $value ) {
if ( null !== $value ) {
$this->user_progress[ $key ] = $value;
}
}
$this->set_step_progress();
}
/**
* Marking a step as completed based on user's desire
*
* @return void
*/
public function mark_as_completed(): void {
$this->update_step( [ self::MARKED_AS_COMPLETED_KEY => true ] );
}
/**
* Unmarking a step as completed based on user's desire
*
* @return void
*/
public function unmark_as_completed(): void {
$this->update_step( [ self::MARKED_AS_COMPLETED_KEY => false ] );
}
/**
* Marking a step as completed if it was completed once, and it's suffice to marketing's requirements
*
* @return void
*/
public function maybe_immutably_mark_as_completed(): void {
$is_immutable_completed = $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false;
if ( ! $is_immutable_completed && $this->get_is_completion_immutable() && $this->is_absolute_completed() ) {
$this->update_step( [
self::MARKED_AS_COMPLETED_KEY => false,
self::IMMUTABLE_COMPLETION_KEY => true,
] );
}
}
/**
* Returns the step marked as completed value
*
* @return bool
*/
public function is_marked_as_completed(): bool {
return $this->user_progress[ self::MARKED_AS_COMPLETED_KEY ];
}
/**
* Returns the step completed value
*
* @return bool
*/
public function is_immutable_completed(): bool {
return $this->get_is_completion_immutable() && $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false;
}
/**
* Sets and returns the initial progress of the step
*
* @return array
*/
public function get_step_initial_progress(): array {
$initial_progress = [
self::MARKED_AS_COMPLETED_KEY => false,
self::IMMUTABLE_COMPLETION_KEY => false,
];
$this->module->set_step_progress( $this->get_id(), $initial_progress );
return $initial_progress;
}
/**
* @return ?array
*/
public function get_promotion_data(): ?array {
return $this->promotion_data;
}
/**
* Sets the step progress
*
* @return void
*/
private function set_step_progress(): void {
$this->module->set_step_progress( $this->get_id(), $this->user_progress );
}
}