added additional plugins
This commit is contained in:
parent
c85895d306
commit
00e60ec1b7
132 changed files with 27514 additions and 0 deletions
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Ticket Tailor Template Loader
|
||||
*
|
||||
* Handles template loading with theme override support
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Ticket_Tailor_Template_Loader {
|
||||
|
||||
/**
|
||||
* Get template path
|
||||
*
|
||||
* Checks theme folder first, then plugin folder
|
||||
*/
|
||||
public static function get_template_path($template_name) {
|
||||
$template = '';
|
||||
|
||||
// Check in theme
|
||||
$theme_template = locate_template(array(
|
||||
'ticket-tailor/' . $template_name,
|
||||
$template_name,
|
||||
));
|
||||
|
||||
if ($theme_template) {
|
||||
$template = $theme_template;
|
||||
} else {
|
||||
// Use plugin template
|
||||
$template = TICKET_TAILOR_PLUGIN_DIR . 'templates/' . $template_name;
|
||||
}
|
||||
|
||||
return apply_filters('ticket_tailor_template_path', $template, $template_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template
|
||||
*/
|
||||
public static function load_template($template_name, $args = array()) {
|
||||
$template_path = self::get_template_path($template_name);
|
||||
|
||||
if (!file_exists($template_path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract variables
|
||||
if (!empty($args) && is_array($args)) {
|
||||
extract($args);
|
||||
}
|
||||
|
||||
include $template_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template HTML
|
||||
*/
|
||||
public static function get_template_html($template_name, $args = array()) {
|
||||
ob_start();
|
||||
self::load_template($template_name, $args);
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue