public static function page_template_init($args = array()) { $plugin_path = isset($args['plugin_path']) ? untrailingslashit($args['plugin_path']) : ''; $folder_path = isset($args['folder_path']) ? untrailingslashit($args['folder_path']) : ''; $templates = isset($args['templates']) ? $args['templates'] : array(); if (empty($plugin_path) || !is_array($templates)) { return; } $page_template = new SB_Page_Template(); $page_template->set_plugin_path($plugin_path); if (!empty($folder_path)) { $page_template->set_folder_path($folder_path); } $page_template->add_array_templates($templates); return $page_template; }
public static function create_page_template($args = array()) { $plugin_path = isset($args['plugin_path']) ? $args['plugin_path'] : ''; $folder_path = isset($args['folder_path']) ? $args['folder_path'] : ''; $templates = isset($args['templates']) ? $args['templates'] : array(); if (empty($plugin_path) || !is_array($templates)) { return; } $page_template = new SB_Page_Template(); $page_template->set_plugin_path($plugin_path); if (!empty($folder_path)) { $page_template->set_folder_path($folder_path); } $page_template->add_array_templates($templates); $page_template->hook(); }
public static function get_instance() { if (null == self::$instance) { self::$instance = new SB_Page_Template(); } return self::$instance; }