| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
class ESHB_PRO_ADDONS { |
| 4 |
|
| 5 |
private $license_status = false; |
| 6 |
|
| 7 |
public function __construct() { |
| 8 |
|
| 9 |
} |
| 10 |
|
| 11 |
public function eshb_get_addons(){ |
| 12 |
$addons = array( |
| 13 |
array( |
| 14 |
'name' => 'EHB WhatsApp', |
| 15 |
'slug' => 'ehb-whatsapp/ehb-whatsapp.php', |
| 16 |
'external_url' => 'https://themewant.com/downloads/ehb-whatsapp/', |
| 17 |
'demo_url' => 'https://themewant.com/downloads/ehb-whatsapp/', |
| 18 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/whatsapp.png', |
| 19 |
'desc' => 'Easy Hotel WhatsApp Plugin, WhatsApp notification sender for Easy Hotel plugin.', |
| 20 |
'is_pro' => true |
| 21 |
), |
| 22 |
array( |
| 23 |
'name' => 'EHB Email Template', |
| 24 |
'slug' => 'ehb-email-template/ehb-email-template.php', |
| 25 |
'external_url' => 'https://themewant.com/downloads/ehb-email-template/', |
| 26 |
'demo_url' => 'https://themewant.com/downloads/ehb-email-template/', |
| 27 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/email-template.png', |
| 28 |
'desc' => 'Easy Hotel deposit Plugin, email template builder for for Easy Hotel plugin. Whether you can create custom template for emails of booking.', |
| 29 |
'is_pro' => true |
| 30 |
), |
| 31 |
array( |
| 32 |
'name' => 'EHB Deposit', |
| 33 |
'slug' => 'ehb-currency/ehb-deposit.php', |
| 34 |
'external_url' => 'https://themewant.com/downloads/ehb-deposit/', |
| 35 |
'demo_url' => 'https://themewant.com/downloads/ehb-deposit/', |
| 36 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/deposit.png', |
| 37 |
'desc' => 'Easy Hotel deposit Plugin, deposit payment solution for Easy Hotel plugin. Whether customer can pay partial payment', |
| 38 |
'is_pro' => true |
| 39 |
), |
| 40 |
array( |
| 41 |
'name' => 'EHB Manual Booking', |
| 42 |
'slug' => 'ehb-manual-booking/ehb-manual-booking.php', |
| 43 |
'external_url' => 'https://themewant.com/downloads/ehb-manual-booking/', |
| 44 |
'demo_url' => 'https://themewant.com/downloads/ehb-manual-booking/', |
| 45 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/manual-booking.png', |
| 46 |
'desc' => 'Easy Hotel deposit Plugin, manual booking solution for WordPress. Whether you manage manually booking from admin area', |
| 47 |
'is_pro' => true |
| 48 |
), |
| 49 |
array( |
| 50 |
'name' => 'EHB iCal', |
| 51 |
'slug' => 'ehb-ical/ehb-ical.php', |
| 52 |
'external_url' => 'https://themewant.com/downloads/ehb-ical/', |
| 53 |
'demo_url' => 'https://themewant.com/downloads/ehb-ical/', |
| 54 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/ical.png', |
| 55 |
'desc' => 'Easy Hotel iCal Plugin, A complete ical booking solution for easy hotel plugin.', |
| 56 |
'is_pro' => true |
| 57 |
), |
| 58 |
array( |
| 59 |
'name' => 'EHB Advanced Pricing', |
| 60 |
'slug' => 'ehb-db/ehb-advanced-pricing.php', |
| 61 |
'external_url' => 'https://themewant.com/downloads/ehb-advanced-pricing/', |
| 62 |
'demo_url' => 'https://themewant.com/downloads/ehb-advanced-pricing/', |
| 63 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/advanced-pricing.png', |
| 64 |
'desc' => 'Easy Hotel Advanced Pricing plugin, extension for adding variable and longest pricing to accommodations.', |
| 65 |
'is_pro' => true |
| 66 |
), |
| 67 |
array( |
| 68 |
'name' => 'EHB Reviews', |
| 69 |
'slug' => 'ehb-db/ehb-db.php', |
| 70 |
'external_url' => 'https://themewant.com/downloads/ehb-review/', |
| 71 |
'demo_url' => 'https://themewant.com/downloads/ehb-review/', |
| 72 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/review.png', |
| 73 |
'desc' => 'Easy Hotel Review plugin, extension for users to give review on their favorite accommodation.', |
| 74 |
'is_pro' => true |
| 75 |
), |
| 76 |
array( |
| 77 |
'name' => 'EHB DB', |
| 78 |
'slug' => 'ehb-db/ehb-db.php', |
| 79 |
'external_url' => 'https://themewant.com/downloads/ehb-db/', |
| 80 |
'demo_url' => 'https://themewant.com/downloads/ehb-db/', |
| 81 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/db.png', |
| 82 |
'desc' => 'Bookings Database solution for easy hotel. Whether you can export bookings and booking requests.', |
| 83 |
'is_pro' => true |
| 84 |
), |
| 85 |
array( |
| 86 |
'name' => 'EHB Week', |
| 87 |
'slug' => 'ehb-week/ehb-week.php', |
| 88 |
'external_url' => 'https://themewant.com/downloads/ehb-week/', |
| 89 |
'demo_url' => 'https://themewant.com/downloads/ehb-week/', |
| 90 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/week.png', |
| 91 |
'desc' => 'Week reservation solution for WordPress. Whether you manage single day booking', |
| 92 |
'is_pro' => true |
| 93 |
), |
| 94 |
array( |
| 95 |
'name' => 'EHB Single Day', |
| 96 |
'slug' => 'ehb-db/ehb-db.php', |
| 97 |
'external_url' => 'https://themewant.com/downloads/ehb-single-day/', |
| 98 |
'demo_url' => 'https://themewant.com/downloads/eehb-single-day', |
| 99 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/db.png', |
| 100 |
'desc' => 'Single day booking solution. Manage single day booking with custom pricing', |
| 101 |
'is_pro' => true |
| 102 |
), |
| 103 |
array( |
| 104 |
'name' => 'EHB Min Max', |
| 105 |
'slug' => 'ehb-min-max/ehb-min-max.php', |
| 106 |
'external_url' => 'https://themewant.com/downloads/ehb-min-max/', |
| 107 |
'demo_url' => 'https://themewant.com/downloads/ehb-min-max/', |
| 108 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/min-max.png', |
| 109 |
'desc' => 'Minimum and Maximum reservation conditional solution for WordPress. Whether you manage single day booking', |
| 110 |
'is_pro' => true |
| 111 |
), |
| 112 |
array( |
| 113 |
'name' => 'EHB Currency', |
| 114 |
'slug' => 'ehb-currency/ehb-currency.php', |
| 115 |
'external_url' => 'https://themewant.com/downloads/ehb-currency/', |
| 116 |
'demo_url' => 'https://themewant.com/downloads/ehb-currency/', |
| 117 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/addons/currency.png', |
| 118 |
'desc' => 'Easily enable multi-currency pricing on your hotel booking website. This add-on allowing guests to view and pay in their preferred currency.', |
| 119 |
'is_pro' => true |
| 120 |
) |
| 121 |
|
| 122 |
); |
| 123 |
return $addons; |
| 124 |
} |
| 125 |
|
| 126 |
public function eshb_get_themes(){ |
| 127 |
$addons = array( |
| 128 |
array( |
| 129 |
'name' => 'Almaris - Hotel Booking WordPress Theme', |
| 130 |
'slug' => 'almaris', |
| 131 |
'external_url' => 'https://themeforest.net/item/almaris-hotel-booking-wordpress-theme/55353710', |
| 132 |
'demo_url' => 'https://themewant.com/products/wordpress/landing/almaris/', |
| 133 |
'thumbnail' => 'https://market-resized.envatousercontent.com/themeforest.net/files/542534134/preview.__large_preview.png?auto=format&q=94&cf_fit=crop&gravity=top&h=8000&w=590&s=9fd5e70fc097e3326b8910ead954ce48f2d0de1bd8f9e00fd6c2336fb677aaa9', |
| 134 |
'desc' => 'A complete hotel booking solution for wordpress website.', |
| 135 |
'is_pro' => true |
| 136 |
), |
| 137 |
array( |
| 138 |
'name' => 'Moonlit - Hotel Booking WordPress Theme', |
| 139 |
'slug' => 'moonlit', |
| 140 |
'external_url' => 'https://themeforest.net/item/moonlit-hotel-booking-wordpress-theme/57289887', |
| 141 |
'demo_url' => 'https://reactheme.com/products/wordpress/landing/moonlit/', |
| 142 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/themes/moonlit.jpg', |
| 143 |
'desc' => 'A complete hotel booking solution for wordpress website.', |
| 144 |
'is_pro' => true |
| 145 |
), |
| 146 |
array( |
| 147 |
'name' => 'Luxera - Hotel Booking WordPress Theme', |
| 148 |
'slug' => 'luxera', |
| 149 |
'external_url' => 'https://themewant.com/downloads/luxera-hotel-booking-wordpress-theme/', |
| 150 |
'demo_url' => 'https://themewant.com/luxera/', |
| 151 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/themes/luxera.jpg', |
| 152 |
'desc' => 'A complete hotel booking solution for wordpress website.', |
| 153 |
'is_pro' => true |
| 154 |
), |
| 155 |
array( |
| 156 |
'name' => 'CitySpot - Hotel Booking WordPress Theme', |
| 157 |
'slug' => 'cityspot', |
| 158 |
'external_url' => 'https://themewant.com/downloads/cityspot-hotel-booking-wordpress-theme/', |
| 159 |
'demo_url' => 'https://themewant.com/downloads/cityspot-hotel-booking-wordpress-theme/', |
| 160 |
'thumbnail' => ESHB_PL_URL.'admin/assets/img/thumbnails/themes/cityspot.jpg', |
| 161 |
'desc' => 'A complete hotel booking solution for wordpress website.', |
| 162 |
'is_pro' => true |
| 163 |
) |
| 164 |
); |
| 165 |
return $addons; |
| 166 |
} |
| 167 |
|
| 168 |
public function is_plugin_active_by_name( $plugin_name ) { |
| 169 |
$active_plugins = get_option( 'active_plugins' ); |
| 170 |
|
| 171 |
foreach ( $active_plugins as $plugin ) { |
| 172 |
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
| 173 |
|
| 174 |
if ( isset( $plugin_data['Name'] ) && stripos( $plugin_data['Name'], $plugin_name ) !== false ) { |
| 175 |
return true; |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
return false; |
| 180 |
} |
| 181 |
|
| 182 |
public function eshb_get_addons_html(){ |
| 183 |
$addons = $this->eshb_get_addons(); |
| 184 |
?> |
| 185 |
<div class="eshb-pro-addons-card-group"> |
| 186 |
<?php |
| 187 |
foreach ($addons as $key => $addon) { |
| 188 |
|
| 189 |
$thumbnail_url = isset($addon['thumbnail']) && !empty($addon['thumbnail']) ? $addon['thumbnail'] : ''; |
| 190 |
$plugin_slug = $addon['slug']; // Plugin main file path |
| 191 |
$plugin_path = WP_PLUGIN_DIR . '/' . $plugin_slug; |
| 192 |
$plugin_data = []; |
| 193 |
if( file_exists($plugin_path) ){ |
| 194 |
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_slug); |
| 195 |
} |
| 196 |
|
| 197 |
?> |
| 198 |
<div class="eshb-pro-addons-card"> |
| 199 |
<span class="eshb-pro-addons-base"> |
| 200 |
<?php |
| 201 |
if($addon['is_pro'] == true ){ |
| 202 |
echo '<span class="eshb-pro-base">' . esc_html__('Pro', 'easy-hotel') . '</span>'; |
| 203 |
}else{ |
| 204 |
echo '<span class="eshb-free-base">' . esc_html__('Free', 'easy-hotel') . '</span>'; |
| 205 |
} |
| 206 |
?> |
| 207 |
</span> |
| 208 |
<div class="eshb-pro-addons-body"> |
| 209 |
<div class="eshb-pro-addons-thumbnail"> |
| 210 |
<img src="<?php echo esc_url($thumbnail_url); ?>" alt="plugin-icon"> |
| 211 |
|
| 212 |
</div> |
| 213 |
<div class="eshb-pro-addons-content"> |
| 214 |
<h3 class="eshb-pro-addons-name"><?php echo esc_html( $addon['name'] )?></h3> |
| 215 |
<p class="eshb-pro-addons-desc"><?php echo esc_html( $addon['desc'] )?></p> |
| 216 |
<div class="eshb-pro-addons-action"> |
| 217 |
<input type="hidden" class="eshb-plugin-url" value="<?php echo esc_attr( $addon['external_url'] )?>"> |
| 218 |
<input type="hidden" class="eshb-plugin-slug" value="<?php echo esc_attr( $addon['slug'] )?>"> |
| 219 |
<?php |
| 220 |
|
| 221 |
|
| 222 |
if (!file_exists($plugin_path)) { |
| 223 |
?> |
| 224 |
<a href="<?php echo esc_url($addon['external_url']); ?>" class="eshb-action-btn-primary eshb-addons-action-button" target="_blank"><span class="button-text"><?php echo esc_html__( 'Get It Now', 'easy-hotel' ); ?></span></a> |
| 225 |
<?php |
| 226 |
} |
| 227 |
?> |
| 228 |
|
| 229 |
<a href="<?php echo esc_url($addon['demo_url']); ?>" class="eshb-action-btn-secondary eshb-addons-action-button" target="_blank"><span class="button-text"><?php echo esc_html__( 'Live Demo', 'easy-hotel' )?></span></a> |
| 230 |
<?php |
| 231 |
if (file_exists($plugin_path)) { |
| 232 |
?> |
| 233 |
<span class="eshb-plugin-install-status eshb-pro-addons-version"><?php echo esc_html__( 'Installed Version ', 'easy-hotel' ) . esc_html( $plugin_data['Version'] )?></span> |
| 234 |
<?php |
| 235 |
} |
| 236 |
?> |
| 237 |
</div> |
| 238 |
</div> |
| 239 |
</div> |
| 240 |
|
| 241 |
</div> |
| 242 |
<?php |
| 243 |
} |
| 244 |
?> |
| 245 |
</div> |
| 246 |
<?php |
| 247 |
if( count($addons) > 20){ |
| 248 |
?> |
| 249 |
<a href="https://themewant.com/downloads" class="eshb-addons-action-button view-all-btn" target="_blank"><span class="button-text"><?php echo esc_html__( 'View All Addons', 'easy-hotel' )?></span></a> |
| 250 |
<?php |
| 251 |
} |
| 252 |
?> |
| 253 |
|
| 254 |
<?php |
| 255 |
} |
| 256 |
|
| 257 |
public function eshb_get_themes_html(){ |
| 258 |
$themes = $this->eshb_get_themes(); |
| 259 |
?> |
| 260 |
<div class="eshb-pro-addons-card-group"> |
| 261 |
<?php |
| 262 |
|
| 263 |
foreach ($themes as $key => $theme) { |
| 264 |
|
| 265 |
$thumbnail_url = isset($theme['thumbnail']) && !empty($theme['thumbnail']) ? $theme['thumbnail'] : ''; |
| 266 |
$theme_slug = $theme['slug']; // Plugin main file path |
| 267 |
$selected_theme = wp_get_theme($theme_slug); |
| 268 |
$theme_data = []; |
| 269 |
if( $selected_theme->exists() ){ |
| 270 |
$theme_data['version'] = $selected_theme->get('Version'); |
| 271 |
} |
| 272 |
|
| 273 |
|
| 274 |
?> |
| 275 |
<div class="eshb-pro-addons-card"> |
| 276 |
<span class="eshb-pro-addons-base"> |
| 277 |
<?php |
| 278 |
if($theme['is_pro'] == true ){ |
| 279 |
echo '<span class="eshb-pro-base">' . esc_html__('Pro', 'easy-hotel') . '</span>'; |
| 280 |
}else{ |
| 281 |
echo '<span class="eshb-free-base">' . esc_html__('Free', 'easy-hotel') . '</span>'; |
| 282 |
} |
| 283 |
?> |
| 284 |
</span> |
| 285 |
<div class="eshb-pro-addons-body"> |
| 286 |
<div class="eshb-pro-addons-thumbnail"> |
| 287 |
<img src="<?php echo esc_url($thumbnail_url); ?>" alt="plugin-icon"> |
| 288 |
|
| 289 |
</div> |
| 290 |
<div class="eshb-pro-addons-content"> |
| 291 |
<h3 class="eshb-pro-addons-name"><?php echo esc_html( $theme['name'] )?></h3> |
| 292 |
<p class="eshb-pro-addons-desc"><?php echo esc_html( $theme['desc'] )?></p> |
| 293 |
<div class="eshb-pro-addons-action"> |
| 294 |
<input type="hidden" class="eshb-plugin-url" value="<?php echo esc_attr( $theme['external_url'] )?>"> |
| 295 |
<input type="hidden" class="eshb-plugin-slug" value="<?php echo esc_attr( $theme['slug'] )?>"> |
| 296 |
<?php |
| 297 |
|
| 298 |
if (!isset($theme_data['version'])) { |
| 299 |
?> |
| 300 |
<a href="<?php echo esc_url($theme['external_url']); ?>" class="eshb-action-btn-primary eshb-addons-action-button" target="_blank"><span class="button-text"><?php echo esc_html__( 'Get It Now', 'easy-hotel' ); ?></span></a> |
| 301 |
<?php |
| 302 |
} |
| 303 |
|
| 304 |
?> |
| 305 |
|
| 306 |
<a href="<?php echo esc_url($theme['demo_url']); ?>" class="eshb-action-btn-secondary eshb-addons-action-button" target="_blank"><span class="button-text"><?php echo esc_html__( 'Live Demo', 'easy-hotel' )?></span></a> |
| 307 |
<?php |
| 308 |
if (isset($theme_data['version'])) { |
| 309 |
?> |
| 310 |
<span class="eshb-plugin-install-status eshb-pro-addons-version"><?php echo esc_html__( 'Installed Version ', 'easy-hotel' ) . esc_html( $theme_data['version'] )?></span> |
| 311 |
<?php |
| 312 |
} |
| 313 |
?> |
| 314 |
</div> |
| 315 |
</div> |
| 316 |
</div> |
| 317 |
|
| 318 |
</div> |
| 319 |
<?php |
| 320 |
} |
| 321 |
?> |
| 322 |
|
| 323 |
</div> |
| 324 |
<?php |
| 325 |
if( count($themes) > 20){ |
| 326 |
?> |
| 327 |
<a href="https://themeforest.net/user/reacthemes/portfolio" class="eshb-addons-action-button view-all-btn" target="_blank"><span class="button-text"><?php echo esc_html__( 'View All Themes', 'easy-hotel' )?></span></a> |
| 328 |
<?php |
| 329 |
} |
| 330 |
?> |
| 331 |
|
| 332 |
<?php |
| 333 |
} |
| 334 |
} |