Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wpessential committed Nov 21, 2023
1 parent 4d5cbc9 commit 82fe76c
Show file tree
Hide file tree
Showing 9 changed files with 692 additions and 79 deletions.
556 changes: 556 additions & 0 deletions inc/Builders/Elementor/Controls/Group/GroupQuery.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inc/Builders/Elementor/Helper/SetDynamicBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait SetDynamicBase

public function set_name ()
{
return 'WPEssential' . substr( strrchr( get_class( $this ), "\\" ), 1 );
return 'WPEssential' . substr( strrchr( \get_class( $this ), "\\" ), 1 );
}

public function set_title ()
Expand Down
45 changes: 5 additions & 40 deletions inc/Builders/Elementor/Shortcodes/WPEssential/Heading.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
}

use Elementor\Controls_Manager;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Typography;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Utility\Base;
use WPEssential\Plugins\Builders\Fields\Choose;
use WPEssential\Plugins\Builders\Fields\Color;
use WPEssential\Plugins\Builders\Fields\CommonTypography;
use WPEssential\Plugins\Builders\Fields\PopoverToggle;
use WPEssential\Plugins\Builders\Fields\Select;
use WPEssential\Plugins\Builders\Fields\Textarea;
use WPEssential\Plugins\Builders\Fields\Typography;
use WPEssential\Plugins\Builders\Fields\Url;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Utility\Base;
use WPEssential\Plugins\Implement\Shortcodes;

class Heading extends Base implements Shortcodes
Expand Down Expand Up @@ -117,50 +113,19 @@ public function register_controls ()
]
);

$opt = Color::make( __( 'Text Color', 'wpessential' ) );
$opt->wrap_selectors( [ '.wpe-heading-title, .wpe-heading-title > a' => 'color: {{VALUE}};' ] );
$this->add_control( $opt->key, $opt->toArray() );

$opt = PopoverToggle::make( __( 'Typography', 'wpessential' ) );
$opt->global( true );
$this->add_control( $opt->key, $opt->toArray() );

$this->start_popover();

$opts = CommonTypography::make( __( 'typography', 'wpessential' ) );
$opts->common_key( 'typography' );
$opts->typography();
$opts = Typography::make();
$opts->wrap_selector( '.wpe-heading-title' );
$opts = $opts->typography();
foreach ( $opts as $opt ) {
wpe_error( $opt->toArray() );
$this->add_control( $opt->key, $opt->toArray() );
}

$this->end_popover();

$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'typography',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
],
'selector' => '{{WRAPPER}} .wpe-heading-title',
]
);

$this->add_group_control(
Group_Control_Text_Shadow::get_type(),
[
'name' => 'text_shadow',
'selector' => '{{WRAPPER}} .wpe-heading-title',
]
);

$opt = Select::make( __( 'Blend Mode', 'wpessential' ) );
$opts->options( wpe_blend_mode() );
$opts->wrap_selectors( [ '.wpe-heading-title' => 'mix-blend-mode: {{VALUE}}' ] );
$this->add_control( $opt->key, $opt->toArray() );

$this->end_controls_section();
}

Expand Down
18 changes: 9 additions & 9 deletions inc/Builders/Elementor/Shortcodes/Widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@
exit; // Exit if accessed directly.
}

use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\BlogPost\Post;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\CalderaForm;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\ContactForm7;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\FormidableForm;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\Mc4Wp;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\NinjaForm;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\Forms\WPForm;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\Cart;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\Categories;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\MyAccount;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\OrderTrack;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\ProductAddToCart;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\ProductCategories;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\Products;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce\ProductSingle;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WPEssential\Heading;
use WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WPEssential\Image;
use WPEssential\Plugins\Implement\ShortcodeInit;
use WPEssential\Plugins\Loader;

Expand Down Expand Up @@ -104,11 +103,12 @@ private static function woo_widget ()
return;
}

self::$list[ 'Cart' ] = Cart::class;
self::$list[ 'Categories' ] = Categories::class;
self::$list[ 'MyAccount' ] = MyAccount::class;
self::$list[ 'OrderTrack' ] = OrderTrack::class;
self::$list[ 'Products' ] = Products::class;
self::$list[ 'ProductSingle' ] = ProductSingle::class;
self::$list[ 'Cart' ] = Cart::class;
self::$list[ 'MyAccount' ] = MyAccount::class;
self::$list[ 'OrderTrack' ] = OrderTrack::class;
self::$list[ 'ProductAddToCart' ] = ProductAddToCart::class;
self::$list[ 'ProductCategories' ] = ProductCategories::class;
self::$list[ 'ProductSingle' ] = ProductSingle::class;
self::$list[ 'Products' ] = Products::class;
}
}
102 changes: 102 additions & 0 deletions inc/Builders/Elementor/Shortcodes/WooCommerce/ProductAddToCart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace WPEssential\Plugins\ElementorBlocks\Builders\Elementor\Shortcodes\WooCommerce;

