render($templateFile, $vars, $useRelativePath); return $content; } public function render($templateFile, $vars = [], $useRelativePath = true) { ob_start(); $vars = array_merge($vars, $this->data); extract($vars); // relative to the plugin folder if ($useRelativePath == true) { // /wp-content/plugins/cancms-float-bar/ $templateFile = CANCMS_FLOATBAR_PLUGIN_ABSPATH . "tpl/$templateFile"; } // showme($templateFile); if(file_exists($templateFile)) { require($templateFile); } return ob_get_clean(); } public function assign($key, $val = '') { if (is_array($key)) { $this->data = array_merge($this->data, $key); // key is array } else { $this->data[$key] = $val; // key is string } } }