| 1 |
<link rel="stylesheet" id="templateberg-dashboard-shortcode-css" href="<?php echo TEMPLATEBERG_URL . 'dist/list.css' ?>" type="text/css" media="all"> |
| 2 |
<?php |
| 3 |
|
| 4 |
$active = isset($_GET['type']) && $_GET['type']?$_GET['type']:'current'; |
| 5 |
if (templateberg_theme_templates()->is_selected_theme()) { |
| 6 |
$theme = $_GET['slug']; |
| 7 |
} else { |
| 8 |
$theme = get_stylesheet(); |
| 9 |
} |
| 10 |
|
| 11 |
require_once TEMPLATEBERG_PATH . 'includes/lists/templates/theme-buy-preview.php'; |
| 12 |
require_once TEMPLATEBERG_PATH . 'includes/lists/templates/getting-started.php'; |
| 13 |
if (!templateberg_has_templates('current-theme', $theme)) { |
| 14 |
?> |
| 15 |
<div class="tb-connect__notice tb-text__center"> |
| 16 |
<div class="tb-connect__icon"> |
| 17 |
<img src="http://localhost/templateberg/wp-content/plugins/templateberg/assets/img/logo-48x48.png" alt="Templateberg"> |
| 18 |
</div> |
| 19 |
<h4 class="tb-connect__title"> |
| 20 |
<?php |
| 21 |
esc_html_e('You need to click on the Refresh button below or The current theme does not have Templates on Templateberg.', 'templateberg'); |
| 22 |
?> |
| 23 |
</h4> |
| 24 |
<p class="tb-connect__desc"> |
| 25 |
<?php |
| 26 |
esc_html_e("Templateberg power you to create site quickly and easily. You don't have to spend hours trying to create a template and block design. With a click your favourite template design will import on your site and you can change text, image and customize it for your needs.", 'templateberg'); |
| 27 |
?> |
| 28 |
<p class="tb-connect__gutentor"> |
| 29 |
</p> |
| 30 |
<a href="#" class="tb-btn tb-btn__primary tb-btn__lg tb-current-themes-template-kits-refresh"><?php esc_html_e('Refresh', 'templateberg');?></a> |
| 31 |
<a href="#" class="tb-btn tb-btn__primary tb-btn__lg tb-list__theme_type" data-type="available"><?php esc_html_e('View Available Themes Template Kits', 'templateberg');?></a> |
| 32 |
</div> |
| 33 |
<?php |
| 34 |
return; |
| 35 |
} |
| 36 |
$paged = get_query_var('paged')?get_query_var('paged'):1; |
| 37 |
$themes_list_popular = get_transient('templateberg_ct_p_'.$paged); |
| 38 |
|
| 39 |
$themes_list = templateberg_get_current_theme_templates($paged, $theme); |
| 40 |
|
| 41 |
$max_pages = get_transient('templateberg_ct_'.$theme.'_max'); |
| 42 |
$total_themes = get_transient('templateberg_ct_'.$theme.'_total'); |
| 43 |
|
| 44 |
$purchased_items = get_transient('templateberg_ct_'.$theme.'_total'); |
| 45 |
|
| 46 |
$current_theme_purchase_id = templateberg_connect()->get_current_theme_purchase_templates_id(); |
| 47 |
/** |
| 48 |
* Create Instance for Templateberg_Template_Lists_Data |
| 49 |
* |
| 50 |
* @since 1.0.0 |
| 51 |
* @access public |
| 52 |
* |
| 53 |
* @param |
| 54 |
* |
| 55 |
* @return object |
| 56 |
*/ |
| 57 |
templateberg_template_lists_data()->setup_themes($themes_list); |
| 58 |
$data = templateberg_template_lists_data()->data; |
| 59 |
echo '<div class="ai-content-blocker hidden">'; |
| 60 |
echo '<div class="ai-notification-title"><p>' . esc_html__('Processing... Please do not refresh this page or do not go to other url!', 'templateberg') . '</p></div>'; |
| 61 |
echo '<div id="ai-demo-popup"></div>'; |
| 62 |
echo '</div>'; |
| 63 |
?> |
| 64 |
<div class="tb-list__template" role="document"> |
| 65 |
<div class="tb-list__sidebar"> |
| 66 |
<div class="tb-list__search"> |
| 67 |
<input class="tb-list__searchinput" type="text" id="" placeholder="Search" value=""> |
| 68 |
<i class="fas fa-search" tabindex="-1"></i> |
| 69 |
</div> |
| 70 |
<div class="tb-list__categories"><h3><?php echo esc_html__('Categories', 'templateberg'); ?></h3> |
| 71 |
<div class="tb-list__categories-filter-wrap"> |
| 72 |
<ul class="tb-list__categories-wrap-tab"> |
| 73 |
<li class="tb-list__categories-tab-item tb-filter-active" data-id="all"><?php echo esc_html__('All', 'templateberg'); ?></li> |
| 74 |
<li class="tb-list__categories-tab-item" data-id="free"><?php echo esc_html__('Free', 'templateberg'); ?></li> |
| 75 |
<li class="tb-list__categories-tab-item" data-id="pro"><?php echo esc_html__('Pro', 'templateberg'); ?></li> |
| 76 |
</ul> |
| 77 |
</div> |
| 78 |
<ul class="tb-list__cat_lists tb-cat-lists-all tb-cats-content-active"> |
| 79 |
<?php |
| 80 |
$current_tab_cats = array(); |
| 81 |
$count_items = templateberg_template_lists_data()->countItems; |
| 82 |
if (isset($count_items['all'])) { |
| 83 |
$current_tab_cats =$count_items['all']; |
| 84 |
} |
| 85 |
if (!empty($current_tab_cats)) { |
| 86 |
foreach ($current_tab_cats as $cat => $count) { |
| 87 |
if ($cat === 'all') { |
| 88 |
?> |
| 89 |
<li class="tb-list__current_item"> |
| 90 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 91 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 92 |
<span><?php echo $count;?></span> |
| 93 |
</a> |
| 94 |
</li> |
| 95 |
<?php |
| 96 |
} else { |
| 97 |
?> |
| 98 |
<li class=""> |
| 99 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 100 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 101 |
<span><?php echo $count;?></span> |
| 102 |
</a> |
| 103 |
</li> |
| 104 |
<?php |
| 105 |
} |
| 106 |
} |
| 107 |
} |
| 108 |
?> |
| 109 |
</ul> |
| 110 |
<ul class="tb-list__cat_lists tb-cat-lists-free"> |
| 111 |
<?php |
| 112 |
$current_tab_cats = array(); |
| 113 |
$count_items = templateberg_template_lists_data()->countFreeItems; |
| 114 |
if (isset($count_items['all'])) { |
| 115 |
$current_tab_cats =$count_items['all']; |
| 116 |
} |
| 117 |
if (!empty($current_tab_cats)) { |
| 118 |
foreach ($current_tab_cats as $cat => $count) { |
| 119 |
if ($cat === 'all-free') { |
| 120 |
?> |
| 121 |
<li class="tb-list__current_item"> |
| 122 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 123 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 124 |
<span><?php echo $count;?></span> |
| 125 |
</a> |
| 126 |
</li> |
| 127 |
<?php |
| 128 |
} else { |
| 129 |
?> |
| 130 |
<li class=""> |
| 131 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 132 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 133 |
<span><?php echo $count;?></span> |
| 134 |
</a> |
| 135 |
</li> |
| 136 |
<?php |
| 137 |
} |
| 138 |
} |
| 139 |
} |
| 140 |
?> |
| 141 |
</ul> |
| 142 |
<ul class="tb-list__cat_lists tb-cat-lists-pro"> |
| 143 |
<?php |
| 144 |
$current_tab_cats = array(); |
| 145 |
$count_items = templateberg_template_lists_data()->countProItems; |
| 146 |
if (isset($count_items['all'])) { |
| 147 |
$current_tab_cats =$count_items['all']; |
| 148 |
} |
| 149 |
if (!empty($current_tab_cats)) { |
| 150 |
foreach ($current_tab_cats as $cat => $count) { |
| 151 |
if ($cat === 'all-pro') { |
| 152 |
?> |
| 153 |
<li class="tb-list__current_item"> |
| 154 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 155 |
<?php echo esc_html__('All Items', 'templateberg'); ?> |
| 156 |
<span><?php echo $count;?></span> |
| 157 |
</a> |
| 158 |
</li> |
| 159 |
<?php |
| 160 |
} else { |
| 161 |
?> |
| 162 |
<li class=""> |
| 163 |
<a href="#" data-cat="<?php echo esc_attr($cat);?>"> |
| 164 |
<?php echo esc_html(ucwords(str_replace("-", " ", $cat)));?> |
| 165 |
<span><?php echo $count;?></span> |
| 166 |
</a> |
| 167 |
</li> |
| 168 |
<?php |
| 169 |
} |
| 170 |
} |
| 171 |
} |
| 172 |
?> |
| 173 |
</ul> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
<div class="tb-list__container"> |
| 177 |
<div> |
| 178 |
<span class="tb-list__btn"><i class="fas fa-bars"></i></span> |
| 179 |
</div> |
| 180 |
<div class="tb-list__header"> |
| 181 |
<div class="tb-list__links"> |
| 182 |
<a href="#" class="tb-list__cat_btn" data-type="purchased"> |
| 183 |
<i class="fas fa-history"></i> |
| 184 |
<?php echo esc_html__('Purchased', 'templateberg'); ?> |
| 185 |
</a> |
| 186 |
<a href="#" class="tb-list__cat_btn is-selected" data-type="all"> |
| 187 |
<i class="fas fa-images"></i> |
| 188 |
<?php echo esc_html__('All', 'templateberg'); ?> |
| 189 |
</a> |
| 190 |
<?php |
| 191 |
$current_tab_data = $data['all']; |
| 192 |
if (isset($data['normal'])) { |
| 193 |
?> |
| 194 |
<a href="#" class="tb-list__cat_btn" data-type="normal"> |
| 195 |
<i class="fas fa-images"></i> |
| 196 |
<?php echo esc_html__('Normal', 'templateberg'); ?> |
| 197 |
</a> |
| 198 |
<?php |
| 199 |
} |
| 200 |
if (isset($data['gutenberg'])) { |
| 201 |
?> |
| 202 |
<a href="#" class="tb-list__cat_btn" data-type="gutenberg"> |
| 203 |
<i class="far fa-file"></i> |
| 204 |
<?php echo esc_html__('Gutenberg', 'templateberg'); ?> |
| 205 |
</a> |
| 206 |
<?php |
| 207 |
} |
| 208 |
if (isset($data['full-site-editing'])) { |
| 209 |
?> |
| 210 |
<a href="#" class="tb-list__cat_btn" data-type="full-site-editing"> |
| 211 |
<i class="fas fa-th-large"></i> |
| 212 |
<?php echo esc_html__('Full Site Editing', 'templateberg'); ?> |
| 213 |
</a> |
| 214 |
<?php |
| 215 |
} |
| 216 |
if (isset($data['elementor'])) { |
| 217 |
?> |
| 218 |
<a href="#" class="tb-list__cat_btn" data-type="elementor"> |
| 219 |
<i class="fas fa-th-large"></i> |
| 220 |
<?php echo esc_html__('Elementor', 'templateberg'); ?> |
| 221 |
</a> |
| 222 |
<?php |
| 223 |
} |
| 224 |
?> |
| 225 |
</div> |
| 226 |
<div class="tb-list__actions"> |
| 227 |
<div class="tb-list__sorting"> |
| 228 |
<label for="tb-list__sorting_select"><?php echo esc_html__('Sort by', 'templateberg'); ?> :</label> |
| 229 |
<select name="tb-list__sorting" id="tb-list__sorting_select"> |
| 230 |
<option value="newest" selected><?php echo esc_html__('Newest Items', 'templateberg'); ?></option> |
| 231 |
<option value="popularity"><?php echo esc_html__('Popular Items', 'templateberg'); ?></option> |
| 232 |
</select> |
| 233 |
</div> |
| 234 |
<!--Added--> |
| 235 |
<div class="tb-current-themes-template-kits-refresh"> |
| 236 |
<span class="dashicon dashicons dashicons-image-rotate"></span> |
| 237 |
</div> |
| 238 |
</div> |
| 239 |
</div> |
| 240 |
<div class="tb-list__content"> |
| 241 |
<?php |
| 242 |
if (!empty($current_tab_data)) { |
| 243 |
foreach ($current_tab_data as $item) { |
| 244 |
?> |
| 245 |
<div aria-label="<?php echo esc_attr($item['title'])?>" |
| 246 |
class="tb-list__item tb-list__active_theme" data-id="<?php echo esc_attr($item['id'])?>" |
| 247 |
data-type="<?php echo esc_attr($item['type']);?>"> |
| 248 |
<div class="tb-list__item_preview"> |
| 249 |
<img src="<?php echo esc_url($item['screenshot_url']);?>" loading="lazy"> |
| 250 |
<span class="tb-list__author"><i class="fas fa-user"></i> |
| 251 |
<?php |
| 252 |
echo esc_html__('By : ', 'templateberg'). |
| 253 |
esc_html(ucwords($item['author'])); ?> |
| 254 |
</span> |
| 255 |
</div> |
| 256 |
<div class="tb-list__item_footer"> |
| 257 |
<div class="tb-list__item_price"> |
| 258 |
<?php $tb_download_price = (int) $item['price']; ?> |
| 259 |
<span> |
| 260 |
<?php |
| 261 |
if ($tb_download_price > 0) : |
| 262 |
echo wp_kses_post($item['price_with_symbol']); |
| 263 |
else : |
| 264 |
echo esc_html__('Free', 'templateberg'); |
| 265 |
endif; |
| 266 |
?> |
| 267 |
</span> |
| 268 |
</div> |
| 269 |
<div class="tb-list__item_meta"> |
| 270 |
<h4> |
| 271 |
<a class="tb-list__item_title_link" href="<?php echo esc_url($item['permalink'])?>" target="_blank" rel="noopener"> |
| 272 |
<?php echo esc_attr($item['title'])?> |
| 273 |
</a> |
| 274 |
</h4> |
| 275 |
|
| 276 |
<?php |
| 277 |
if (isset($item['theme'])) { |
| 278 |
?> |
| 279 |
<span class="tb-list__item-theme"> |
| 280 |
<span class="tb-list__item-theme--link" data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" ><span class="dashicons dashicons-saved"></span><?php echo esc_attr($item['theme']['name'])?></span> |
| 281 |
</span> |
| 282 |
<?php |
| 283 |
} |
| 284 |
?> |
| 285 |
</div> |
| 286 |
<div class="tb-list__item_actions"> |
| 287 |
<a class="tb-item__preview_link" href="<?php echo esc_url($item['demo_url']);?>" target="_blank"><?php echo esc_html__('Preview', 'templateberg'); ?></a> |
| 288 |
|
| 289 |
<?php |
| 290 |
if (templateberg_is_current_theme_template_available($item)) { |
| 291 |
?> |
| 292 |
<a class="tb-list__item_btn tb-list__item_buy_btn" |
| 293 |
data-id="<?php echo esc_attr($item['id'])?>" |
| 294 |
data-is_pro="<?php echo esc_attr(( $tb_download_price > 0 ) ? 'pro' : 'free'); ?>" |
| 295 |
data-is_available="yes" |
| 296 |
data-theme_name="<?php echo esc_attr($item['theme']['name'])?>" |
| 297 |
data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" |
| 298 |
href="<?php echo esc_url($item['permalink'])?>" target="_blank" |
| 299 |
rel="noopener" |
| 300 |
> |
| 301 |
<?php |
| 302 |
echo esc_html__('Import', 'templateberg'); |
| 303 |
?> |
| 304 |
</a> |
| 305 |
<?php |
| 306 |
} else { |
| 307 |
?> |
| 308 |
<a class="tb-list__item_btn tb-list__item_buy_btn" |
| 309 |
data-id="<?php echo esc_attr($item['id'])?>" |
| 310 |
data-is_pro="<?php echo esc_attr(( $tb_download_price > 0 ) ? 'pro' : 'free'); ?>" |
| 311 |
data-is_available="no" |
| 312 |
data-theme_name="<?php echo esc_attr($item['theme']['name'])?>" |
| 313 |
data-theme_slug="<?php echo esc_attr($item['theme']['slug'])?>" |
| 314 |
href="<?php echo esc_url($item['permalink'])?>" |
| 315 |
target="_blank" |
| 316 |
rel="noopener" |
| 317 |
> |
| 318 |
<?php |
| 319 |
echo esc_html__('Purchase', 'templateberg'); |
| 320 |
?> |
| 321 |
</a> |
| 322 |
<?php |
| 323 |
} |
| 324 |
?> |
| 325 |
</div> |
| 326 |
</div> |
| 327 |
</div> |
| 328 |
<?php |
| 329 |
} |
| 330 |
} |
| 331 |
?> |
| 332 |
</div> |
| 333 |
<?php |
| 334 |
echo templateberg_pagination($paged, $max_pages); |
| 335 |
?> |
| 336 |
</div> |
| 337 |
</div> |
| 338 |
<?php |
| 339 |
// Scripts. |
| 340 |
wp_enqueue_script( |
| 341 |
'templateberg-current-theme', // Handle. |
| 342 |
TEMPLATEBERG_URL . 'dist/current.min.js', // Block.build.js: We register the block here. Built with Webpack. |
| 343 |
array( 'jquery' ), // Dependencies, defined above. |
| 344 |
TEMPLATEBERG_VERSION, // Version: File modification time. |
| 345 |
true // Enqueue the script in the footer. |
| 346 |
); |
| 347 |
wp_localize_script( |
| 348 |
'templateberg-current-theme', |
| 349 |
'templateberg_current_theme', |
| 350 |
array( |
| 351 |
'restNonce' => wp_create_nonce('wp_rest'), |
| 352 |
'restUrl' => esc_url_raw(rest_url()), |
| 353 |
'purchasesIds' => $current_theme_purchase_id, |
| 354 |
'popularThemes' => $themes_list_popular, |
| 355 |
'allThemes' => $themes_list, |
| 356 |
'text' => array( |
| 357 |
'import' => esc_html__('Import', 'templateberg'), |
| 358 |
'purchase' => esc_html__('Purchase', 'templateberg'), |
| 359 |
'preview' => esc_html__('Preview', 'templateberg'), |
| 360 |
'noItem' => esc_html__('No item on selected categories!', 'templateberg'), |
| 361 |
'allItems' => esc_html__('All Items', 'templateberg'), |
| 362 |
'by' => esc_html__('By', 'templateberg'), |
| 363 |
'templates' => esc_html__('Templates', 'templateberg'), |
| 364 |
), |
| 365 |
) |
| 366 |
); |
| 367 |
|