PluginProbe ʕ •ᴥ•ʔ
Royal Addons for Elementor – Addons and Templates Kit for Elementor / 1.7.1064
Royal Addons for Elementor – Addons and Templates Kit for Elementor v1.7.1064
1.7.1064 1.7.1063 1.7.1062 1.7.1061 1.7.1060 1.7.1059 1.7.1058 trunk 1.0.0 1.1.0 1.2 1.3 1.3.1 1.3.2 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.40 1.3.41 1.3.42 1.3.43 1.3.44 1.3.45 1.3.46 1.3.47 1.3.48 1.3.49 1.3.50 1.3.51 1.3.52 1.3.53 1.3.54 1.3.55 1.3.56 1.3.57 1.3.58 1.3.59 1.3.60 1.3.61 1.3.62 1.3.63 1.3.64 1.3.65 1.3.66 1.3.67 1.3.68 1.3.69 1.3.70 1.3.71 1.3.72 1.3.73 1.3.74 1.3.75 1.3.76 1.3.77 1.3.78 1.3.79 1.3.80 1.3.81 1.3.82 1.3.83 1.3.84 1.3.85 1.3.86 1.3.87 1.3.88 1.3.89 1.3.90 1.3.91 1.3.92 1.3.93 1.3.94 1.3.95 1.3.96 1.3.97 1.3.971 1.3.972 1.3.973 1.3.974 1.3.975 1.3.976 1.3.977 1.3.978 1.3.979 1.3.980 1.3.981 1.3.982 1.3.983 1.3.984 1.3.985 1.3.986 1.3.987 1.7.1 1.7.1001 1.7.1002 1.7.1003 1.7.1004 1.7.1005 1.7.1006 1.7.1007 1.7.1008 1.7.1009 1.7.1010 1.7.1011 1.7.1012 1.7.1013 1.7.1014 1.7.1015 1.7.1016 1.7.1017 1.7.1018 1.7.1019 1.7.1020 1.7.1021 1.7.1022 1.7.1023 1.7.1024 1.7.1025 1.7.1026 1.7.1027 1.7.1028 1.7.1029 1.7.1030 1.7.1031 1.7.1032 1.7.1033 1.7.1034 1.7.1035 1.7.1036 1.7.1037 1.7.1038 1.7.1039 1.7.1040 1.7.1041 1.7.1042 1.7.1043 1.7.1044 1.7.1045 1.7.1046 1.7.1047 1.7.1048 1.7.1049 1.7.1050 1.7.1051 1.7.1052 1.7.1053 1.7.1054 1.7.1055 1.7.1056 1.7.1057
royal-elementor-addons / admin / includes / wpr-templates-loop.php
royal-elementor-addons / admin / includes Last commit date
wpr-conditions-manager.php 5 days ago wpr-editor-hooks.php 5 days ago wpr-render-templates.php 5 days ago wpr-templates-actions.php 5 days ago wpr-templates-category-filter.php 5 days ago wpr-templates-library.php 5 days ago wpr-templates-loop.php 5 days ago wpr-templates-modal-popups.php 5 days ago wpr-templates-shortcode.php 5 days ago
wpr-templates-loop.php
552 lines
1 <?php
2
3 namespace WprAddons\Admin\Includes;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use WprAddons\Classes\Utilities;
10
11 /**
12 ** WPR_Templates_Loop setup
13 */
14 class WPR_Templates_Loop {
15
16 /**
17 ** Loop Through Custom Templates
18 */
19 public static function render_theme_builder_templates( $template ) {
20 // WP_Query arguments
21 $args = array (
22 'post_type' => array( 'wpr_templates' ),
23 'post_status' => array( 'publish' ),
24 'posts_per_page' => -1,
25 'tax_query' => array(
26 array(
27 'taxonomy' => 'wpr_template_type',
28 'field' => 'slug',
29 'terms' => [ $template, 'user' ],
30 'operator' => 'AND'
31 )
32 )
33 );
34
35 // The Query
36 $user_templates = get_posts( $args );
37
38 // The Loop
39 echo '<ul class="wpr-'. esc_attr($template) .'-templates-list wpr-my-templates-list" data-pro="'. esc_attr(defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code()) .'">';
40
41 if ( ! empty( $user_templates ) ) {
42 foreach ( $user_templates as $user_template ) {
43 $slug = $user_template->post_name;
44
45 if ( !str_contains( $slug, 'user-' ) ) {
46 continue;
47 }
48
49 $edit_url = str_replace( 'edit', 'elementor', get_edit_post_link( $user_template->ID ) );
50 $show_on_canvas = get_post_meta(Utilities::get_template_id($slug), 'wpr_'. $template .'_show_on_canvas', true);
51
52 echo '<li>';
53 echo '<h3 class="wpr-title">'. esc_html($user_template->post_title) .'</h3>';
54
55 echo '<div class="wpr-action-buttons">';
56 // Activate
57 echo '<span class="wpr-template-conditions button button-primary" data-slug="'. esc_attr($slug) .'" data-show-on-canvas="'. esc_attr($show_on_canvas) .'">'. esc_html__( 'Manage Conditions', 'wpr-addons' ) .'</span>';
58 // Edit
59 echo '<a href="'. esc_url($edit_url) .'" class="wpr-edit-template button button-primary">'. esc_html__( 'Edit Template', 'wpr-addons' ) .'</a>';
60
61 // Delete
62 $one_time_nonce = wp_create_nonce( 'delete_post-' . $slug );
63
64 echo '<span class="wpr-delete-template button button-primary" data-nonce="'. esc_attr($one_time_nonce) .'" data-slug="'. esc_attr($slug) .'" data-warning="'. esc_html__( 'Are you sure you want to delete this template?', 'wpr-addons' ) .'"><span class="dashicons dashicons-no-alt"></span></span>';
65
66
67 echo '</div>';
68 echo '</li>';
69 }
70 } else {
71 echo '<li class="wpr-no-templates">You don\'t have any templates yet!</li>';
72 }
73
74 echo '</ul>';
75
76 // Restore original Post Data
77 wp_reset_postdata();
78
79 }
80
81 /**
82 ** Loop Through My Templates
83 */
84 public static function render_elementor_saved_templates() {
85
86 // WP_Query arguments
87 $args = array (
88 'post_type' => array( 'elementor_library' ),
89 'post_status' => array( 'publish' ),
90 'meta_key' => '_elementor_template_type',
91 'meta_value' => ['page', 'section'],
92 'numberposts' => -1
93 );
94
95 // The Query
96 $user_templates = get_posts( $args );
97
98 // My Templates List
99 echo '<ul class="wpr-my-templates-list striped">';
100
101 // The Loop
102 if ( ! empty( $user_templates ) ) {
103 foreach ( $user_templates as $user_template ) {
104 // Edit URL
105 $edit_url = str_replace( 'edit', 'elementor', get_edit_post_link( $user_template->ID ) );
106
107 // List
108 echo '<li>';
109 echo '<h3 class="wpr-title">'. esc_html($user_template->post_title) .'</h3>';
110
111 echo '<span class="wpr-action-buttons">';
112 echo '<a href="'. esc_url($edit_url) .'" class="wpr-edit-template button button-primary">'. esc_html__( 'Edit', 'wpr-addons' ) .'</a>';
113 echo '<span class="wpr-delete-template button button-primary" data-slug="'. esc_attr($user_template->post_name) .'" data-warning="'. esc_html__( 'Are you sure you want to delete this template?', 'wpr-addons' ) .'"><span class="dashicons dashicons-no-alt"></span></span>';
114 echo '</span>';
115 echo '</li>';
116 }
117 } else {
118 echo '<li class="wpr-no-templates">You don\'t have any templates yet!</li>';
119 }
120
121 echo '</ul>';
122
123 // Restore original Post Data
124 wp_reset_postdata();
125 }
126
127 /**
128 ** Render Conditions Popup
129 */
130 public static function render_conditions_popup( $canvas = false ) {
131
132 // Active Tab
133 $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'wpr_tab_header';
134
135 ?>
136
137 <div class="wpr-condition-popup-wrap wpr-admin-popup-wrap">
138 <div class="wpr-condition-popup wpr-admin-popup">
139 <header>
140 <h2><?php esc_html_e( 'Where Do You Want to Display Your Template?', 'wpr-addons' ); ?></h2>
141 <p>
142 <?php esc_html_e( 'Set the conditions that determine where your Template is used throughout your site.', 'wpr-addons' ); ?><br>
143 <?php esc_html_e( 'For example, choose \'Entire Site\' to display the template across your site.', 'wpr-addons' ); ?>
144 </p>
145 </header>
146 <span class="close-popup dashicons dashicons-no-alt"></span>
147
148 <!-- Conditions -->
149 <div class="wpr-conditions-wrap">
150 <div class="wpr-conditions-sample">
151 <?php if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() ) : ?>
152 <!-- Global -->
153 <select name="global_condition_select" class="global-condition-select">
154 <option value="global"><?php esc_html_e( 'Entire Site', 'wpr-addons' ); ?></option>
155 <option value="archive"><?php esc_html_e( 'Archives', 'wpr-addons' ); ?></option>
156 <option value="single"><?php esc_html_e( 'Singular', 'wpr-addons' ); ?></option>
157 </select>
158
159 <!-- Archive -->
160 <select name="archives_condition_select" class="archives-condition-select">
161 <?php if ( 'wpr_tab_header' === $active_tab || 'wpr_tab_footer' === $active_tab ) : ?>
162 <optgroup label="<?php esc_html_e( 'Archives', 'wpr-addons' ); ?>">
163 <option value="all_archives"><?php esc_html_e( 'All Archives', 'wpr-addons' ); ?></option>
164 <option value="posts"><?php esc_html_e( 'Posts Archive', 'wpr-addons' ); ?></option>
165 <?php // Custom Post Types
166 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
167 foreach ($custom_post_types as $key => $value) {
168 if ( 'e-landing-page' === $key ) {
169 continue;
170 }
171
172 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) || 'product' === $key ) {
173 echo '<option value="'. esc_attr($key) .'">'. esc_html($value) .' '. esc_html__( 'Archive', 'wpr-addons' ) .'</option>';
174 } else {
175 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'">'. esc_html($value) .' '. esc_html__( 'Archive (Expert)', 'wpr-addons' ) .'</option>';
176 }
177 }
178 ?>
179 <option value="author"><?php esc_html_e( 'Author Archive', 'wpr-addons' ); ?></option>
180 <option value="date"><?php esc_html_e( 'Date Archive', 'wpr-addons' ); ?></option>
181 <option value="search"><?php esc_html_e( 'Search Results', 'wpr-addons' ); ?></option>
182 </optgroup>
183
184 <optgroup label="<?php esc_html_e( 'Taxonomy Archives', 'wpr-addons' ); ?>">
185 <option value="categories" class="custom-ids"><?php esc_html_e( 'Post Categories', 'wpr-addons' ); ?></option>
186 <option value="tags" class="custom-ids"><?php esc_html_e( 'Post Tags', 'wpr-addons' ); ?></option>
187 <?php // Custom Taxonomies
188 $custom_taxonomies = Utilities::get_custom_types_of( 'tax', true );
189 foreach ($custom_taxonomies as $key => $value) {
190 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) || 'product_cat' === $key || 'product_tag' === $key ) {
191 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .'</option>';
192 } else {
193 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
194 }
195 }
196 ?>
197 </optgroup>
198 <?php else: ?>
199 <?php if ( 'wpr_tab_archive' === $active_tab ) : ?>
200 <optgroup label="<?php esc_html_e( 'Archives', 'wpr-addons' ); ?>">
201 <option value="all_archives"><?php esc_html_e( 'All Archives', 'wpr-addons' ); ?></option>
202 <option value="posts"><?php esc_html_e( 'Posts Archive', 'wpr-addons' ); ?></option>
203
204 <?php // Custom Post Types
205 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
206 foreach ($custom_post_types as $key => $value) {
207 if ( 'product' === $key || 'e-landing-page' === $key ) {
208 continue;
209 }
210
211 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) ) {
212 echo '<option value="'. esc_attr($key) .'">'. esc_html($value) .' '. esc_html__( 'Archive', 'wpr-addons' ) .'</option>';
213 } else {
214 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'">'. esc_html($value) .' '. esc_html__( 'Archive (Expert)', 'wpr-addons' ) .'</option>';
215 }
216 }
217 ?>
218
219 <option value="author"><?php esc_html_e( 'Author Archive', 'wpr-addons' ); ?></option>
220 <option value="date"><?php esc_html_e( 'Date Archive', 'wpr-addons' ); ?></option>
221 <option value="search"><?php esc_html_e( 'Search Results', 'wpr-addons' ); ?></option>
222 </optgroup>
223
224 <optgroup label="<?php esc_html_e( 'Taxonomy Archives', 'wpr-addons' ); ?>">
225 <option value="categories" class="custom-ids"><?php esc_html_e( 'Post Categories', 'wpr-addons' ); ?></option>
226 <option value="tags" class="custom-ids"><?php esc_html_e( 'Post Tags', 'wpr-addons' ); ?></option>
227 <?php // Custom Taxonomies
228 $custom_taxonomies = Utilities::get_custom_types_of( 'tax', true );
229 foreach ($custom_taxonomies as $key => $value) {
230 if ( 'product_cat' === $key || 'product_tag' === $key ) {
231 continue;
232 }
233
234 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) ) {
235 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .'</option>';
236 } else {
237 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
238 }
239 }
240 ?>
241 </optgroup>
242 <?php elseif ( 'wpr_tab_product_archive' === $active_tab ): ?>
243 <option value="products"><?php esc_html_e( 'Products Archive', 'wpr-addons' ); ?></option>
244 <option value="product_cat" class="custom-type-ids"><?php esc_html_e( 'Products Categories', 'wpr-addons' ); ?></option>
245 <option value="product_tag" class="custom-type-ids"><?php esc_html_e( 'Products Tags', 'wpr-addons' ); ?></option>
246 <option value="product_search"><?php esc_html_e( 'Products Search', 'wpr-addons' ); ?></option>
247 <?php endif; ?>
248 <?php endif; ?>
249 </select>
250
251 <!-- Single -->
252 <select name="singles_condition_select" class="singles-condition-select">
253 <?php if ( 'wpr_tab_header' === $active_tab || 'wpr_tab_footer' === $active_tab ) : ?>
254 <option value="front_page"><?php esc_html_e( 'Front Page', 'wpr-addons' ); ?></option>
255 <option value="page_404"><?php esc_html_e( '404 Page', 'wpr-addons' ); ?></option>
256 <option value="pages" class="custom-ids"><?php esc_html_e( 'Pages', 'wpr-addons' ); ?></option>
257 <option value="posts" class="custom-ids"><?php esc_html_e( 'Posts', 'wpr-addons' ); ?></option>
258 <?php // Custom Post Types
259 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
260 foreach ($custom_post_types as $key => $value) {
261 if ( 'e-landing-page' === $key ) {
262 continue;
263 }
264
265 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) || 'product' === $key ) {
266 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .'</option>';
267 } else {
268 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
269 }
270 }
271 ?>
272 <?php else: ?>
273 <?php if ( 'wpr_tab_single' === $active_tab ) : ?>
274 <option value="front_page"><?php esc_html_e( 'Front Page', 'wpr-addons' ); ?></option>
275 <option value="page_404"><?php esc_html_e( '404 Page', 'wpr-addons' ); ?></option>
276 <option value="pages" class="custom-ids"><?php esc_html_e( 'Pages', 'wpr-addons' ); ?></option>
277 <option value="posts" class="custom-ids"><?php esc_html_e( 'Posts', 'wpr-addons' ); ?></option>
278
279 <?php // Custom Post Types
280 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
281 foreach ($custom_post_types as $key => $value) {
282 if ( 'product' === $key || 'e-landing-page' === $key ) {
283 continue;
284 }
285
286 if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->is_plan( 'expert' ) ) {
287 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .'</option>';
288 } else {
289 echo '<option value="pro-'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
290 }
291 }
292 ?>
293 <?php elseif ( 'wpr_tab_product_single' === $active_tab ): ?>
294 <option value="product" class="custom-product-ids custom-type-ids"><?php esc_html_e( 'Products', 'wpr-addons' ); ?></option>
295 <?php endif; ?>
296 <?php endif; ?>
297 </select>
298
299 <input type="text" placeholder="<?php esc_html_e( 'Enter comma separated IDs', 'wpr-addons' ); ?>" name="condition_input_ids" class="wpr-condition-input-ids">
300 <span class="wpr-delete-template-conditions dashicons dashicons-no-alt"></span>
301
302 <?php else: // Free user conditions ?>
303
304 <!-- Global -->
305 <select name="global_condition_select" class="global-condition-select">
306 <option value="global"><?php esc_html_e( 'Entire Site', 'wpr-addons' ); ?></option>
307 <option value="archive"><?php esc_html_e( 'Archives (Pro)', 'wpr-addons' ); ?></option>
308 <option value="single"><?php esc_html_e( 'Singular (Pro)', 'wpr-addons' ); ?></option>
309 </select>
310
311 <!-- Archive -->
312 <select name="archives_condition_select" class="archives-condition-select">
313 <?php if ( 'wpr_tab_header' === $active_tab || 'wpr_tab_footer' === $active_tab ) : ?>
314 <optgroup label="<?php esc_html_e( 'Archives', 'wpr-addons' ); ?>">
315 <option value="all_archives"><?php esc_html_e( 'All Archives (Pro)', 'wpr-addons' ); ?></option>
316 <option value="posts"><?php esc_html_e( 'Posts Archive (Pro)', 'wpr-addons' ); ?></option>
317 <option value="author"><?php esc_html_e( 'Author Archive (Pro)', 'wpr-addons' ); ?></option>
318 <option value="date"><?php esc_html_e( 'Date Archive (Pro)', 'wpr-addons' ); ?></option>
319 <option value="search"><?php esc_html_e( 'Search Results (Pro)', 'wpr-addons' ); ?></option>
320 <option value="categories" class="custom-ids"><?php esc_html_e( 'Post Categories (Pro)', 'wpr-addons' ); ?></option>
321 <option value="tags" class="custom-ids"><?php esc_html_e( 'Post Tags (Pro)', 'wpr-addons' ); ?></option>
322 </optgroup>
323 <optgroup label="<?php esc_html_e( 'WooCommerce Archives', 'wpr-addons' ); ?>">
324 <option value="products" class="custom-ids"><?php esc_html_e( 'Products Archive (Pro)', 'wpr-addons' ); ?></option>
325 <option value="products_cats" class="custom-ids"><?php esc_html_e( 'Product Categories (Pro)', 'wpr-addons' ); ?></option>
326 <option value="product_tags" class="custom-ids"><?php esc_html_e( 'Product Tags (Pro)', 'wpr-addons' ); ?></option>
327 </optgroup>
328 <optgroup label="<?php esc_html_e( 'Custom Post Type Archives', 'wpr-addons' ); ?>">
329 <?php // Custom Post Types
330 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
331 foreach ($custom_post_types as $key => $value) {
332 if ( 'product' === $key || 'e-landing-page' === $key ) {
333 continue;
334 }
335
336 echo '<option value="'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
337 }
338 ?>
339 <?php // Custom Taxonomies
340 $custom_taxonomies = Utilities::get_custom_types_of( 'tax', true );
341 foreach ($custom_taxonomies as $key => $value) {
342 if ( 'product_cat' === $key || 'product_tag' === $key ) {
343 continue;
344 }
345
346 // List Taxonomies
347 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
348 }
349 ?>
350 </optgroup>
351 <?php else: ?>
352 <?php if ( 'wpr_tab_archive' === $active_tab ) : ?>
353 <optgroup label="<?php esc_html_e( 'Archives', 'wpr-addons' ); ?>">
354 <option value="all_archives"><?php esc_html_e( 'All Archives', 'wpr-addons' ); ?></option>
355 <option value="posts"><?php esc_html_e( 'Posts Archive', 'wpr-addons' ); ?></option>
356 <option value="author"><?php esc_html_e( 'Author Archive', 'wpr-addons' ); ?></option>
357 <option value="date"><?php esc_html_e( 'Date Archive', 'wpr-addons' ); ?></option>
358 <option value="search"><?php esc_html_e( 'Search Results', 'wpr-addons' ); ?></option>
359 <option value="categories" class="custom-ids"><?php esc_html_e( 'Post Categories', 'wpr-addons' ); ?></option>
360 <option value="tags" class="custom-ids"><?php esc_html_e( 'Post Tags', 'wpr-addons' ); ?></option>
361 </optgroup>
362 <optgroup label="<?php esc_html_e( 'Custom Post Type Archives', 'wpr-addons' ); ?>">
363 <?php // Custom Post Types
364 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
365 foreach ($custom_post_types as $key => $value) {
366 if ( 'product' === $key || 'e-landing-page' === $key ) {
367 continue;
368 }
369
370 echo '<option value="'. esc_attr(substr($key, 0, 3)) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
371 }
372 ?>
373 <?php // Custom Taxonomies
374 $custom_taxonomies = Utilities::get_custom_types_of( 'tax', true );
375 foreach ($custom_taxonomies as $key => $value) {
376 if ( 'product_cat' === $key || 'product_tag' === $key ) {
377 continue;
378 }
379
380 // List Taxonomies
381 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
382 }
383 ?>
384 </optgroup>
385 <?php elseif ( 'wpr_tab_product_archive' === $active_tab ): ?>
386 <option value="products"><?php esc_html_e( 'Products Archive', 'wpr-addons' ); ?></option>
387 <option value="product_cat" class="custom-type-ids"><?php esc_html_e( 'Products Categories (Pro)', 'wpr-addons' ); ?></option>
388 <option value="product_tag" class="custom-type-ids"><?php esc_html_e( 'Products Tags (Pro)', 'wpr-addons' ); ?></option>
389 <option value="product_search"><?php esc_html_e( 'Products Search (Pro)', 'wpr-addons' ); ?></option>
390 <?php endif; ?>
391 <?php endif; ?>
392 </select>
393
394 <!-- Single -->
395 <select name="singles_condition_select" class="singles-condition-select">
396 <?php if ( 'wpr_tab_header' === $active_tab || 'wpr_tab_footer' === $active_tab ) : ?>
397 <option value="front_page"><?php esc_html_e( 'Front Page (Pro)', 'wpr-addons' ); ?></option>
398 <option value="page_404"><?php esc_html_e( '404 Page (Pro)', 'wpr-addons' ); ?></option>
399 <option value="pages" class="custom-ids"><?php esc_html_e( 'Pages (Pro)', 'wpr-addons' ); ?></option>
400 <option value="posts" class="custom-ids"><?php esc_html_e( 'Posts (Pro)', 'wpr-addons' ); ?></option>
401 <option value="product" class="custom-ids"><?php esc_html_e( 'Product (Pro)', 'wpr-addons' ); ?></option>
402 <?php // Custom Post Types
403 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
404 foreach ($custom_post_types as $key => $value) {
405 if ( 'product' === $key || 'e-landing-page' === $key ) {
406 continue;
407 }
408
409 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
410 }
411 ?>
412 <?php else: ?>
413 <?php if ( 'wpr_tab_single' === $active_tab ) : ?>
414 <option value="front_page"><?php esc_html_e( 'Front Page', 'wpr-addons' ); ?></option>
415 <option value="page_404"><?php esc_html_e( '404 Page', 'wpr-addons' ); ?></option>
416 <option value="pages" class="custom-ids"><?php esc_html_e( 'Pages', 'wpr-addons' ); ?></option>
417 <option value="posts" class="custom-ids"><?php esc_html_e( 'Posts', 'wpr-addons' ); ?></option>
418
419 <?php // Custom Post Types
420 $custom_post_types = Utilities::get_custom_types_of( 'post', true );
421 foreach ($custom_post_types as $key => $value) {
422 if ( 'product' === $key || 'e-landing-page' === $key ) {
423 continue;
424 }
425
426 echo '<option value="'. esc_attr($key) .'" class="custom-type-ids">'. esc_html($value) .' (Expert)</option>';
427 }
428 ?>
429 <?php elseif ( 'wpr_tab_product_single' === $active_tab ): ?>
430 <option value="product" class="custom-type-ids"><?php esc_html_e( 'Products', 'wpr-addons' ); ?></option>
431 <?php endif; ?>
432 <?php endif; ?>
433 </select>
434
435 <input type="text" placeholder="<?php esc_html_e( 'Enter comma separated IDs (Pro)', 'wpr-addons' ); ?>" name="condition_input_ids" class="wpr-condition-input-ids">
436 <span class="wpr-delete-template-conditions dashicons dashicons-no-alt"></span>
437
438 <?php endif; ?>
439 </div>
440 </div>
441
442 <?php // Expert Notice
443
444 if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->is_plan( 'expert' ) ) {
445 echo '<span class="wpr-expert-notice" style="display:none;text-align:center;"><br>
446 <span style="color:#f44;font-size:18px;" class="dashicons dashicons-warning"></span>
447 <strong style="color:#f44;">Please Note:</strong>
448 <strong>Custom Post Types</strong>, <strong>Custom Taxonomies</strong> and <strong>Custom Fields</strong><br>
449 are only supported in the <strong style="color:#f44;"><a href="https://royal-elementor-addons.com/?ref=rea-plugin-backend-conditions-upgrade-expert#purchasepro" target="_blank" style="text-decoration:none">Expert Version.</a></strong>
450 </span>';
451 }
452
453 ?>
454
455 <?php if ( $canvas ) : ?>
456 <div class="wpr-canvas-condition wpr-setting-custom-ckbox">
457 <span><?php esc_html_e( 'Show this template on Elementor Canvas pages', 'wpr-addons' ); ?></span>
458 <input type="checkbox" name="wpr-show-on-canvas" id="wpr-show-on-canvas">
459 <label for="wpr-show-on-canvas"></label>
460 </div>
461 <?php endif; ?>
462
463 <?php
464 // Pro Notice
465 if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
466 echo '<span style="color: #7f8b96;"><br>Conditions are fully supported in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-backend-conditions-upgrade-pro#purchasepro" target="_blank">Pro and Expert versions.</a></strong></span>';
467 // echo '<span style="color: #7f8b96;"><br>Conditions are fully supported in the <strong><a href="'. admin_url('admin.php?page=wpr-addons-pricing') .'" target="_blank">Pro version</a></strong></span>';
468 }
469
470 ?>
471
472 <!-- Action Buttons -->
473 <span class="wpr-add-conditions"><?php esc_html_e( 'Add Conditions', 'wpr-addons' ); ?></span>
474 <span class="wpr-save-conditions"><?php esc_html_e( 'Save Conditions', 'wpr-addons' ); ?></span>
475
476 </div>
477 </div>
478
479 <?php
480 }
481
482
483 /**
484 ** Render Create Template Popup
485 */
486 public static function render_create_template_popup() {
487 ?>
488
489 <!-- Custom Template Popup -->
490 <div class="wpr-user-template-popup-wrap wpr-admin-popup-wrap">
491 <div class="wpr-user-template-popup wpr-admin-popup">
492 <header>
493 <h2><?php esc_html_e( 'Templates Help You Work Efficiently!', 'wpr-addons' ); ?></h2>
494 <p><?php esc_html_e( 'Use templates to create the different pieces of your site, and reuse them with one click whenever needed.', 'wpr-addons' ); ?></p>
495 </header>
496
497 <input type="text" name="user_template_title" class="wpr-user-template-title" placeholder="<?php esc_html_e( 'Enter Template Title', 'wpr-addons' ); ?>">
498 <input type="hidden" name="user_template_type" class="user-template-type">
499 <span class="wpr-create-template"><?php esc_html_e( 'Create Template', 'wpr-addons' ); ?></span>
500 <span class="close-popup dashicons dashicons-no-alt"></span>
501 </div>
502 </div>
503
504 <?php
505 }
506
507 /**
508 ** Render Backup Plugin Popup
509 */
510 public static function render_backup_plugin_popup() {
511 ?>
512
513 <!-- Backup Plugin Install Popup -->
514 <div class="wpr-backup-plugin-popup-wrap wpr-admin-popup-wrap">
515 <div class="wpr-backup-plugin-popup wpr-admin-popup">
516 <span class="close-popup dashicons dashicons-no-alt"></span>
517 <header>
518 <h2><?php esc_html_e( 'Create a Backup Before Editing', 'wpr-addons' ); ?></h2>
519 <p><?php esc_html_e( 'Before making changes to your template, we recommend creating a backup of your site. This way, you can easily restore it if something goes wrong.', 'wpr-addons' ); ?></p>
520 </header>
521 <div class="wpr-backup-plugin-actions">
522 <button type="button" class="wpr-install-backup-plugin button button-primary">
523 <span class="wpr-backup-btn-text"><?php esc_html_e( 'Start Backup Process', 'wpr-addons' ); ?></span>
524 <span class="wpr-backup-btn-arrow dashicons dashicons-arrow-right-alt"></span>
525 <span class="wpr-backup-dot-flashing" style="display: none;"></span>
526 </button>
527 <a href="#" class="wpr-skip-backup-plugin"><?php esc_html_e( 'Skip and never show this again', 'wpr-addons' ); ?></a>
528 </div>
529 </div>
530 </div>
531
532 <?php
533 }
534
535 /**
536 ** Check if Library Template Exists
537 */
538 public static function template_exists( $slug ) {
539 $result = false;
540 $wpr_templates = get_posts( ['post_type' => 'wpr_templates', 'posts_per_page' => '-1'] );
541
542 foreach ( $wpr_templates as $post ) {
543
544 if ( $slug === $post->post_name ) {
545 $result = true;
546 }
547 }
548
549 return $result;
550 }
551
552 }