-
Notifications
You must be signed in to change notification settings - Fork 7
/
woocommerce_gift_cards_lite.php
599 lines (533 loc) · 20 KB
/
woocommerce_gift_cards_lite.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://wpswings.com/
* @since 1.0.0
* @package woo-gift-cards-lite
*
* @wordpress-plugin
* Plugin Name: Ultimate Gift Cards For WooCommerce
* Plugin URI: https://wordpress.org/plugins/woo-gift-cards-lite/?utm_source=wpswings-giftcards-org&utm_medium=giftcards-org-backend&utm_campaign=org
* Description: <code><strong>Ultimate Gift Cards For WooCommerce</strong></code> allows merchants to create and sell fascinating Gift Card Product with multiple price variation. <a href="https://wpswings.com/woocommerce-plugins/?utm_source=wpswings-giftcards-shop&utm_medium=giftcards-org-backend&utm_campaign=shop-page" target="_blank"> Elevate your e-commerce store by exploring more on <strong> WP Swings </strong></a>.
* Version: 3.0.6
* Author: WP Swings
* Author URI: https://wpswings.com/?utm_source=wpswings-giftcards-official&utm_medium=giftcards-org-backend&utm_campaign=official
* License: GPL-3.0+
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: woo-gift-cards-lite
* Requires Plugins: woocommerce
* WP Tested up to: 6.7.1
* WP requires at least: 5.5.0
* WC tested up to: 9.4.2
* WC requires at least: 5.5.0
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
use Automattic\WooCommerce\Utilities\OrderUtil;
$activated = false;
$wps_woo_plugin = 'woocommerce/woocommerce.php';
/**
* Checking if WooCommerce is active.
*/
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( file_exists( WP_PLUGIN_DIR . '/' . $wps_woo_plugin ) && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
$activated = true;
}
} else {
if ( file_exists( WP_PLUGIN_DIR . '/' . $wps_woo_plugin ) && in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
$activated = true;
}
}
add_action( 'before_woocommerce_init', 'wps_wgm_declare_hpos_compatibility' );
/**
* Hpos and cart/checkout block compatibility.
*/
function wps_wgm_declare_hpos_compatibility() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
}
}
if ( $activated ) {
define( 'WPS_WGC_DIRPATH', plugin_dir_path( __FILE__ ) );
define( 'WPS_WGC_URL', plugin_dir_url( __FILE__ ) );
define( 'WPS_WGC_ADMIN_URL', admin_url() );
define( 'WPS_WGC_VERSION', '3.0.6' );
define( 'WPS_WGC_ONBOARD_PLUGIN_NAME', 'Ultimate Gift Cards For WooCommerce' );
define( 'WPS_GIFT_TEMPLATE_URL', 'https://demo.wpswings.com/client-notification/' );
/**
* Check whether the WordPress version is greater than 4.9.6
*/
global $wp_version;
if ( $wp_version >= '4.9.6' ) {
include_once WPS_WGC_DIRPATH . 'wps-wgc-lite-gdpr.php';
}
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-gift-cards-lite.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-gift-cards-activation.php';
/**
*Add link for settings
*/
add_filter( 'plugin_action_links', 'wps_wgm_admin_settings', 10, 4 );
/**
* Add the Setting Links
*
* @since 1.0.0
* @name wps_wgm_admin_settings
* @param array $actions actions.
* @param string $plugin_file plugin file name.
* @param array $plugin_data plugin_data.
* @param string $context context.
* @return $actions
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgm_admin_settings( $actions, $plugin_file, $plugin_data, $context ) {
static $plugin;
if ( ! isset( $plugin ) ) {
$plugin = plugin_basename( __FILE__ );
}
if ( $plugin === $plugin_file ) {
$settings = array();
if ( ! wps_uwgc_pro_active() ) {
$settings['settings'] = '<a href="' . esc_url( admin_url( 'edit.php?post_type=giftcard&page=wps-wgc-setting-lite' ) ) . '">' . esc_html__( 'Settings', 'woo-gift-cards-lite' ) . '</a>';
$settings['get_paid_version'] = '<a class="wps-wgm-go-pro" href="https://wpswings.com/product/gift-cards-for-woocommerce-pro/?utm_source=wpswings-giftcards-pro&utm_medium=giftcards-org-backend&utm_campaign=go-pro" target="_blank">' . esc_html__( 'GO PRO', 'woo-gift-cards-lite' ) . '</a>';
$actions = array_merge( $settings, $actions );
}
}
return $actions;
}
/**
* This function is used to check if premium plugin is activated.
*
* @since 1.0.0
* @name wps_uwgc_pro_active
* @return boolean
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_uwgc_pro_active() {
return apply_filters( 'wps_uwgc_pro_active', false );
}
if ( ! function_exists( 'wps_wgm_giftcard_enable' ) ) {
/**
* This function is used to check if the giftcard plugin is activated.
*
* @since 1.0.0
* @name wps_wgm_giftcard_enable
* @return boolean
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgm_giftcard_enable() {
$giftcard_enable = get_option( 'wps_wgm_general_settings', array() );
if ( ! empty( $giftcard_enable ) && array_key_exists( 'wps_wgm_general_setting_enable', $giftcard_enable ) ) {
$check_enable = $giftcard_enable['wps_wgm_general_setting_enable'];
if ( isset( $check_enable ) && ! empty( $check_enable ) ) {
if ( 'on' === $check_enable ) {
return true;
} else {
return false;
}
}
}
}
}
register_activation_hook( __FILE__, 'wps_wgm_create_gift_card_taxonomy' );
/**
* Create the Taxonomy for Gift Card Product at activation.
*
* @return void
*/
function wps_create_giftcard_page() {
$page_taxonomy_created = get_option( 'wps_wgc_create_gift_card_taxonomy', false );
if ( false == $page_taxonomy_created ) {
update_option( 'wps_wgc_create_gift_card_taxonomy', true );
$term = esc_html__( 'Gift Card', 'woo-gift-cards-lite' );
$taxonomy = 'product_cat';
$term_exist = term_exists( $term, $taxonomy );
if ( 0 == $term_exist || null == $term_exist ) {
$args['slug'] = 'wps_wgm_giftcard';
$term_exist = wp_insert_term( $term, $taxonomy, $args );
}
$terms = get_term( $term_exist['term_id'], $taxonomy, ARRAY_A );
$giftcard_category = $terms['slug'];
$giftcard_content = "[product_category category='$giftcard_category']";
$customer_reports = array(
'post_author' => get_current_user_id(),
'post_name' => esc_html__( 'Gift Card', 'woo-gift-cards-lite' ),
'post_title' => esc_html__( 'Gift Card', 'woo-gift-cards-lite' ),
'post_type' => 'page',
'post_status' => 'publish',
'post_content' => $giftcard_content,
);
$page_id = wp_insert_post( $customer_reports );
}
}
/**
* Create the Taxonomy for Gift Card Product at activation.
*
* @since 1.0.0
* @name wps_wgm_create_gift_card_taxonomy
* @param boolean $network_wide for multisite.
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgm_create_gift_card_taxonomy( $network_wide ) {
global $wpdb;
// check if the plugin has been activated on the network.
if ( is_multisite() && $network_wide ) {
// Get all blogs in the network and activate plugins on each one.
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
wps_create_giftcard_page();
restore_current_blog();
}
} else {
// activated on a single site, in a multi-site or on a single site.
wps_create_giftcard_page();
}
$restore_data = new Woocommerce_Gift_Cards_Activation();
$restore_data->wps_wgm_restore_data( $network_wide );
set_transient( 'wps-wgm-giftcard-setting-notice', true, 5 );
}
// on plugin load.
add_action( 'plugins_loaded', 'wps_wgc_register_gift_card_product_type' );
/**
* Saving the Product Type by creating the Instance of this.
*
* @since 1.0.0
* @name wps_wgc_register_gift_card_product_type.
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgc_register_gift_card_product_type() {
if ( ! class_exists( 'WC_Product_Wgm_Gift_Card' ) ) {
/**
* Set the giftcard product type.
*
* @since 1.0.0
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
class WC_Product_Wgm_Gift_Card extends WC_Product {
/**
* Simple product.
*
* @var product_type product_type.
*/
public $product_type;
/**
* Initialize simple product.
*
* @param mixed $product product.
*/
public function __construct( $product ) {
$this->product_type = 'wgm_gift_card';
parent::__construct( $product );
}
}
}
}
if ( ! function_exists( 'wps_wgm_coupon_generator' ) ) {
/**
* Generate the Dynamic code for Gift Cards.
*
* @since 1.0.0
* @name wps_wgm_coupon_generator
* @param int $length length of coupon code.
* @return string $password.
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgm_coupon_generator( $length = 5 ) {
$password = '';
$alphabets = range( 'A', 'Z' );
$numbers = range( '0', '9' );
$final_array = array_merge( $alphabets, $numbers );
while ( $length-- ) {
$key = array_rand( $final_array );
$password .= $final_array[ $key ];
}
$general_settings = get_option( 'wps_wgm_general_settings', array() );
if ( ! empty( $general_settings ) && array_key_exists( 'wps_wgm_general_setting_giftcard_prefix', $general_settings ) ) {
$giftcard_prefix = $general_settings['wps_wgm_general_setting_giftcard_prefix'];
} else {
$giftcard_prefix = '';
}
$password = $giftcard_prefix . $password;
$password = apply_filters( 'wps_wgm_custom_coupon', $password );
return $password;
}
}
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_woocommerce_gift_cards_lite() {
$plugin = new Woocommerce_Gift_Cards_Lite();
$plugin->run();
}
run_woocommerce_gift_cards_lite();
register_deactivation_hook( __FILE__, 'wps_uwgc_remove_cron_for_notification_update' );
/**
* Clear the cron set for giftcard notification updates.
*
* @since 2.0.0
*/
function wps_uwgc_remove_cron_for_notification_update() {
wp_clear_scheduled_hook( 'wps_wgm_check_for_notification_update' );
}
include_once WPS_WGC_DIRPATH . 'includes/giftcard-redeem-api-addon.php';
// Multisite Compatibilty for new site creation.
add_action( 'wp_initialize_site', 'wps_wgc_standard_plugin_on_create_blog', 900 );
/**
* Compatibilty with multisite.
*
* @param object $new_site subsite.
* @return void
*/
function wps_wgc_standard_plugin_on_create_blog( $new_site ) {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
// check if the plugin has been activated on the network.
if ( is_plugin_active_for_network( 'woo-gift-cards-lite/woocommerce_gift_cards_lite.php' ) ) {
$wps_lcns_status = get_option( 'wps_gw_lcns_status' );
$wps_license_key = get_option( 'wps_gw_lcns_key' );
$timestamp = get_option( 'wps_gw_lcns_thirty_days' );
$blog_id = $new_site->blog_id;
// switch to newly created site.
switch_to_blog( $blog_id );
require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-gift-cards-activation.php';
// code to be executed when site is created, call any function from activation file.
wps_create_giftcard_page();
$restore_data = new Woocommerce_Gift_Cards_Activation();
$restore_data->on_activation();
do_action( 'wps_wgm_standard_plugin_on_create_blog', $wps_lcns_status, $wps_license_key, $timestamp );
restore_current_blog();
}
}
add_action( 'admin_init', 'wps_uwgc_create_giftcard_template_org' );
/**
* Function to create giftcard template.
*/
function wps_uwgc_create_giftcard_template_org() {
/* ===== ====== Create the Check Gift Card Page ====== ======*/
if ( ! get_option( 'check_balance_page_created_org', false ) && ! get_option( 'check_balance_page_created', false ) ) {
$balance_content = '[wps_check_your_gift_card_balance]';
$check_balance = array(
'post_author' => get_current_user_id(),
'post_name' => __( 'Gift Card Balance', 'woo-gift-cards-lite' ),
'post_title' => __( 'Gift Card Balance', 'woo-gift-cards-lite' ),
'post_type' => 'page',
'post_status' => 'publish',
'post_content' => $balance_content,
);
$page_id = wp_insert_post( $check_balance );
update_option( 'check_balance_page_created_org', true );
/* ===== ====== End of Create the Gift Card Page ====== ======*/
}
if ( ! get_option( 'giftcard_balance' ) ) {
$mypost = get_page_by_path( 'gift-card-balance', '', 'page' );
if ( isset( $mypost ) ) {
update_option( 'giftcard_balance', $mypost->ID );
}
}
}
if ( ! function_exists( 'str_contains' ) ) {
/**
* String contains.
*
* @param string $haystack haystack.
* @param string $needle needle.
* @return boolean
*/
function str_contains( $haystack, $needle ) {
return '' !== $needle && false !== mb_strpos( $haystack, $needle );
}
}
// HPOS - High Performance Order System.
/**
* This function is used to check hpos enable.
*
* @return boolean
*/
function wps_wgm_is_hpos_enabled() {
$is_hpos_enable = false;
if ( class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) && OrderUtil::custom_orders_table_usage_is_enabled() ) {
$is_hpos_enable = true;
}
return $is_hpos_enable;
}
/**
* This function is used to get post meta data.
*
* @param string $id id.
* @param string $meta_key meta key.
* @param bool $bool meta bool.
* @return string
*/
function wps_wgm_hpos_get_meta_data( $id, $meta_key, $bool ) {
$meta_value = '';
if ( 'shop_order' === OrderUtil::get_order_type( $id ) && wps_wgm_is_hpos_enabled() ) {
$order = wc_get_order( $id );
$meta_value = $order->get_meta( $meta_key, $bool );
} else {
$meta_value = get_post_meta( $id, $meta_key, $bool );
}
return $meta_value;
}
/**
* This function is used to update meta data.
*
* @param string $id id.
* @param string $meta_key meta_key.
* @param string $meta_value meta_value.
* @return void
*/
function wps_wgm_hpos_update_meta_data( $id, $meta_key, $meta_value ) {
if ( 'shop_order' === OrderUtil::get_order_type( $id ) && wps_wgm_is_hpos_enabled() ) {
$order = wc_get_order( $id );
$order->update_meta_data( $meta_key, $meta_value );
$order->save();
} else {
update_post_meta( $id, $meta_key, $meta_value );
}
}
/**
* This function is used delete meta data.
*
* @param string $id id.
* @param string $meta_key meta_key.
* @return void
*/
function wps_wgm_hpos_delete_meta_data( $id, $meta_key ) {
if ( 'shop_order' === OrderUtil::get_order_type( $id ) && wps_wgm_is_hpos_enabled() ) {
$order = wc_get_order( $id );
$order->delete_meta_data( $meta_key );
$order->save();
} else {
delete_post_meta( $id, $meta_key );
}
}
} else {
add_action( 'admin_init', 'wps_wgm_plugin_deactivate' );
/**
* Deactivate plugin.
*
* @since 1.0.0
* @name wps_wgm_plugin_deactivate()
* @author WP Swings <[email protected]>
* @link https://www.wpswings.com/
*/
function wps_wgm_plugin_deactivate() {
unset( $_GET['activate'] );
deactivate_plugins( plugin_basename( __FILE__ ) );
?>
<!-- Show warning message if woocommerce is not install -->
<div class="error notice is-dismissible">
<p><?php esc_html_e( 'Woocommerce is not activated, Please activate Woocommerce first to install Ultimate Gift Cards For WooCommerce', 'woo-gift-cards-lite' ); ?></p>
</div>
<?php
}
}
add_action( 'admin_notices', 'wps_banner_notification_plugin_html' );
if ( ! function_exists( 'wps_banner_notification_plugin_html' ) ) {
/**
* Notification.
*/
function wps_banner_notification_plugin_html() {
$secure_nonce = wp_create_nonce( 'wps-gc-auth-nonce' );
$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-gc-auth-nonce' );
if ( ! $id_nonce_verified ) {
wp_die( esc_html__( 'Nonce Not verified', 'woo-gift-cards-lite' ) );
}
$screen = get_current_screen();
if ( isset( $screen->id ) ) {
$pagescreen = $screen->id;
}
if ( ( isset( $pagescreen ) && 'plugins' === $pagescreen ) || ( 'wp-swings_page_home' == $pagescreen ) ) {
$notification_id = get_option( 'wps_wgm_notify_new_msg_id', false );
$banner_id = get_option( 'wps_wgm_notify_new_banner_id', false );
if ( isset( $banner_id ) && '' !== $banner_id ) {
$hidden_banner_id = get_option( 'wps_wgm_notify_hide_baneer_notification', false );
$banner_image = get_option( 'wps_wgm_notify_new_banner_image', '' );
$banner_url = get_option( 'wps_wgm_notify_new_banner_url', '' );
if ( isset( $hidden_banner_id ) && $hidden_banner_id < $banner_id ) {
if ( '' !== $banner_image && '' !== $banner_url ) {
?>
<div class="wps-offer-notice notice notice-warning is-dismissible">
<div class="notice-container">
<a href="<?php echo esc_url( $banner_url ); ?>" target="_blank"><img src="<?php echo esc_url( $banner_image ); ?>" alt="Gift cards"/></a>
</div>
<button type="button" class="notice-dismiss dismiss_banner" id="dismiss-banner"><span class="screen-reader-text">Dismiss this notice.</span></button>
</div>
<?php
}
}
}
}
}
}
add_action( 'admin_notices', 'wps_giftcard_notification_plugin_html' );
if ( ! function_exists( 'wps_giftcard_notification_plugin_html' ) ) {
/**
* Notification html.
*
* @since 3.0.0
*/
function wps_giftcard_notification_plugin_html() {
$secure_nonce = wp_create_nonce( 'wps-gc-auth-nonce' );
$id_nonce_verified = wp_verify_nonce( $secure_nonce, 'wps-gc-auth-nonce' );
if ( ! $id_nonce_verified ) {
wp_die( esc_html__( 'Nonce Not verified', 'woo-gift-cards-lite' ) );
}
$screen = get_current_screen();
if ( isset( $screen->id ) ) {
$pagescreen = $screen->id;
}
if ( ( isset( $_GET['page'] ) && 'wps-wgc-setting-lite' === $_GET['page'] ) || ( isset( $_GET['post_type'] ) && 'giftcard' === $_GET['post_type'] ) ) {
$notification_id = get_option( 'wps_wgm_notify_new_msg_id', false );
$banner_id = get_option( 'wps_wgm_notify_new_banner_id', false );
if ( isset( $banner_id ) && '' !== $banner_id ) {
$hidden_banner_id = get_option( 'wps_wgm_notify_hide_baneer_notification', false );
$banner_image = get_option( 'wps_wgm_notify_new_banner_image', '' );
$banner_url = get_option( 'wps_wgm_notify_new_banner_url', '' );
if ( isset( $hidden_banner_id ) && $hidden_banner_id < $banner_id ) {
if ( '' !== $banner_image && '' !== $banner_url ) {
?>
<div class="wps-offer-notice notice notice-warning is-dismissible">
<div class="notice-container">
<a href="<?php echo esc_url( $banner_url ); ?>" target="_blank"><img src="<?php echo esc_url( $banner_image ); ?>" alt="Gift cards"/></a>
</div>
<button type="button" class="notice-dismiss dismiss_banner" id="dismiss-banner"><span class="screen-reader-text">Dismiss this notice.</span></button>
</div>
<?php
}
}
}
}
}
}