if ( ! \defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

use Elementor\Controls_Manager;
use WPEssential\Plugins\Builders\Fields\RawHtml;

class ProductAddToCart extends WCCategory
{
/**
* Set widget keywords.
* Retrieve widget keywords.
*
* @return array Widget keywords.
* @access public
* @since 1.0.0
* @public
*/
public function set_keywords ()
{
return [ 'woocommerce', 'shop', 'store', 'cart', 'product', 'button', 'add to cart' ];
}

/**
* Register widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
* @access public
*/
public function register_controls ()
{
$this->start_controls_section(
'section_1',
[
'label' => __( 'Layout', 'wpessential' )
]
);

$this->add_control(
'product_id',
[
'label' => esc_html__( 'Product', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => wpe_get_posts( [ 'post_type' => 'product', 'posts_per_page' => - 1 ] ),
]
);

$this->end_controls_section();

$this->start_controls_section(
'section_pro_wc',
[
'label' => __( 'Pro', 'wpessential' )
]
);

$opt = RawHtml::make( __( 'WooCommerce', 'wpessential' ) )
->data( __( 'There are no option found. If you want more options, then please try the Pro version.', 'wpessential' ), )
->toArray();
$this->add_control( $opt[ 'id' ], $opt );

$this->end_controls_section();

}

/**
* Render widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
* @access public
*/
public function render ()
{
global $product;

if ( ! is_product() ) {
global $post;
$product = wc_get_product( $this->get_settings( 'product_id' ) );
$post = get_post( $product->get_id() );
}
else {
$product = wc_get_product();
}

if ( empty( $product ) ) {
return;
}
?>
<div class="wpe-add-to-cart wpe-product-<?php echo esc_attr( $product->get_type() ); ?>">
<?php woocommerce_template_single_add_to_cart(); ?>
</div>
<?php
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use WPEssential\Plugins\Builders\Fields\RawHtml;

class Categories extends WCCategory
class ProductCategories extends WCCategory
{
/**
* Set widget keywords.
Expand All @@ -21,7 +21,7 @@ class Categories extends WCCategory
*/
public function set_keywords ()
{
return [ 'categories', 'woocommerce categories', 'woocommerce' ];
return [ 'woocommerce-elements', 'shop', 'store', 'categories', 'product' ];
}

/**
Expand All @@ -42,7 +42,7 @@ public function register_controls ()
);

$opt = RawHtml::make( __( 'WooCommerce', 'wpessential' ) )
->data( __( 'There is no option found.', 'wpessential' ), )
->data( __( 'There are no option found. If you want more options, then please try the Pro version.', 'wpessential' ), )
->toArray();
$this->add_control( $opt[ 'id' ], $opt );

Expand All @@ -60,11 +60,6 @@ public function register_controls ()
*/
public function render ()
{
$settings = $this->get_settings_for_display();
/*$settings[ 'wpe_st_post_info_data_list' ] = urlencode( json_encode( $settings[ 'wpe_st_post_info_data_list' ] ) );
$settings[ 'wpe_st_post_button_icon' ] = urlencode( json_encode( $settings[ 'wpe_st_post_button_icon' ] ) );*/
//wpe_error( $settings );
$settings = wpe_collect( $settings );
echo do_shortcode( "[product_categories]" );
}
}
12 changes: 8 additions & 4 deletions inc/Builders/Elementor/Utility/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,23 @@ public static function register_categories ( $elements_manager )
$categories = apply_filters(
'wpe/elementor/categories',
[
'wpessential' => [
'wpessential' => [
'title' => __( 'WPEssential', 'wpessential' ),
'icon' => 'wpe-icons wpe',
],
'wpessential-wc' => [
'wpessential-wc' => [
'title' => __( 'WPEssential WC', 'wpessential' ),
'icon' => 'wpe-icons wpe',
],
'wpessential-form' => [
'wpessential-wc-archive' => [
'title' => __( 'WPEssential WC Archive', 'wpessential' ),
'icon' => 'wpe-icons wpe',
],
'wpessential-form' => [
'title' => __( 'WPEssential Form', 'wpessential' ),
'icon' => 'wpe-icons wpe',
],
'wpessential-slider' => [
'wpessential-slider' => [
'title' => __( 'WPEssential Slider', 'wpessential' ),
'icon' => 'wpe-icons wpe',
]
Expand Down
4 changes: 2 additions & 2 deletions inc/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public static function init ()

public static function constructor ()
{

do_action( 'wpessential_el_blocks_loaded' );
self::load_files();
self::start();
add_action( 'wpessential_init', [ __CLASS__, 'init' ] );
add_action( 'wpessential_init', [ __CLASS__, 'init' ], 100 );
}

public static function load_files ()
Expand Down
21 changes: 6 additions & 15 deletions wpessential-elementor-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,16 @@
* Author: WPEssential
* Version: 1.0.0
* Author URI: https://wpessential.org/
* Text Domain: wpessential-pro
* Requires PHP: 8.0
* Text Domain: wpessential-elementor-blocks
* Requires PHP: 7.4
* Requires at least: 5.0
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Domain Path: /languages/
*/

require_once plugin_dir_path( __FILE__ ) . 'constants.php';
require WPEELBLOCK_DIR . 'vendor/autoload.php';

/**
* Fire on 'wpessential_loaded'
*
* @since 1.0.0
*/
function wpe_elementor_blocks_plugin_loaded_action ()
{
add_action( 'wpessential_loaded', function () {
require_once plugin_dir_path( __FILE__ ) . 'constants.php';
require_once WPEELBLOCK_DIR . 'vendor/autoload.php';
\WPEssential\Plugins\ElementorBlocks\Loader::constructor();
}

add_action( 'wpessential_loaded', 'wpe_elementor_blocks_plugin_loaded_action', 20 );
}, 20 );

0 comments on commit 82fe76c

Please sign in to comment.