PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.1.4
ShopBuilder – WooCommerce Builder For Elementor v1.1.4
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Traits/ActionBtnTraits.php +126 -178 2.1.111.1.4 View file →
@@ -1,178 +1,126 @@
1 -<?php
2 -/**
3 - * Trait: Elementor Action Buttons.
4 - *
5 - * @package RadiusTheme\SB
6 - */
7 -
8 -namespace RadiusTheme\SB\Traits;
9 -
10 -use RadiusTheme\SB\Helpers\Fns;
11 -
12 -// Do not allow directly accessing this file.
13 -if ( ! defined( 'ABSPATH' ) ) {
14 - exit( 'This script cannot be accessed directly.' );
15 -}
16 -
17 -trait ActionBtnTraits {
18 -
19 - /**
20 - * Icon
21 - *
22 - * @return array
23 - */
24 - public function get_style_depends() {
25 - return [
26 - 'elementor-icons-fa-regular',
27 - 'elementor-icons-fa-solid',
28 - ];
29 -
30 - }
31 -
32 - /**
33 - * Wishlist icon
34 - *
35 - * @param string $icon_html Icon Html.
36 - *
37 - * @return string
38 - */
39 - public function wishlist_icon( $icon_html ) {
40 - $controllers = $this->get_settings_for_display();
41 -
42 - if ( ! empty( $controllers['wishlist_icon'] ) ) {
43 - $icon_html = Fns::icons_manager( $controllers['wishlist_icon'], 'icon-default' );
44 - $icon_html .= Fns::icons_manager( $controllers['wishlist_icon_added'], 'added-icon' );
45 - }
46 -
47 - return $icon_html;
48 - }
49 -
50 - /**
51 - * Compare icon
52 - *
53 - * @param string $icon_html Icon Html.
54 - *
55 - * @return string
56 - */
57 - public function compare_icon( $icon_html ) {
58 - $controllers = $this->get_settings_for_display();
59 - if ( ! empty( $controllers['comparison_icon'] ) ) {
60 - $icon_html = Fns::icons_manager( $controllers['comparison_icon'], 'icon-default' );
61 - $icon_html .= Fns::icons_manager( $controllers['comparison_icon_added'], 'added-icon' );
62 - }
63 -
64 - return $icon_html;
65 - }
66 -
67 - /**
68 - * Compare icon
69 - *
70 - * @param string $icon_html Icon Html.
71 - *
72 - * @return string
73 - */
74 - public function quick_view_icon( $icon_html ) {
75 - $controllers = $this->get_settings_for_display();
76 - if ( ! empty( $controllers['quick_view_icon'] ) ) {
77 - $icon_html = Fns::icons_manager( $controllers['quick_view_icon'], 'icon-default' );
78 - }
79 -
80 - return $icon_html;
81 - }
82 -
83 - /**
84 - * Icon Replace
85 - *
86 - * @return string
87 - */
88 - public function print_action_button( $position ) {
89 - $controllers = $this->get_settings_for_display();
90 -
91 - $wishlist_loop_btn_position = Fns::get_option( 'modules', 'wishlist', 'loop_btn_position', 'after_add_to_cart' );
92 - $compare_loop_btn_position = Fns::get_option( 'modules', 'compare', 'loop_btn_position', 'after_add_to_cart' );
93 - $quick_view_loop_btn_position = Fns::get_option( 'modules', 'quick_view', 'loop_btn_position', 'after_add_to_cart' );
94 - $action_button = [];
95 - global $product;
96 - if ( Fns::is_module_active( 'wishlist' ) && ! empty( $controllers['wishlist_button'] ) && $position == $wishlist_loop_btn_position ) {
97 - ob_start();
98 - do_action( 'rtsb/modules/wishlist/print_button', $product->get_id() );
99 - $action_button['wishlist'] = ob_get_clean();
100 - }
101 -
102 - if ( Fns::is_module_active( 'compare' ) && ! empty( $controllers['comparison_button'] ) && $position == $compare_loop_btn_position ) {
103 - ob_start();
104 - do_action( 'rtsb/modules/compare/print_button', $product->get_id() );
105 - $action_button['compare'] = ob_get_clean();
106 - }
107 -
108 - if ( Fns::is_module_active( 'quick_view' ) && ! empty( $controllers['quick_view_button'] ) && $position == $quick_view_loop_btn_position ) {
109 - ob_start();
110 - do_action( 'rtsb/modules/quick_view/print_button', $product->get_id() );
111 - $action_button['quick_view'] = ob_get_clean();
112 - }
113 -
114 - $action_button = apply_filters( 'rtsb/modules/actions/button/print_button', $action_button, $controllers, $position, $product );
115 -
116 - if( ! count( $action_button ) ){
117 - return ;
118 - }
119 -
120 - echo "<div class='action-button-wrapper'>";
121 - foreach ( $action_button as $index => $item ) {
122 - Fns::print_html( $item );
123 - }
124 - echo '</div>';
125 -
126 - }
127 -
128 - /**
129 - * @return void
130 - */
131 - public function before_add_to_cart() {
132 - $this->print_action_button( 'before_add_to_cart' );
133 - }
134 -
135 - /**
136 - * @return void
137 - */
138 - public function after_add_to_cart() {
139 - $this->print_action_button( 'after_add_to_cart' );
140 - }
141 -
142 - /**
143 - * Icon Replace
144 - *
145 - * @return void
146 - */
147 - public function action_button_icon_modify() {
148 - add_filter( 'rtsb/module/wishlist/icon_html', [ $this, 'wishlist_icon' ] );
149 - add_filter( 'rtsb/module/compare/icon_html', [ $this, 'compare_icon' ] );
150 - add_filter( 'rtsb/module/quick_view/icon_html', [ $this, 'quick_view_icon' ] );
151 - // add_filter( 'woocommerce_loop_add_to_cart_link', [ $this, 'print_action_button' ] );
152 - // before_add_to_cart
153 - // woocommerce_after_shop_loop_item
154 - add_action( 'woocommerce_after_shop_loop_item', [ $this, 'before_add_to_cart' ], 7 );
155 - // after_add_to_cart
156 - // woocommerce_after_shop_loop_item
157 - add_action( 'woocommerce_after_shop_loop_item', [ $this, 'after_add_to_cart' ], 15 );
158 - }
159 -
160 - /**
161 - * Icon set to default
162 - *
163 - * @return void
164 - */
165 - public function action_button_icon_set_default() {
166 - remove_filter( 'rtsb/module/wishlist/icon_html', [ $this, 'wishlist_icon' ] );
167 - remove_filter( 'rtsb/module/compare/icon_html', [ $this, 'compare_icon' ] );
168 - remove_filter( 'rtsb/module/quick_view/icon_html', [ $this, 'quick_view_icon' ] );
169 - // remove_filter( 'woocommerce_loop_add_to_cart_link', [ $this, 'print_action_button' ] );
170 - // woocommerce_before_shop_loop_item
171 - // before_add_to_cart
172 - remove_action( 'woocommerce_after_shop_loop_item', [ $this, 'before_add_to_cart' ], 7 );
173 - // woocommerce_after_shop_loop_item
174 - // after_add_to_cart
175 - remove_action( 'woocommerce_after_shop_loop_item', [ $this, 'after_add_to_cart' ], 15 );
176 - // woocommerce_after_shop_loop_item
177 - }
178 -}
1 +<?php
2 +/**
3 + * Trait: Elementor Action Buttons.
4 + *
5 + * @package RadiusTheme\SB
6 + */
7 +
8 +namespace RadiusTheme\SB\Traits;
9 +
10 +use RadiusTheme\SB\Helpers\Fns;
11 +
12 +// Do not allow directly accessing this file.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 'This script cannot be accessed directly.' );
15 +}
16 +
17 +trait ActionBtnTraits {
18 +
19 + /**
20 + * Icon
21 + *
22 + * @return array
23 + */
24 + public function get_style_depends() {
25 + return [
26 + 'elementor-icons-fa-regular',
27 + 'elementor-icons-fa-solid',
28 + ];
29 +
30 + }
31 +
32 + /**
33 + * Wishlist icon
34 + *
35 + * @param string $icon_html Icon Html.
36 + * @return string
37 + */
38 + public function wishlist_icon( $icon_html ) {
39 + $controllers = $this->get_settings_for_display();
40 +
41 + if ( ! empty( $controllers['wishlist_icon'] ) ) {
42 + $icon_html = Fns::icons_manager( $controllers['wishlist_icon'], 'icon-default' );
43 + $icon_html .= Fns::icons_manager( $controllers['wishlist_icon_added'], 'added-icon' );
44 + }
45 +
46 + return $icon_html;
47 + }
48 +
49 + /**
50 + * Compare icon
51 + *
52 + * @param string $icon_html Icon Html.
53 + * @return string
54 + */
55 + public function compare_icon( $icon_html ) {
56 + $controllers = $this->get_settings_for_display();
57 + if ( ! empty( $controllers['comparison_icon'] ) ) {
58 + $icon_html = Fns::icons_manager( $controllers['comparison_icon'], 'icon-default' );
59 + $icon_html .= Fns::icons_manager( $controllers['comparison_icon_added'], 'added-icon' );
60 + }
61 + return $icon_html;
62 + }
63 +
64 + /**
65 + * Compare icon
66 + *
67 + * @param string $icon_html Icon Html.
68 + * @return string
69 + */
70 + public function quick_view_icon( $icon_html ) {
71 + $controllers = $this->get_settings_for_display();
72 + if ( ! empty( $controllers['quick_view_icon'] ) ) {
73 + $icon_html = Fns::icons_manager( $controllers['quick_view_icon'], 'icon-default' );
74 + }
75 + return $icon_html;
76 + }
77 +
78 + /**
79 + * Icon Replace
80 + *
81 + * @return string
82 + */
83 + public function print_action_button( $link_html ) {
84 + $controllers = $this->get_settings_for_display();
85 + ob_start();
86 + global $product;
87 + echo "<div class='action-button-wrapper'>";
88 + if ( Fns::is_module_active('wishlist') && ! empty( $controllers['wishlist_button'] ) ) {
89 + do_action( 'rtsb/modules/wishlist/print_button', $product->get_id() );
90 + // do_action('rtsb/modules/wishlist/frontend/display' );
91 + }
92 + if ( Fns::is_module_active('compare') && ! empty( $controllers['comparison_button'] ) ) {
93 + do_action( 'rtsb/modules/compare/print_button', $product->get_id() );
94 + // do_action('rtsb/modules/compare/frontend/display' );
95 + }
96 + if ( Fns::is_module_active('quick_view') && ! empty( $controllers['quick_view_button'] ) ) {
97 + do_action( 'rtsb/modules/quick_view/print_button', $product->get_id() );
98 + // do_action('rtsb/modules/quick_view/frontend/display' );
99 + }
100 + echo "</div>";
101 + return $link_html. ob_get_clean();
102 + }
103 + /**
104 + * Icon Replace
105 + *
106 + * @return void
107 + */
108 + public function action_button_icon_modify() {
109 + add_filter( 'rtsb/module/wishlist/icon_html', [ $this, 'wishlist_icon' ] );
110 + add_filter( 'rtsb/module/compare/icon_html', [ $this, 'compare_icon' ] );
111 + add_filter( 'rtsb/module/quick_view/icon_html', [ $this, 'quick_view_icon' ] );
112 + add_filter( 'woocommerce_loop_add_to_cart_link', [ $this, 'print_action_button' ] );
113 + }
114 +
115 + /**
116 + * Icon set to default
117 + *
118 + * @return void
119 + */
120 + public function action_button_icon_set_default() {
121 + remove_filter( 'rtsb/module/wishlist/icon_html', [ $this, 'wishlist_icon' ] );
122 + remove_filter( 'rtsb/module/compare/icon_html', [ $this, 'compare_icon' ] );
123 + remove_filter( 'rtsb/module/quick_view/icon_html', [ $this, 'quick_view_icon' ] );
124 + remove_filter( 'woocommerce_loop_add_to_cart_link', [ $this, 'print_action_button' ] );
125 + }
126 +}