Exemplo n.º 1
0
 public function set($plugin, $keyword, $replace = array(), $pageTitle = true)
 {
     if (!($data = $this->cache->item('core_meta_tags_' . $plugin . '_' . session::item('language')))) {
         $data = array();
         $result = $this->db->query("SELECT * FROM `:prefix:core_meta_tags` WHERE `plugin`=?", array($plugin))->result();
         foreach ($result as $tags) {
             $data[$tags['keyword']]['title'] = $tags['meta_title_' . session::item('language')];
             $data[$tags['keyword']]['description'] = $tags['meta_description_' . session::item('language')];
             $data[$tags['keyword']]['keywords'] = $tags['meta_keywords_' . session::item('language')];
         }
         $this->cache->set('core_meta_tags_' . $plugin . '_' . session::item('language'), $data, 60 * 60 * 24 * 30);
     }
     foreach ($replace as $section => $array) {
         foreach ($array as $k => $v) {
             $k = '[' . $section . '.' . $k . ']';
             if (is_array($v)) {
                 $v = count($v) == 1 ? current($v) : implode(',', $v);
             }
             $data[$keyword]['title'] = utf8::str_replace($k, $v, $data[$keyword]['title']);
             $data[$keyword]['description'] = utf8::str_replace($k, $v, $data[$keyword]['description']);
             $data[$keyword]['keywords'] = utf8::str_replace($k, $v, $data[$keyword]['keywords']);
         }
     }
     if (isset($data[$keyword])) {
         if ($pageTitle) {
             view::setTitle($data[$keyword]['title']);
         } else {
             view::setMetaTitle($data[$keyword]['title']);
         }
         view::setMetaDescription($data[$keyword]['description']);
         view::setMetaKeywords($data[$keyword]['keywords']);
     }
 }
Exemplo n.º 2
0
 public function manage()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Assign user from session to variable
     $user = session::section('session');
     $user['config'] = session::section('config');
     // Get user counters
     $counters = hook::filter('users/profile/view/counters', array(), $user);
     // Merge user and counters
     if ($counters) {
         $user = array_merge($user, $counters);
     }
     // Get fields
     $fields = $this->fields_model->getFields('users', session::item('type_id'), 'view', 'in_view');
     // Delete empty sections
     $this->fields_model->deleteEmptySections($fields, $user);
     // Assign vars
     view::assign(array('user' => $user, 'fields' => $fields));
     // Set title
     view::setMetaTitle(__('my_profile', 'system_navigation'));
     // Set trail
     view::setTrail($user['slug'], __('my_profile', 'system_navigation'));
     if (config::item('user_last_visit', 'users')) {
         if (!$user['invisible']) {
             if ($user['online']) {
                 view::setTrail(false, '<span class="users online">' . __('status_online', 'users') . '</span>', array('side' => true));
             } else {
                 view::setTrail(false, '<span class="users date">' . __('status_visit_date', 'users', array('%span' => utf8::strtolower(date_helper::humanSpan($user['visit_date'])))) . '</span>', array('side' => true));
             }
         }
     }
     // Load view
     view::load('users/profile/view');
 }