/** * Add language translations to update_plugins or update_themes transients. * * @param $transient * * @return mixed */ public function pre_set_site_transient($transient) { $locales = get_available_languages(); $locales = !empty($locales) ? $locales : array(get_locale()); $repos = array(); if (!isset($transient->translations)) { return $transient; } if ('pre_set_site_transient_update_plugins' === current_filter()) { $repos = Plugin::instance()->get_plugin_configs(); $translations = wp_get_installed_translations('plugins'); } if ('pre_set_site_transient_update_themes' === current_filter()) { $repos = Theme::instance()->get_theme_configs(); $translations = wp_get_installed_translations('themes'); } $repos = array_filter($repos, function ($e) { return isset($e->language_packs); }); foreach ($repos as $repo) { foreach ($locales as $locale) { $lang_pack_mod = isset($repo->language_packs->{$locale}) ? strtotime($repo->language_packs->{$locale}->updated) : 0; $translation_mod = isset($translations[$repo->repo][$locale]) ? strtotime($translations[$repo->repo][$locale]['PO-Revision-Date']) : 0; if ($lang_pack_mod > $translation_mod) { $transient->translations[] = (array) $repo->language_packs->{$locale}; } } } $transient->translations = array_unique($transient->translations, SORT_REGULAR); return $transient; }
public function after($response) { if (empty($response) or !$response instanceof Response) { $response = \Response::forge(\Theme::instance()->render()); } return parent::after($response); }
public function action_index() { if (\Input::method() == 'POST') { if (!\Extension\NoCsrf::check()) { // validate token failed $output['form_status'] = 'error'; $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token'); } else { // update to 1.5 first time $result = \Fs\update0001::run(); // update to 1.5.4 $result = \Fs\update0002::run(); if ($result === true) { $output['hide_form'] = true; $output['form_status'] = 'success'; $output['form_status_message'] = \Lang::get('fs_update_completed'); } else { $output['form_status'] = 'error'; $output['form_status_message'] = \Lang::get('fs_failed_to_update'); } } } // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = \Lang::get('fs_updater'); // <head> output ---------------------------------------------------------------------------------------------- $theme = \Theme::instance(); return $theme->view('update_v', $output, false); }
protected function show($slug = false) { if (isset($sorting)) { Model_Category::$sorting = $sorting; } if ($category = Model_Category::get_by_slug($slug)) { // TODO delete this srand($category->id); $items = null; $parent_category = null; if ($category->parent_id == 0) { $view_file = 'category'; // Categories $items = Model_Category::find(array('where' => array('parent_id' => $category->id, 'status' => 1), 'order_by' => array('sort' => 'asc'))); } else { $view_file = 'subcategory'; // Products $items = $category->products; $parent_category = Model_Category::find_one_by_id($category->parent_id); } \Helper::sorting($items); // Reset to empty array if there are no result found by query if (is_null($items)) { $items = array(); } // Initiate pagination $pagination = \Hybrid\Pagination::make(array('total_items' => count($items), 'per_page' => \Input::get('per_page', 15), 'uri_segment' => null)); // Remove unwanted items, and show only required ones $items = array_slice($items, $pagination->offset, $pagination->per_page); \Theme::instance()->set_partial('content', $this->view_dir . $view_file)->set('category', $category, false)->set('parent_category', $parent_category, false)->set('items', $items, false)->set('pagination', $pagination, false); } else { throw new \HttpNotFoundException(); } }
public function build($action = null) { $data = array(); $attributes = $this->get_config('form_attributes'); if ($action and ($this->fieldset_tag == 'form' or empty($this->fieldset_tag))) { $attributes['action'] = $action; } $data['form_open'] = ($this->fieldset_tag == 'form' or empty($this->fieldset_tag)) ? $this->form()->open($attributes) . PHP_EOL : $this->form()->{$this->fieldset_tag . '_open'}($attributes); $data['fields'] = ''; foreach ($this->field() as $f) { $data['fields'] .= $f->build() . PHP_EOL; } $data['form_close'] = ($this->fieldset_tag == 'form' or empty($this->fieldset_tag)) ? $this->form()->close($attributes) . PHP_EOL : $this->form()->{$this->fieldset_tag . '_close'}($attributes); try { return \Theme::instance()->view('form/fieldset', $data)->render(); } catch (\Exception $e) { return \View::forge('form/fieldset', $data)->render(); } /*$template = $this->form()->get_config((empty($this->fieldset_tag) ? 'form' : $this->fieldset_tag).'_template', "\n\t\t{open}\n\t\t<table>\n{fields}\n\t\t</table>\n\t\t{close}\n"); $template = str_replace(array('{form_open}', '{open}', '{fields}', '{form_close}', '{close}'), array($open, $open, $fields_output, $close, $close), $template); return $template;*/ }
/** * get admin's avatar picture. * * @param integer $account_id * @return string return element ready for display avatar. */ function getAdminAvatar($account_id) { // set default avatar $theme = \Theme::instance(); $doc_root = str_replace('\\', '/', DOCROOT); $default_avatar_getfile = $theme->asset->get_file('default-avatar.jpg', 'img'); $default_no_avatar = str_replace([$doc_root, \Uri::base()], '', $default_avatar_getfile); unset($doc_root, $default_avatar_getfile, $theme); if (!is_numeric($account_id) || intval($account_id) === intval(0)) { return $default_no_avatar; } $cache_name = 'public.themes.sys2.getAdminAvatar-' . \Model_Sites::getSiteId(false) . '-' . $account_id; $cache_data = \Extension\Cache::getSilence($cache_name); if (false === $cache_data) { // if never cached or cache expired. $result = \DB::select()->as_object()->from('accounts')->where('account_id', $account_id)->execute(); if (count($result) > 0) { $row = $result->current(); if ($row->account_avatar != null) { $return_val = $row->account_avatar; \Cache::set($cache_name, $return_val, 86400); unset($cache_name); return $return_val; } } if (!isset($return_val) || isset($return_val) && $return_val == null) { // not found account or not found avatar. \Cache::set($cache_name, $default_no_avatar, 86400); unset($cache_name); return $default_no_avatar; } } unset($cache_name); return $cache_data; }
/** * Send email to group of admin users * * @param type $group_name * @param type $subject * @param type $view * @param type $email_data * @param type $attachment = Attache a file * @param type $theme = theme to load views from * @return boolean * @throws \Exception */ public static function send_email_to_group($group_name, $subject, $view, $email_data, $attachment = false) { \Config::load('auto_response_emails', 'auto_response_emails', true); $emails = \Config::get('auto_response_emails.' . $group_name . '_emails', false); if ($emails == false) { $emails = \Config::get('auto_response_emails.default_emails', false); } $bcc = \Config::get('auto_response_emails.bcc'); $email = \Email::forge(); $email->cc($emails); if ($bcc) { $email->bcc($bcc); } $email->subject($subject); $email->from(\Config::get('auto_response_emails.autoresponder_from_email'), \Config::get('site_title')); if ($attachment) { $email->attach($attachment); } $emailView = \Theme::instance()->view('views/' . $view)->set('email_data', $email_data, false); $email->html_body($emailView); try { $email->send(); } catch (\Exception $e) { if (\Fuel::$env == 'development') { throw new \Exception($e->getMessage()); } else { return false; } } return true; }
/** * The index action * * @access public * @return void */ public function action_index() { $settings = \Config::load('autoresponder.db'); // $autoResponder = Model_Setting::find(array('where' => array(array('meta_key', '=', 'auto-responders')))); if (\Input::post()) { $input = \Input::post(); if (!\Input::is_ajax()) { $val = Model_Setting::validate('create'); if (!$val->run()) { if ($val->error() != array()) { // show validation errors \Messages::error('<strong>There was an error while trying to create settings</strong>'); foreach ($val->error() as $e) { \Messages::error($e->get_message()); } } } else { try { \Config::save('autoresponder.db', array('logo_url' => $input['logo_url'], 'company_name' => $input['company_name'], 'address' => $input['address'], 'website' => $input['website'], 'phone' => $input['phone'], 'email_address' => $input['email_address'], 'sender_email_address' => $input['sender_email_address'], 'contact_us_email_address' => $input['contact_us_email_address'], 'instagram_account_name' => $input['instagram_account_name'], 'facebook_account_name' => $input['facebook_account_name'])); // $setting->save(); \Messages::success('Settings successfully created.'); \Response::redirect('admin/settings'); } catch (\Database_Exception $e) { // show validation errors \Messages::error('<strong>There was an error while trying to create settings.</strong>'); // Uncomment lines below to show database errors $errors = $e->getMessage(); \Messages::error($errors); } } } } \View::set_global('title', 'Settings'); \Theme::instance()->set_partial('content', $this->view_dir . 'index')->set('settings', $settings, false); }
protected function show($slug = false) { if (isset($sorting)) { Model_Category::$sorting = $sorting; } if ($category = Model_Category::get_by_slug($slug)) { // TODO delete this srand($category->id); $items = null; $parent_category = null; if ($category->parent_id == 0) { $view_file = 'category'; // Categories $items = Model_Category::find(array('where' => array('parent_id' => $category->id, 'status' => 1), 'order_by' => array('sort' => 'asc'))); if (!$items) { $view_file = 'subcategory'; $items = $category->products; } } else { $view_file = 'subcategory'; // Products $items = $category->products; // echo '<pre>'; // print_r($items); // echo '</pre>'; $parent_category = Model_Category::find_one_by_id($category->parent_id); } \Helper::sorting($items); // Reset to empty array if there are no result found by query if (is_null($items)) { $items = array(); } // Initiate pagination $pagination = \Hybrid\Pagination::make(array('total_items' => count($items), 'per_page' => \Input::get('per_page', 15), 'uri_segment' => null)); // Remove unwanted items, and show only required ones $items = array_slice($items, $pagination->offset, $pagination->per_page); $category_parents = false; if ($parent_category) { $parents = array(); if ($category_parents_id = Model_Category::find_parents($category->parent_id, $parents, true)) { $category_parents = Model_Category::find(array('where' => array(array('id', 'in', $category_parents_id)))); } } $stock_options = \Config::load('stock-option.db'); \Theme::instance()->set_partial('content', $this->view_dir . $view_file)->set('category', $category, false)->set('parent_category', $parent_category, false)->set('items', $items, false)->set('category_parents', $category_parents, false)->set('pagination', $pagination, false)->set('manage_stock', $stock_options['manage_stock'], false)->set('hide_out_of_stock', $stock_options['hide_out_of_stock'], false); \View::set_global('title', $category->seo->meta_title ?: $category->title); \View::set_global('meta_description', $category->seo->meta_description ?: ''); \View::set_global('meta_keywords', $category->seo->meta_keywords ?: ''); $robots = array('meta_robots_index' => $category->seo->meta_robots_index == 1 ? 'index' : 'noindex', 'meta_robots_follow' => $category->seo->meta_robots_follow == 1 ? 'follow' : 'nofollow'); \View::set_global('robots', $robots); \View::set_global('canonical', $category->seo->canonical_links); \View::set_global('h1_tag', $category->seo->h1_tag); if ($category->seo->redirect_301) { \Response::redirect($category->seo->redirect_301); } } else { throw new \HttpNotFoundException(); } }
public function index() { $this->theme = Theme::instance(); parent::index(); $feeds = ORM::factory('external_feed')->find_all(); $this->feeds = $feeds; $content = $this->_render_boxes(); $this->__set_options(array('content' => $content, 'feeds' => $this->feeds, 'theme' => $this->theme, 'profile_links' => $this->_render_profiles())); }
public function action_404() { Lang::load('error', 'error'); $output['error_head'] = Lang::get('error.404_error_head'); $output['error_content'] = Lang::get('error.404_error_content', array('home_link' => Uri::base())); // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = Lang::get('error.404_page_title'); // <head> output ---------------------------------------------------------------------------------------------- return Response::forge(Theme::instance()->view('error/404_v', $output)->auto_filter(false), 404); }
public function before() { parent::before(); \Theme::instance()->active('admin'); \Theme::instance()->set_template($this->template); // Assign current_user to the instance so controllers can use it $this->current_user = \Sentry::check() ? \Sentry::user() : null; // Set a global variable so views can use it \View::set_global('current_user', $this->current_user); }
protected function template($build_field) { $form = $this->fieldset()->form(); // init data array $data = array('field_classes' => ''); $data['required_mark'] = $this->get_attribute('required', null) ? $form->get_config('required_mark', null) : null; $data['label'] = $this->label ? $form->label($this->label, $this->get_attribute('id', null)) : ''; //$error_template = $form->get_config('error_template', ""); $error_msg = $form->get_config('inline_errors') && $this->error() ? str_replace('{error_msg}', $this->error(), $error_template) : ''; $error_class = $this->error() ? $form->get_config('error_class') : ''; // additional content $data['prepended'] = $this->prepended; $data['appended'] = $this->appended; if (is_array($build_field)) { /*$label = $this->label ? $form->label($this->label) : ''; $template = $this->template ?: $form->get_config('multi_field_template', "\t\t<tr>\n\t\t\t<td class=\"{error_class}\">{group_label}{required}</td>\n\t\t\t<td class=\"{error_class}\">{fields}\n\t\t\t\t{field} {label}<br />\n{fields}\t\t\t{error_msg}\n\t\t\t</td>\n\t\t</tr>\n"); if ($template && preg_match('#\{fields\}(.*)\{fields\}#Dus', $template, $match) > 0) { $build_fields = ''; foreach ($build_field as $lbl => $bf) { $bf_temp = str_replace('{label}', $lbl, $match[1]); $bf_temp = str_replace('{required}', $required_mark, $bf_temp); $bf_temp = str_replace('{field}', $bf, $bf_temp); $build_fields .= $bf_temp; } $template = str_replace($match[0], '{fields}', $template); $template = str_replace(array('{group_label}', '{required}', '{fields}', '{error_msg}', '{error_class}'), array($label, $required_mark, $build_fields, $error_msg, $error_class), $template); return $template; } // still here? wasn't a multi field template available, try the normal one with imploded $build_field $build_field = implode(' ', $build_field);*/ } $data['field'] = $build_field; // TODO: add field error class and message if (\Config::get('sform.field_classes')) { $field_classes = array($this->type); $data['field_classes'] = ' class="' . implode(' ', $field_classes) . '"'; } try { return \Theme::instance()->view('form/field', $data)->render(); } catch (\Exception $e) { return \View::forge('form/field', $data)->render(); } /* $template = $this->template ?: $form->get_config('field_template', "\t\t<tr>\n\t\t\t<td class=\"{error_class}\">{label}{required}</td>\n\t\t\t<td class=\"{error_class}\">{field} {error_msg}</td>\n\t\t</tr>\n"); $template = str_replace(array('{label}', '{required}', '{field}', '{error_msg}', '{error_class}'), array($label, $required_mark, $build_field, $error_msg, $error_class), $template); return $template; */ }
public function __construct() { $this->theme = Theme::instance(); $this->zest = new Zest_admin(); parent::__construct(); $this->config = Kohana::config_load('zest'); $this->__setup(); if (request::is_ajax()) { $this->auto_render = FALSE; Event::add('system.post_controller', array($this, '_json_render')); } }
/** * After controller method has run, render the theme template * * @param Response $response */ public function after($response) { if (!\Input::is_ajax()) { // If nothing was returned set the theme instance as the response if (empty($response)) { $response = \Response::forge(\Theme::instance()); } if (!$response instanceof Response) { $response = \Response::forge($response); } return $response; } return parent::after($response); }
/** * The index action * * @access public * @return void */ public function action_index() { $settings = \Config::load('backup.db'); if (\Input::post()) { $input = \Input::post(); if (!\Input::is_ajax()) { $val = Model_Backup::validate('create'); if (!$val->run()) { if ($val->error() != array()) { // show validation errors \Messages::error('<strong>There was an error while trying to create settings</strong>'); foreach ($val->error() as $e) { \Messages::error($e->get_message()); } } } else { try { \Config::save('backup.db', array('enable' => $input['enable'], 'email' => $input['email'], 'period' => $input['period'])); //save cronjob $output = shell_exec('crontab -l'); $db_backup_cron_file = "/tmp/db_backup_cron.txt"; if ($input['enable']) { if ($input['period'] == 'daily') { $daily_backup_command = '0 0 * * * wget ' . \Uri::create('backup/execute'); file_put_contents($db_backup_cron_file, $daily_backup_command . PHP_EOL); } else { if ($input['period'] == 'weekly') { $weekly_backup_command = '0 0 * * 0 wget ' . \Uri::create('backup/execute'); file_put_contents($db_backup_cron_file, $weekly_backup_command . PHP_EOL); } } } else { file_put_contents($db_backup_cron_file, "" . PHP_EOL); } exec("crontab {$db_backup_cron_file}"); \Messages::success('Settings successfully created.'); \Response::redirect('admin/backup'); } catch (\Database_Exception $e) { // show validation errors \Messages::error('<strong>There was an error while trying to create settings.</strong>'); // Uncomment lines below to show database errors $errors = $e->getMessage(); \Messages::error($errors); } } } } \View::set_global('title', 'Backup'); \Theme::instance()->set_partial('content', $this->view_dir . 'index')->set('settings', $settings, false); }
/** * default method for this controller. * you may replace code in this method with yours to start build your project. */ public function action_index() { // load language \Lang::load('fslang'); // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = \Model_Config::getval('site_name'); // example for asset and theme asset //\Asset::css('bootstrap.min.css', array(), 'fuelstart'); //\Theme::instance()->asset->css('main.css', array(), 'fuelstart'); //$output['page_meta'][] = \Html::meta('description', 'test-fuel-start-description'); //$output['page_link'][] = html_tag('link', array('rel' => 'stylesheet', 'href' => Uri::createNL(\Theme::instance()->asset_path('css/main.css')))); // end example // <head> output ---------------------------------------------------------------------------------------------- $theme = \Theme::instance(); return $theme->view('front/templates/index_v', $output, false); }
public function before() { // Set template $this->theme = \Theme::instance(); $this->theme->set_template($this->template); // Load translation \Lang::load('blog'); // Get current segments $segments = \Uri::segments(); empty($segments) and $segments[0] = 'home'; $this->dataGlobal['segments'] = $segments; // If ajax or content_only, set a theme with an empty layout if (\Input::is_ajax()) { return parent::before(); } // Don't re-set Media if is an HMVC request !\Request::is_hmvc() and $this->setMedia(); }
/** * Loads the theme and sets the template object */ protected function init() { if (isset($this->theme) === false) { throw new \RuntimeException('Theme property does not exist.'); } if (empty($this->theme) === false and is_string($this->theme)) { $this->theme = \Theme::instance($this->theme); } // Sets active theme if (empty($this->theme_active) === false and is_string($this->theme_active)) { $this->theme->active($this->theme_active); } // Initialize template $this->template_init(); $this->theme->set_template($this->template); // Makes the theme instance available in all views $this->template->set_global('theme', $this->theme, false); }
public function action_cart_listing($type = 'cart') { if (!\Input::is_ajax()) { die('Access Is Not Allowed!'); } $out = array(); $out['cart_empty'] = 0; $items = \Cart::items(); // Cart is empty? if (!$items) { $out['cart_empty'] = 1; } // Product table $out['product_table'] = \Theme::instance()->view('views/order/_partials/product_listing_table', array('items' => $items), false)->render(); // Price table $out['price_table'] = \Theme::instance()->view('views/order/_partials/product_price_table', array('type' => $type), false)->render(); echo json_encode($out); exit; }
/** * Render * * Renders a cell and populates * it's rendered value * * @access public * @param Spark\Grid_Column_Cell Cell * @return Spark\Grid_Column_Renderer_Options */ public function render(\Grid_Column_Cell $cell) { // Get current row from database $results = $cell->get_driver()->get_results()->as_array(); $current = $results[$this->counter++]; // Get options $options = $cell->get_column()->get_options(); // Value fallback $value = ''; // Override the value with an option if (isset($options[$cell->get_original_value()])) { $value = $options[$cell->get_original_value()]; // Create date tooltip if ($cell->get_original_value() == 2) { $value .= '<a href="#" class="activeDate" id="activeDate02" title="' . date('m/d/Y', $current->active_from) . ' - ' . date('m/d/Y', $current->active_to) . '">' . \Theme::instance()->asset->img('icon-calendar.png', array('width' => 16, 'height' => 16, 'alt' => '')) . '</a>'; } } $cell->set_rendered_value($value); return $this; }
/** * The module index * * @return Response */ public function action_index() { \View::set_global('full_page', true); $this->data['title'] = 'Login'; // create the form fieldset, do not add an {open}, a closing ul and a {close}, we have a custom form layout! $fieldset = \Fieldset::forge('login'); $fieldset->add('username', 'Username', array('maxlength' => 50), array(array('required')))->add('password', 'Password', array('type' => 'password', 'maxlength' => 255), array(array('required'), array('min_length', 8))); // was the login form posted? if (\Input::post()) { // run the form validation if (!$fieldset->validation()->run()) { // set any error messages we need to display foreach ($fieldset->validation()->error() as $error) { \Messages::error($error); } } else { try { if (\Sentry::user(\Input::param('username'))->is_admin()) { // check the credentials. $valid_login = \Sentry::login(\Input::param('username'), \Input::param('password'), true); if ($valid_login) { \Messages::success('You have logged in successfully'); if (\Session::get('redirect_to')) { $redirect = \Session::get('redirect_to'); \Session::delete('redirect_to'); } \Response::redirect(isset($redirect) ? $redirect : 'admin'); } else { \Messages::error('Username and/or password is incorrect'); } } else { \Messages::error('Username and/or password is incorrect'); } } catch (\SentryAuthException $e) { $errors = $e->getMessage(); \Messages::error($errors); } } } \Theme::instance()->set_partial('content', 'views/login')->set('fieldset', $fieldset, false); }
public function send() { $email = \Email::forge(); $order = $this->emailData['order']; $email->to($order->shipping_email, ucwords($order->shipping_first_name . ' ' . $order->shipping_last_name)); if ($this->emailData['bcc']) { $email->bcc($this->emailData['bcc']); } $email->subject($this->emailData['site_title'] . ' - Your Order'); $autoresponder_body = \Theme::instance()->view('views/_email/order_confirmation')->set('emailData', $this->emailData, false); $emailHtml = \Theme::instance()->view('views/_email/autoresponder')->set('autoresponder_body', $autoresponder_body); $email->html_body($emailHtml); try { $email->send(); //\Messages::success('A copy of your request has been sent to ' . $this->emailData['order']['billing_email'] . ' for your own reference.'); } catch (\EmailValidationFailedException $e) { \Messages::error('Error while sending email.'); } catch (\EmailSendingFailedException $e) { \Messages::error('Error while sending email.'); } }
public function __construct(user $user, $theme = NULL) { // Store some things for the Theme engine to use $this->user =& $user; $this->help = new HelpManager(); $this->dateManager = new DateManager(); // What is the currently selected theme? $globalTheme = $theme == NULL ? Config::GetSetting('GLOBAL_THEME_NAME', 'default') : $theme; // Is this theme valid? if (!is_dir('theme/' . $globalTheme)) { throw new Exception(__('The theme "%s" does not exist', $globalTheme)); } // Store the theme name for later $this->name = $globalTheme; // Get config if (!file_exists('theme/' . $this->name . '/config.php')) { throw new Exception(__('The theme "%s" config file does not exist', $globalTheme)); } require 'theme/' . $this->name . '/config.php'; $this->config = $config; self::$instance = $this; }
/** * generate whole page * * @param string $view path to view of current controller. * @param array $output * @param boolean $auto_filter * @return view */ public function generatePage($view = null, $output = array(), $auto_filter = null) { if (!is_array($output)) { $output = array(); } // list sites to display links in admin page ------------------------------------------ $cache_name = 'controller.AdminController-generatePage-fs_list_sites'; $cached = \Extension\Cache::getSilence($cache_name); if (false === $cached) { $list_sites_option['list_for'] = 'admin'; $list_sites_option['unlimit'] = true; $list_sites = \Model_Sites::listSites($list_sites_option); \Cache::set($cache_name, $list_sites, 2592000); } else { if (isset($cached['items']) && isset($cached['total'])) { $list_sites = $cached; } else { $list_sites = array('total' => 0, 'items' => array()); } } unset($cache_name, $cached); if (isset($list_sites['total']) && $list_sites['total'] > 1) { if (isset($list_sites['items']) && is_array($list_sites['items']) && !empty($list_sites['items'])) { $output['fs_list_sites'] = $list_sites['items']; } else { $output['fs_list_sites'] = null; } } unset($list_sites, $list_sites_option); // end list sites ------------------------------------------------------------------------ // start theme class $theme = \Theme::instance(); $theme->active($this->theme_system_name); // load requested controller theme into page_content variable. $output['page_content'] = $theme->view($view, $output, $auto_filter); // load main template and put page_content variable in it. return $theme->view('admin/template', $output, $auto_filter); }
public function __construct(database $db, user $user) { // Store some things for the Theme engine to use $this->db =& $db; $this->user =& $user; $this->help = new HelpManager($db, $user); $this->dateManager = new DateManager($db); // TODO: Perhaps we also allow the user to configure their own theme for their session? // What is the currently selected theme? $globalTheme = Config::GetSetting('GLOBAL_THEME_NAME'); // Is this theme valid? if (!is_dir('theme/' . $globalTheme)) { throw new Exception(__('The theme "%s" does not exist', $globalTheme)); } // Store the theme name for later $this->name = $globalTheme; // Get config if (!file_exists('theme/' . $this->name . '/config.php')) { throw new Exception(__('The theme "%s" config file does not exist', $globalTheme)); } require_once 'theme/' . $this->name . '/config.php'; $this->config = $config; self::$instance = $this; }
/** * Change user password * * @param unknown_type $email * @param unknown_type $hash */ public function action_reset_password($email = false, $hash = false) { if ($email && $hash) { //Keep existing messages \Messages::instance()->shutdown(); try { if (\Sentry::reset_password_confirm($email, $hash)) { if (\Input::post('new_password') && \Input::post('confirm_new_password')) { if (\Sentry::reset_password_save($email, \Input::post('new_password'))) { \Messages::success('Password successfully changed. Please login and start using your account.'); \Response::redirect(\Uri::front_create('user/login')); } else { \Messages::error('Password was not save.'); \Theme::instance()->set_partial('content', $this->view_dir . 'reset_password'); } } else { \Theme::instance()->set_partial('content', $this->view_dir . 'reset_password'); } } else { \Messages::error('Wrong reset code. Please check your email and try again.'); \Response::redirect(\Uri::front_create('user/login')); } } catch (\Sentry\SentryException $e) { // show validation errors //\Messages::error('<h4>There was an error while trying activate user</h4>'); $errors = $e->getMessage(); \Messages::error($errors); } } }
public function theme_asset_img($images = array(), $attr = array(), $group = null) { return \Theme::instance()->asset->img($images, $attr, $group); }
</tr> <?php } ?> <?php } ?> <?php if (\Config::get('details.image.multiple', false) || empty($item->images)) { ?> <tr class="nodrop nodrag"> <td class="center noresize"> <?php echo \Theme::instance()->asset->img('icon-image-grey.png', array('width' => '80', 'height' => '80', 'alt' => '')); ?> </td> <td class="upload"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="noresize">Alt Text</td> <td> <div class="input_holder"> <?php //echo \Form::input('alt_text_new_1', \Input::post('alt_text_new_1')); ?> <?php echo \Form::input('alt_text_new_' . $item->id, \Input::post('alt_text_new_' . $item->id)); ?> </div>
</div> </div> </div> </div> </div><!-- EOF Redirects Panel --> <!-- Meta Robots Panel --> <div class="panel"> <div class="panelHeader"> <div class="togglePanel closed"><a> <?php echo \Theme::instance()->asset->img('panelToggle-minus.gif', array('width' => 10, 'height' => 10, 'alt' => '')); ?> </a><a> <?php echo \Theme::instance()->asset->img('panelToggle-plus.gif', array('width' => 10, 'height' => 10, 'alt' => '')); ?> </a></div> <h4>Robots</h4> </div> <div class="panelContent"> <div class="row-fluid"> <div class="formRow"> <label>Robots Tag</label> <div class="input_holder"> <label class="radio"><?php echo \Form::radio('meta_robots_index', 1, \Input::post('meta_robots_index', $product->seo->meta_robots_index)); ?> Index (Default)</label> <label class="radio"><?php echo \Form::radio('meta_robots_index', 0, \Input::post('meta_robots_index', $product->seo->meta_robots_index));