本文整理汇总了PHP中html_helper类的典型用法代码示例。如果您正苦于以下问题:PHP html_helper类的具体用法?PHP html_helper怎么用?PHP html_helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了html_helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usersViewActionsAlbums
public function usersViewActionsAlbums($user)
{
if (!$user['total_albums']) {
return '';
}
echo '<li class="pictures-albums">' . html_helper::anchor('pictures/user/' . text_helper::entities($user['username']), __('pictures_albums', 'system_navigation') . ' (' . $user['total_albums'] . ')') . '</li>';
}
示例2: browse
public function browse()
{
// Get URI vars
$groupID = (int) uri::segment(5);
// Get group
if (!$groupID || !($group = $this->banners_groups_model->getGroup($groupID))) {
view::setError(__('no_group', 'banners'));
router::redirect('cp/content/banners/groups');
}
// Process query string
$params = $this->parseQuerystring();
// Get banners
if (!($banners = $this->banners_model->getBanners($groupID, $params))) {
view::setInfo(__('no_banners', 'banners'));
}
// Create table grid
$grid = array('uri' => 'cp/content/banners/browse/' . $groupID, 'keyword' => 'banners', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'total_views' => array('html' => __('banner_views', 'banners'), 'class' => 'views', 'sortable' => true), 'total_clicks' => array('html' => __('banner_clicks', 'banners'), 'class' => 'clicks', 'sortable' => true), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($banners as $banner) {
$grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], text_helper::truncate(text_helper::entities($banner['name']), 64))), 'total_views' => array('html' => $banner['total_views']), 'total_clicks' => array('html' => $banner['total_clicks']), 'status' => array('html' => $banner['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/banners/delete/' . $groupID . '/' . $banner['banner_id'], __('delete', 'system'), array('data-html' => __('banner_delete?', 'banners'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Filter hooks
hook::filter('cp/content/banners/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('banners_manage', 'system_navigation'));
// Set trail
view::setTrail('cp/content/banners/groups/edit/' . $groupID, __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name']));
view::setTrail('cp/content/banners/browse/' . $groupID, __('banners', 'banners'));
// Assign actions
view::setAction('cp/content/banners/edit/' . $groupID, __('banner_new', 'banners'), array('class' => 'icon-text icon-banners-new'));
// Load view
view::load('cp/content/banners/browse');
}
示例3: index
public function index()
{
// Get storage services
if (!($services = $this->storage_model->scanServices())) {
view::setError(__('no_services', 'system_storage'));
router::redirect('cp/system/config/system');
}
// Create table grid
$grid = array('uri' => 'cp/system/storage', 'keyword' => 'storages', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'description' => array('html' => __('description', 'system'), 'class' => 'description'), 'status' => array('html' => __('default', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($services as $service) {
$actions = $status = array();
if (isset($service['service_id']) && $service['service_id']) {
$status['html'] = $service['default'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : html_helper::anchor('cp/system/storage/setdefault/' . $service['keyword'], __('no', 'system'), array('class' => 'label important small'));
$actions['html']['settings'] = html_helper::anchor('cp/system/storage/settings/' . $service['keyword'], __('settings', 'system'), array('class' => 'settings'));
$actions['html']['uninstall'] = html_helper::anchor('cp/system/storage/uninstall/' . $service['keyword'], __('uninstall', 'system'), array('data-html' => __('service_uninstall?', 'system_storage'), 'data-role' => 'confirm', 'class' => 'uninstall'));
} else {
$status['html'] = '<span class="label important small">' . __('no', 'system') . '</span>';
$actions['html']['install'] = html_helper::anchor('cp/system/storage/install/' . $service['keyword'], __('install', 'system'), array('class' => 'install'));
}
$grid['content'][] = array('name' => array('html' => text_helper::entities($service['name'])), 'description' => array('html' => text_helper::entities($service['description'])), 'status' => $status, 'actions' => $actions);
}
// Filter hooks
hook::filter('cp/system/storage/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('system_storages_manage', 'system_navigation'));
// Load view
view::load('cp/system/storage/browse');
}
示例4: browse
public function browse()
{
// Parameters
$params = array('join_columns' => array(), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Actions
$actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system'));
// Check form action
if (input::post('do_action')) {
// Delete selected blogs
if (input::post('action') && isset($actions[input::post('action')]) && input::post('blog_id') && is_array(input::post('blog_id'))) {
foreach (input::post('blog_id') as $blogID) {
$blogID = (int) $blogID;
if ($blogID && $blogID > 0) {
$this->action(input::post('action'), $blogID);
}
}
}
// Success
view::setInfo(__('action_applied', 'system'));
router::redirect('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page']);
}
// Get blogs
$blogs = array();
if ($params['total']) {
$blogs = $this->blogs_model->getBlogs('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Create table grid
$grid = array('uri' => 'cp/plugins/blogs', 'keyword' => 'blogs', 'header' => array('check' => array('html' => 'blog_id', 'class' => 'check'), 'data_title' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($blogs as $blog) {
if ($blog['active'] == 1) {
$status = html_helper::anchor('cp/plugins/blogs/decline/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('active', 'system'), array('class' => 'label small success'));
} else {
$status = html_helper::anchor('cp/plugins/blogs/approve/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], $blog['active'] ? __('pending', 'system') : __('inactive', 'system'), array('class' => 'label small ' . ($blog['active'] ? 'info' : 'important')));
}
$grid['content'][] = array('check' => array('html' => $blog['blog_id']), 'data_title' => array('html' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], text_helper::truncate($blog['data_title'], 64))), 'user' => array('html' => users_helper::anchor($blog['user'])), 'post_date' => array('html' => date_helper::formatDate($blog['post_date'])), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/blogs/delete/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('blog_delete?', 'blogs'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Set pagination
$config = array('base_url' => config::siteURL('cp/plugins/blogs?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->blogsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Filter hooks
hook::filter('cp/plugins/blogs/browse/grid', $grid);
hook::filter('cp/plugins/blogs/browse/actions', $actions);
// Assign vars
view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
// Set title
view::setTitle(__('blogs_manage', 'system_navigation'));
// Set trail
if ($qstring['search_id']) {
view::setTrail('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
}
// Assign actions
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#blogs-search\').toggle();return false;'));
// Load view
view::load('cp/plugins/blogs/browse');
}
示例5: usersViewActionsAds
public function usersViewActionsAds($user)
{
if (!$user['total_classifieds']) {
return '';
}
echo '<li class="classifieds">' . html_helper::anchor('classifieds/user/' . text_helper::entities($user['username']), __('classifieds', 'system_navigation') . ' (' . $user['total_classifieds'] . ')') . '</li>';
}
示例6: account
public function account()
{
// Create account settings
$settings = array();
$settings['email'] = array('name' => __('email', 'users'), 'keyword' => 'email', 'type' => 'static', 'value' => text_helper::entities(session::item('email')) . ' - ' . html_helper::anchor('users/settings/email', __('email_change', 'users')) . (config::item('auth_methods', 'users', 'default') ? ' - ' . html_helper::anchor('users/settings/password', __('password_change', 'users')) : '') . (session::permission('users_account_cancel', 'users') ? ' - ' . html_helper::anchor('users/settings/cancel', __('account_cancel', 'users')) : ''));
if (config::item('user_username', 'users')) {
$settings['username'] = array('name' => __('username', 'users'), 'keyword' => 'username', 'type' => 'static', 'value' => text_helper::entities(session::item('username')) . (config::item('user_username_modify', 'users') ? ' - ' . html_helper::anchor('users/settings/username', __('username_change', 'users')) : ''));
}
if (!config::item('time_zone_override', 'system')) {
$settings['time_zone'] = array('name' => __('time_zone', 'users_account'), 'keyword' => 'time_zone', 'type' => 'select', 'items' => date_helper::timezones(), 'value' => session::item('time_zone'), 'rules' => array('callback__is_valid_time_zone'));
}
if (!config::item('language_override', 'system') && session::permission('change_languages', 'system')) {
$settings['language_id'] = array('name' => __('language', 'users_account'), 'keyword' => 'language_id', 'type' => 'select', 'items' => config::item('languages', 'core', 'names'), 'value' => session::item('language_id'), 'rules' => array('callback__is_valid_language_id'));
}
if (!config::item('template_override', 'system') && session::permission('change_templates', 'system')) {
$settings['template_id'] = array('name' => __('template', 'users_account'), 'keyword' => 'template_id', 'type' => 'select', 'items' => config::item('templates', 'core', 'names'), 'value' => session::item('template_id'), 'rules' => array('callback__is_valid_template_id'));
}
// Filter hook
$settings = hook::filter('users/settings/account/options', $settings);
// Assign vars
view::assign(array('settings' => $settings));
// Process form values
if (input::post('do_save_settings')) {
$this->_saveSettings($settings);
}
// Set title
view::setTitle(__('settings', 'users'));
// Load view
view::load('users/settings/account');
}
示例7: index
public function index()
{
// Get gateways
if (!($gateways = $this->gateways_model->scanGateways())) {
view::setError(__('no_gateways', 'billing_gateways'));
router::redirect('cp/billing/transactions');
}
// Create table grid
$grid = array('uri' => 'cp/billing/gateways/browse', 'keyword' => 'billing_gateways', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($gateways as $gateway) {
if (isset($gateway['gateway_id']) && $gateway['gateway_id']) {
if ($gateway['settings']) {
$actions['settings'] = html_helper::anchor('cp/billing/gateways/settings/' . $gateway['keyword'], __('settings', 'system'), array('class' => 'settings'));
}
$actions['uninstall'] = html_helper::anchor('cp/billing/gateways/uninstall/' . $gateway['keyword'], __('uninstall', 'system'), array('data-html' => __('gateway_uninstall?', 'billing_gateways'), 'data-role' => 'confirm', 'class' => 'uninstall'));
} else {
$actions['install'] = html_helper::anchor('cp/billing/gateways/install/' . $gateway['keyword'], __('install', 'system'), array('class' => 'install'));
}
$grid['content'][] = array('name' => array('html' => text_helper::entities($gateway['name'])), 'status' => array('html' => $gateway['active'] ? '<span class="label success small">' . __('active', 'system') . '</span>' : '<span class="label important small">' . __('inactive', 'system') . '</span>'), 'actions' => array('html' => $actions));
}
// Filter hooks
hook::filter('cp/billing/gateways/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('billing_gateways_manage', 'system_navigation'));
// Load view
view::load('cp/billing/gateways/browse');
}
示例8: browse
public function browse()
{
// Parameters
$params = array('join_columns' => array(), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Actions
$actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
// Check form action
if (input::post('do_action')) {
// Delete selected news
if (input::post('action') == 'delete') {
if (input::post('news_id') && is_array(input::post('news_id'))) {
foreach (input::post('news_id') as $newsID) {
$newsID = (int) $newsID;
if ($newsID && $newsID > 0) {
$this->delete($newsID);
}
}
}
}
// Success
view::setInfo(__('action_applied', 'system'));
router::redirect('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page']);
}
// Get news
$news = array();
if ($params['total']) {
$news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Create table grid
$grid = array('uri' => 'cp/content/news', 'keyword' => 'news', 'header' => array('check' => array('html' => 'news_id', 'class' => 'check'), 'data_title_' . session::item('language') => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($news as $entry) {
$grid['content'][] = array('check' => array('html' => $entry['news_id']), 'data_title_' . session::item('language') => array('html' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], text_helper::truncate($entry['data_title'], 64))), 'post_date' => array('html' => date_helper::formatDate($entry['post_date'])), 'status' => array('html' => $entry['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/news/edit/' . $entry['news_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/news/delete/' . $entry['news_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('entry_delete?', 'news'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Set pagination
$config = array('base_url' => config::siteURL('cp/content/news?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->newsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Filter hooks
hook::filter('cp/content/news/browse/grid', $grid);
hook::filter('cp/content/news/browse/actions', $actions);
// Assign vars
view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
// Set title
view::setTitle(__('news_manage', 'system_navigation'));
// Set trail
if ($qstring['search_id']) {
view::setTrail('cp/content/news?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
}
// Assign actions
view::setAction('cp/content/news/edit/', __('entry_new', 'news'), array('class' => 'icon-text icon-news-new'));
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
// Load view
view::load('cp/content/news/browse');
}
示例9: browse
public function browse()
{
// Parameters
$params = array('join_columns' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Actions
$actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
// Check form action
if (input::post('do_action')) {
// Delete selected messages
if (input::post('action') == 'delete') {
if (input::post('message_id') && is_array(input::post('message_id'))) {
foreach (input::post('message_id') as $messageID) {
$messageID = (int) $messageID;
if ($messageID && $messageID > 0) {
$this->delete($messageID);
}
}
}
}
// Success
view::setInfo(__('action_applied', 'system'));
router::redirect('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page']);
}
// Get messages
$messages = array();
if ($params['total']) {
$messages = $this->messages_model->getMessages($params['join_columns'], $qstring['order'], $qstring['limit']);
}
// Create table grid
$grid = array('uri' => 'cp/plugins/messages', 'keyword' => 'messages', 'header' => array('check' => array('html' => 'message_id', 'class' => 'check'), 'message' => array('html' => __('message', 'messages'), 'class' => 'name'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($messages as $message) {
$grid['content'][] = array('check' => array('html' => $message['message_id']), 'message' => array('html' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], text_helper::truncate($message['message'], 64))), 'user' => array('html' => users_helper::anchor($message['user'])), 'post_date' => array('html' => date_helper::formatDate($message['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/messages/delete/' . $message['message_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('message_delete?', 'messages'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Set pagination
$config = array('base_url' => config::siteURL('cp/plugins/messages?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->messagesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Filter hooks
hook::filter('cp/plugins/messages/browse/grid', $grid);
hook::filter('cp/plugins/messages/browse/actions', $actions);
// Assign vars
view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
// Set title
view::setTitle(__('messages_manage', 'system_navigation'));
// Set trail
if ($qstring['search_id']) {
view::setTrail('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
}
// Assign actions
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#messages-search\').toggle();return false;'));
// Load view
view::load('cp/plugins/messages/browse');
}
示例10: browse
public function browse()
{
// Get URI vars
$parentID = (int) uri::segment(5);
// Get parent pages
$parents = $parentID ? $this->pages_model->getParents($parentID) : array();
if ($parentID && !$parents) {
view::setError(__('no_parent', 'pages'));
router::redirect('cp/content/pages');
}
// Parameters
$params = array('join_columns' => array("`p`.`parent_id`=" . (int) $parentID), 'join_items' => array());
// Process query string
$qstring = $this->parseQuerystring();
// Check form action
if (input::post('do_action')) {
// Delete selected pages
if (input::post('action') == 'delete') {
if (input::post('page_id') && is_array(input::post('page_id'))) {
foreach (input::post('page_id') as $pageID) {
$pageID = (int) $pageID;
if ($pageID && $pageID > 0) {
$this->delete($parentID, $pageID);
}
}
}
}
// Success
view::setInfo(__('action_applied', 'system'));
router::redirect('cp/content/pages/browse/' . $parentID . ($qstring['url'] ? '?' . $qstring['url'] : ''));
}
// Get pages
if (!($pages = $this->pages_model->getPages($parentID, 'in_list', $params['join_columns'], $params['join_items'], $qstring['order']))) {
view::setError(__('no_pages', 'pages'));
}
// Create table grid
$grid = array('uri' => 'cp/content/pages/browse/' . $parentID, 'keyword' => 'pages', 'header' => array('check' => array('html' => 'page_id', 'class' => 'check'), 'data_title_' . session::item('language') => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($pages as $page) {
$grid['content'][] = array('check' => array('html' => $page['page_id']), 'data_title_' . session::item('language') => array('html' => html_helper::anchor('cp/content/pages/edit/' . $page['parent_id'] . '/' . $page['page_id'], text_helper::truncate($page['data_title'], 64))), 'status' => array('html' => $page['active'] ? '<span class="label success small">' . __('active', 'system') . '</span>' : '<span class="label important small">' . __('inactive', 'system') . '</span>'), 'actions' => array('html' => array('pages' => html_helper::anchor('cp/content/pages/browse/' . $page['page_id'], __('page_inner', 'pages'), array('class' => 'pages')), 'edit' => html_helper::anchor('cp/content/pages/edit/' . $page['parent_id'] . '/' . $page['page_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/pages/delete/' . $page['parent_id'] . '/' . $page['page_id'] . '?' . $qstring['url'], __('delete', 'system'), array('data-html' => __('page_delete?', 'pages'), 'data-role' => 'confirm', 'class' => 'delete')))));
}
// Create actions
$actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
// Assign vars
view::assign(array('grid' => $grid, 'actions' => $actions));
// Set title
view::setTitle(__('pages_manage', 'system_navigation'));
// Set trail
view::setTrail('cp/content/pages/browse', __('pages', 'pages'));
foreach ($parents as $parent) {
view::setTrail('cp/content/pages/edit/' . $parent['parent_id'] . '/' . $parent['page_id'], $parent['data_title']);
}
// Assign actions
view::setAction('cp/content/pages/edit/' . $parentID, __('page_new', 'pages'), array('class' => 'icon-text icon-pages-new'));
// Load view
view::load('cp/content/pages/browse');
}
示例11: __construct
public function __construct()
{
parent::__construct();
$authID = session::item('auth_id');
$userID = session::item('user_id');
$ipaddress = substr(input::ipaddress(), 0, 15);
$useragent = substr(input::useragent(), 0, 255);
$user = array();
if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) {
if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) {
$this->saveSession($authID, $userID, $ipaddress, $useragent);
if (isset($user['user_id']) && $user['user_id']) {
$this->saveLastvisit($user['user_id']);
}
}
} else {
$cookie = cookie::item('sessdata');
$cookie = $cookie ? @json_decode($cookie, true) : array();
if ($cookie && is_array($cookie)) {
$userID = isset($cookie['user_id']) ? $cookie['user_id'] : '';
$email = isset($cookie['email']) ? $cookie['email'] : '';
$passhash = isset($cookie['passhash']) ? $cookie['passhash'] : '';
if ($userID && is_numeric($userID) && $userID > 0) {
if ($user = $this->getUser($userID, false, false)) {
$newPasshash = $this->generatePasshash($email, $user['password']);
if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) {
$authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent);
$this->saveLastvisit($user['user_id']);
} else {
$user = array();
}
}
}
}
}
if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) {
$userID = 0;
if (!$user) {
$authID = $this->saveSession(0, $userID, $ipaddress, $useragent);
}
$this->createGuestSession();
}
session::set('auth_id', $authID);
session::set('user_id', $userID);
// Is the site offline?
if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') {
router::redirect('site/offline');
} elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) {
router::redirect('cp/users/login');
}
if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) {
$this->logout();
view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.');
router::redirect();
}
}
示例12: index
public function index()
{
// Get plugins
if (!($plugins = $this->plugins_model->scanPlugins())) {
view::setError(__('no_plugins', 'system_plugins'));
router::redirect('cp/system/config/system');
}
// Create table grid
$grid = array('uri' => 'cp/system/plugins', 'keyword' => 'plugins', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'description' => array('html' => __('description', 'system'), 'class' => 'text'), 'version' => array('html' => __('plugin_version', 'system_plugins'), 'class' => 'version'), 'author' => array('html' => __('plugin_author', 'system_plugins'), 'class' => 'author'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($plugins as $plugin) {
$version = $plugin['version'] != '' ? $plugin['version'] : '1.0.0';
if (isset($plugin['plugin_id']) && $plugin['plugin_id'] && version_compare($plugin['version_new'], $plugin['version']) == 1) {
$version .= ' ' . html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], '+', array('class' => 'label success small', 'title' => __('plugin_new_version', 'system_plugins', array('%version' => text_helper::entities($plugin['version_new'])))));
}
$author = '';
if ($plugin['author'] || $plugin['website']) {
if ($plugin['author'] && $plugin['website']) {
$author = html_helper::anchor($plugin['website'], $plugin['author'], array('target' => '_blank'));
} elseif ($plugin['website']) {
$author = html_helper::anchor($plugin['website'], text_helper::entities(str_ireplace(array('http://www.', 'http://'), '', $plugin['website'])), array('target' => '_blank'));
} elseif ($plugin['author']) {
$author = $plugin['author'];
}
}
$actions = array();
if (isset($plugin['plugin_id']) && $plugin['plugin_id']) {
if ($plugin['settings']) {
$actions['html']['settings'] = html_helper::anchor('cp/system/plugins/settings/' . $plugin['keyword'], __('settings', 'system'), array('class' => 'settings'));
} else {
$actions['html']['view'] = html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], __('details', 'system'), array('class' => 'details'));
}
if (!isset($plugin['system']) || !$plugin['system']) {
$actions['html']['uninstall'] = html_helper::anchor('cp/system/plugins/uninstall/' . $plugin['keyword'], __('uninstall', 'system'), array('data-html' => __('plugin_uninstall?', 'system_plugins'), 'data-role' => 'confirm', 'class' => 'uninstall'));
}
} else {
$actions['html']['install'] = html_helper::anchor('cp/system/plugins/install/' . $plugin['keyword'], __('install', 'system'), array('class' => 'install'));
}
$grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/plugins/view/' . $plugin['keyword'], $plugin['name'])), 'description' => array('html' => text_helper::truncate($plugin['description'], 64)), 'version' => array('html' => $version), 'author' => array('html' => $author), 'actions' => $actions);
}
// Filter hooks
hook::filter('cp/system/plugins/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('system_plugins_manage', 'system_navigation'));
// Load view
view::load('cp/system/plugins/browse');
}
示例13: showBanner
public static function showBanner($group, $banner = '')
{
if (!config::item('plugins', 'core', 'banners') || !session::permission('banners_show', 'banners')) {
return '';
}
loader::model('banners/banners');
$banner = codebreeder::instance()->banners_model->getBanner($banner, $group);
if (!$banner || input::protocol() == 'https' && !$banner['secure_mode']) {
return '';
}
if ($banner['count_views']) {
codebreeder::instance()->banners_model->updateViews($banner['banner_id']);
}
if ($banner['count_clicks']) {
$banner['code'] = '<div style="display:block" onclick="$(\'#banner_id_' . $banner['banner_id'] . '\').attr(\'src\',\'' . html_helper::siteURL('banners/click/' . $banner['banner_id']) . '\');return true;">' . $banner['code'] . '<img src="' . html_helper::baseURL('assets/images/banners/blank.gif') . '" border="0" style="width:0px;height:0px;" alt="" id="banner_id_' . $banner['banner_id'] . '" /></div>';
}
return $banner['code'];
}
示例14: view
public function view()
{
// Get URI vars
$listID = uri::segment(6);
// Get list
if (!$listID || !($list = $this->lists_model->getList($listID))) {
router::redirect('cp/system/config/system');
}
// Did we submit the form?
if (input::post('action') == 'reorder' && input::post('ids')) {
$this->_reorderItems();
}
// Get items
if (!($items = $this->lists_model->getItems($listID))) {
router::redirect('cp/system/config/system');
}
// Create table grid
$grid = array('uri' => 'cp/system/templates/navigation', 'keyword' => 'templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'active' => array('html' => __('active', 'system'), 'class' => 'status')), 'content' => array());
// Create grid content
foreach ($items as $item) {
$grid['content'][] = array('name' => array('html' => $item['name']), 'status' => array('html' => html_helper::anchor('cp/system/templates/navigation/togglestatus/' . $item['item_id'], $item['active'] ? __('yes', 'system') : __('no', 'system'), array('class' => $item['active'] ? 'label success small' : 'label important small'))));
}
// Filter hooks
hook::filter('cp/system/templates/navigation/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid, 'items' => $items, 'listID' => $listID));
// Set title
view::setTitle(__('system_templates_navigation_manage', 'system_navigation'));
// Set trail
view::setTrail('cp/system/templates/navigation/view/' . $listID, $list['name']);
// Set actions
view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save'));
view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel'));
view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder'));
// Include sortable vendor files
view::includeJavascript('externals/html5sortable/html5sortable.js');
view::includeStylesheet('externals/html5sortable/style.css');
// Load view
if (input::isAjaxRequest()) {
view::load('cp/system/templates/navigation/items/browse_' . (input::post('view') == 'list' ? 'list' : 'grid'));
} else {
view::load('cp/system/templates/navigation/items/browse');
}
}
示例15: browse
public function browse()
{
// Get URI vars
$plugin = uri::segment(5, 'system');
// Assign vars
view::assign(array('plugin' => $plugin));
// Does plugin exist?
if (!config::item('plugins', 'core', $plugin)) {
view::setError(__('no_config_plugin', 'system_config'));
router::redirect('cp/system/config/' . $plugin);
}
// Get templates
if (!($templates = $this->emailtemplates_model->getTemplates($plugin))) {
view::setInfo(__('no_templates', 'system_templates'));
router::redirect('cp/system/config/system');
}
// Create table grid
$grid = array('uri' => 'cp/system/emailtemplates', 'keyword' => 'emailtemplates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
// Create grid content
foreach ($templates as $template) {
if ($template['keyword'] != 'header' && $template['keyword'] != 'footer') {
if ($template['active'] == 1) {
$status = html_helper::anchor('cp/system/emailtemplates/toggle/' . $template['template_id'], __('active', 'system'), array('class' => 'label small success'));
} else {
$status = html_helper::anchor('cp/system/emailtemplates/toggle/' . $template['template_id'], __('inactive', 'system'), array('class' => 'label small important'));
}
} else {
$status = '<span class="label small success">' . __('active', 'system') . '</span>';
}
$grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/system/emailtemplates/edit/' . $template['template_id'], __($template['keyword'], 'system_email_templates'))), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/system/emailtemplates/edit/' . $template['template_id'], __('edit', 'system'), array('class' => 'edit')))));
}
// Filter hooks
hook::filter('cp/system/emailtemplates/browse/grid', $grid);
// Assign vars
view::assign(array('grid' => $grid));
// Set title
view::setTitle(__('system_email_templates_manage', 'system_navigation'));
// Set trail
view::setTrail('cp/system/emailtemplates/browse/' . $plugin, text_helper::entities(config::item('plugins', 'core', $plugin, 'name')));
// Load view
view::load('cp/system/emailtemplates/browse');
}