function render($is_publish = false) { $index_path = $this->template_file_path('index'); if (!file_exists($index_path)) { die('No index.php in the template.'); exit; } // Temporary notification of API change // We'll remove this before beta launch if ($files = $this->old_api_detected()) { die('<div style="margin: 50px 100px; font-family: sans-serif; line-height: 1.4em;"> Ooops, looks like you haven\'t converted your template to our new API.<br /> We\'ve detected the following files making use of <code>$this-></code> which is now deprecated:<br /><ul>' . $files . '</ul> For details on this, please see <a href="https://plus.google.com/u/0/103798016457548612622/posts/BoMn41W1q6L" target="_blank">the post on our Google+ Community</a>.</div> '); } $code_path = $this->config->templates_path . '/' . $this->active_template . '/code.php'; Inc::class_file($code_path); $path = $this->config->templates_path . '/' . $this->active_template; if (class_exists('\\User\\Template\\Code', false)) { $template_class = '\\User\\Template\\Code'; } else { $template_class = '\\Leeflets\\Template\\Code'; } $template = new $template_class($is_publish, $this->config, $this->filesystem, $this->router, $this->settings, $this->hook, $this->script, $this->style, $this->content); $template_objects = array('template' => $template, 'content' => new Template\Content($this->content->get_data()), 'upload' => new Template\Upload($this->router), 'image' => new Template\Image($this->router), 'settings' => new Template\Settings($this->settings), 'hook' => $this->hook); $template_objects = $this->hook->apply('template_render_objects', $template_objects); return Inc::content($index_path, $template_objects); }
function load_active() { $active_addons = $this->settings->get('active_addons'); if (!$active_addons) { return false; } $deactivate = array(); foreach ($active_addons as $addon) { $path = $this->config->addons_path . '/' . $addon . '/' . $addon . '.php'; if (!file_exists($path)) { $deactivate[] = $addon; } else { Inc::class_file($path); $class_name = \Leeflets\String::camelize($addon); $class_name = '\\Leeflets\\User\\Addon\\' . $class_name; $this->instances[$addon] = $obj = new $class_name(); $obj->load_objects($this->config, $this->settings, $this->hook, $this->admin_script, $this->admin_style, $this->template_script, $this->template_style, $this->filesystem, $this->router); $obj->init(); } } if ($deactivate) { $this->deactivate($deactivate); } }