first commit

This commit is contained in:
Ryan Ariana
2024-05-06 11:04:37 +07:00
commit aee061ddba
7322 changed files with 2918816 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use Elementor\Modules\Promotions\AdminMenuItems\Interfaces\Promotion_Menu_Item;
use Elementor\Settings;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
abstract class Base_Promotion_Item implements Promotion_Menu_Item {
public function get_name() {
return 'base_promotion';
}
public function is_visible() {
return true;
}
public function get_parent_slug() {
return Settings::PAGE_ID;
}
public function get_capability() {
return 'manage_options';
}
public function get_cta_text() {
return esc_html__( 'Upgrade Now', 'elementor' );
}
public function get_image_url() {
return ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg';
}
public function get_promotion_description() {
return '';
}
public function render() {
$config = [
'title' => $this->get_promotion_title(),
'description' => $this->get_promotion_description(),
'image' => $this->get_image_url(),
'upgrade_text' => $this->get_cta_text(),
'upgrade_url' => $this->get_cta_url(),
];
$config = Filtered_Promotions_Manager::get_filtered_promotion_data( $config, 'elementor/' . $this->get_name() . '/custom_promotion', 'upgrade_url' );
$description = $config['description'] ?? $this->get_promotion_description() ?? '';
?>
<div class="wrap">
<div class="elementor-blank_state">
<img src="<?php echo esc_url( $config['image'] ?? $this->get_image_url() ); ?>" loading="lazy" />
<h3><?php echo esc_html( $config['title'] ?? $this->get_promotion_title() ); ?></h3>
<?php if ( $description ) : ?>
<p><?php echo esc_html( $description ); ?></p>
<?php endif; ?>
<a class="elementor-button go-pro" href="<?php echo esc_url( $config['upgrade_url'] ?? $this->get_cta_url() ); ?>">
<?php echo esc_html( $config['upgrade_text'] ?? $this->get_cta_text() ); ?>
</a>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use Elementor\Settings;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
abstract class Base_Promotion_Template implements Admin_Menu_Item_With_Page {
abstract protected function get_promotion_title():string;
abstract protected function get_cta_url():string;
abstract protected function get_content_lines():array;
abstract protected function get_video_url():string;
public function is_visible() {
return true;
}
public function get_parent_slug() {
return Settings::PAGE_ID;
}
public function get_capability() {
return 'manage_options';
}
protected function get_cta_text() {
return esc_html__( 'Upgrade Now', 'elementor' );
}
/**
* Should the promotion have a side note.
* @return string
*/
protected function get_side_note():string {
return '';
}
private function get_lines() {
ob_start();
if ( ! empty( $this->get_content_lines() ) ) {
?>
<ul>
<?php foreach ( $this->get_content_lines() as $item ) { ?>
<li><?php Utils::print_unescaped_internal_string( $item ); ?></li>
<?php } ?>
</ul>
<?php
}
return ob_get_clean();
}
public function render() {
$promotion_data = $this->get_promotion_data();
?>
<div class="e-feature-promotion">
<div class="e-feature-promotion_data">
<h3><?php Utils::print_unescaped_internal_string( $promotion_data['promotion_title'] ); ?></h3>
<?php Utils::print_unescaped_internal_string( $promotion_data['lines'] ); ?>
<a class="elementor-button go-pro" href="<?php echo esc_url( $promotion_data['cta_url'] ); ?>" target="_blank">
<?php Utils::print_unescaped_internal_string( $promotion_data['cta_text'] ); ?>
</a>
<?php if ( ! empty( $promotion_data['side_note'] ) ) { ?>
<div class="side-note">
<p><?php Utils::print_unescaped_internal_string( $promotion_data['side_note'] ); ?></p>
</div>
<?php } ?>
</div>
<iframe class="e-feature-promotion_iframe" src="<?php Utils::print_unescaped_internal_string( $promotion_data['video_url'] ); ?>&rel=0" title="Elementor" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
<?php
}
/**
* @return array|null
*/
private function get_promotion_data(): ?array {
return Filtered_Promotions_Manager::get_filtered_promotion_data( $this->build_promotion_data_array(), 'elementor/' . $this->get_name() . '/custom_promotion', 'cta_url' );
}
/**
* @return array
*/
private function build_promotion_data_array(): array {
return [
'promotion_title' => $this->get_promotion_title(),
'cta_url' => $this->get_cta_url(),
'cta_text' => $this->get_cta_text(),
'video_url' => $this->get_video_url(),
'lines' => $this->get_lines(),
'side_note' => $this->get_side_note(),
];
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Custom_Code_Promotion_Item extends Base_Promotion_Template {
public function get_name() {
return 'custom_code';
}
public function get_label() {
return esc_html__( 'Custom Code', 'elementor' );
}
public function get_page_title() {
return esc_html__( 'Custom Code', 'elementor' );
}
protected function get_promotion_title(): string {
return esc_html__( 'Enjoy Creative Freedom with Custom Code', 'elementor' );
}
protected function get_content_lines():array {
return [
esc_html__( 'Add Custom Code snippets anywhere on your website, including the header or footer to measure your pages performance*', 'elementor' ),
esc_html__( 'Use Custom Code to create sophisticated custom interactions to engage visitors', 'elementor' ),
esc_html__( 'Leverage Elementor AI to instantly generate Custom Code for Elementor', 'elementor' ),
];
}
protected function get_side_note():string {
return esc_html__( '* Requires an Advanced subscription or higher', 'elementor' );
}
protected function get_cta_url():string {
return 'https://go.elementor.com/go-pro-custom-code/';
}
protected function get_video_url():string {
return 'https://www.youtube-nocookie.com/embed/IOovQd1hJUg?si=xeBJ_mRZxRH1l5O6';
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Custom_Fonts_Promotion_Item extends Base_Promotion_Template {
public function get_name() {
return 'custom_fonts';
}
public function get_label() {
return esc_html__( 'Custom Fonts', 'elementor' );
}
public function get_page_title() {
return esc_html__( 'Custom Fonts', 'elementor' );
}
protected function get_promotion_title(): string {
return esc_html__( 'Stay on brand with a Custom Font', 'elementor' );
}
protected function get_content_lines(): array {
return [
esc_html__( 'Upload any font to keep your website true to your brand', 'elementor' ),
sprintf(
/* translators: %s: br */
esc_html__( 'Remain GDPR compliant with Custom Fonts that let you disable %s Google Fonts from your website', 'elementor' ),
'<br />'
),
];
}
protected function get_cta_url(): string {
return 'https://go.elementor.com/go-pro-custom-fonts/';
}
protected function get_video_url(): string {
return 'https://www.youtube-nocookie.com/embed/j_guJkm28eY?si=cdd2TInwuGDTtCGD';
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Custom_Icons_Promotion_Item extends Base_Promotion_Template {
public function get_name() {
return 'custom_icons';
}
public function get_label() {
return esc_html__( 'Custom Icons', 'elementor' );
}
public function get_page_title() {
return esc_html__( 'Custom Icons', 'elementor' );
}
protected function get_promotion_title():string {
return sprintf(
/* translators: %s: br */
esc_html( 'Enjoy creative freedom %s with Custom Icons', 'elementor' ),
'<br />'
);
}
protected function get_content_lines(): array {
return [
sprintf(
esc_html__( 'Expand your icon library beyond FontAwesome and add icon %s libraries of your choice', 'elementor' ),
'<br />'
),
esc_html__( 'Add any icon, anywhere on your website', 'elementor' ),
];
}
protected function get_cta_url(): string {
return 'https://go.elementor.com/go-pro-custom-icons/';
}
protected function get_video_url(): string {
return 'https://www.youtube-nocookie.com/embed/PsowinxDWfM?si=SV9Z3TLz3_XEy5C6';
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Form_Submissions_Promotion_Item extends Base_Promotion_Template {
public function get_name() {
return 'submissions';
}
public function get_label() {
return esc_html__( 'Submissions', 'elementor' );
}
public function get_page_title() {
return esc_html__( 'Submissions', 'elementor' );
}
public function get_promotion_title():string {
return sprintf(
/* translators: %s: br */
esc_html( 'Create Forms and Collect Leads %s with Elementor Pro', 'elementor' ),
'<br />'
);
}
protected function get_content_lines(): array {
return [
esc_html__( 'Create single or multi-step forms to engage and convert visitors', 'elementor' ),
esc_html__( 'Use any field to collect the information you need', 'elementor' ),
esc_html__( 'Integrate your favorite marketing software*', 'elementor' ),
esc_html__( 'Collect lead submissions directly within your WordPress Admin to manage, analyze and perform bulk actions on the submitted lead*', 'elementor' ),
];
}
protected function get_cta_url():string {
return 'https://go.elementor.com/go-pro-submissions/';
}
protected function get_video_url():string {
return 'https://www.youtube-nocookie.com/embed/LNfnwba9C-8?si=JLHk3UAexnvTfU1a';
}
protected function get_side_note():string {
return esc_html__( '* Requires an Advanced subscription or higher', 'elementor' );
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use Elementor\Settings;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Go_Pro_Promotion_Item implements Admin_Menu_Item_With_Page {
const URL = 'https://go.elementor.com/pro-admin-menu/';
public function get_name() {
return 'admin_menu_promo';
}
public function is_visible() {
return true;
}
public function get_parent_slug() {
return Settings::PAGE_ID;
}
public function get_label() {
$upgrade_text = esc_html__( 'Upgrade', 'elementor' );
return apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_text' => $upgrade_text ] )['upgrade_text'] ?? $upgrade_text;
}
public function get_page_title() {
return '';
}
public function get_capability() {
return 'manage_options';
}
public static function get_url() {
$url = self::URL;
$filtered_url = apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_url' => $url ] )['upgrade_url'] ?? '';
$promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data( [ 'upgrade_url' => $filtered_url ], 'elementor/admin_menu/custom_promotion', 'upgrade_url' );
return $promotion_data ['upgrade_url'];
}
public function render() {
// Redirects from the module on `admin_init`.
die;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems\Interfaces;
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
interface Promotion_Menu_Item extends Admin_Menu_Item_With_Page {
public function get_image_url();
public function get_promotion_title();
public function render_promotion_description();
public function get_cta_text();
public function get_cta_url();
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Elementor\Modules\Promotions\AdminMenuItems;
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use Elementor\TemplateLibrary\Source_Local;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Popups_Promotion_Item extends Base_Promotion_Item {
private array $promotion_data;
public function __construct() {
$this->promotion_data = [
'title' => esc_html__( 'Get Popup Builder', 'elementor' ),
'content' => esc_html__(
'The Popup Builder lets you take advantage of all the amazing features in Elementor, so you can build beautiful & highly converting popups. Get Elementor Pro and start designing your popups today.',
'elementor'
),
'action_button' => [
'text' => esc_html__( 'Upgrade Now', 'elementor' ),
'url' => 'https://go.elementor.com/go-pro-popup-builder/',
],
];
$this->promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data( $this->promotion_data, 'elementor/templates/popup', 'action_button', 'url' );
}
public function get_parent_slug() {
return Source_Local::ADMIN_MENU_SLUG;
}
public function get_name() {
return 'popups';
}
public function get_label() {
return esc_html__( 'Popups', 'elementor' );
}
public function get_page_title() {
return esc_html__( 'Popups', 'elementor' );
}
public function get_promotion_title() {
return $this->promotion_data['title'];
}
public function get_promotion_description() {
return $this->promotion_data['content'];
}
/**
* @deprecated use get_promotion_description instead
* @return void
*/
public function render_promotion_description() {
echo $this->get_promotion_description(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
public function get_cta_url() {
return $this->promotion_data['action_button']['url'];
}
public function get_cta_text() {
return $this->promotion_data['action_button']['text'];
}
}