本文整理汇总了PHP中loader::library方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::library方法的具体用法?PHP loader::library怎么用?PHP loader::library使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader
的用法示例。
在下文中一共展示了loader::library方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// Parameters
$params = array('join_columns' => array('`n`.`active`=1'), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring(config::item('news_per_page', 'news'), $params['max']);
// Get news
$news = array();
if ($params['total']) {
$news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Set pagination
$config = array('base_url' => config::siteURL('news?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('news_per_page', 'news'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('news' => $news, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('news', 'news_index');
// Set title
view::setTitle(__(config::item('news_blog', 'news') ? 'blog' : 'news', 'system_navigation'), false);
// Assign actions
if (session::permission('news_search', 'news') && ($params['total'] || input::post_get('do_search'))) {
view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
}
// Load view
view::load('news/index');
}
示例2: 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');
}
示例3: invoices
public function invoices()
{
// Get page
$page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1;
// Parameters
$params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id')));
// Process query string
$qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions'));
// Get invoices
$invoices = array();
if (session::item('total_transactions')) {
$invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']);
} else {
view::setInfo(__('no_invoices_user', 'billing_transactions'));
}
// Set pagination
$config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('invoices' => $invoices, 'pagination' => $pagination));
// Set title
view::setTitle(__('invoices', 'billing_transactions'));
// Load view
view::load('billing/invoices');
}
示例4: __construct
public function __construct($config = array())
{
parent::__construct();
$this->config = $config;
$this->config['driver'] = 'recaptcha';
loader::library('captcha', $this->config);
}
示例5: manage
public function manage()
{
// Assign user from session to variable
$user = session::section('session');
// Get fields
$fields = array();
foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) {
$fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list');
}
// Parameters
$params = array('total' => $user['total_blocked'], 'profiles' => true);
// Process query string
$qstring = $this->parseQuerystring($params['total']);
// Get blocked users
$users = array();
if ($params['total']) {
$users = $this->users_blocked_model->getUsers(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
} else {
view::setInfo(__('no_blocked_users', 'users_blocked'));
}
// Set pagination
$config = array('base_url' => config::siteURL('users/blocked/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('blocked_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('user' => $user, 'users' => $users, 'fields' => $fields, 'pagination' => $pagination));
// Set title
view::setTitle(__('blacklist', 'users'));
// Load view
view::load('users/blocked/manage');
}
示例6: results
public function results()
{
if (!input::get('search_id')) {
$this->index();
return;
}
// Parameters
$params = array('join_columns' => array('`u`.`verified`=1', '`u`.`active`=1', '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')', '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')'), 'join_items' => array());
// Process filters
$params = $this->parseCounters($params);
// Process query string
$qstring = $this->parseQuerystring($params['max']);
// Get users
$users = array();
if ($params['total']) {
$users = $this->users_model->getUsers('in_list', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
}
// Get fields
$fields = $this->fields_model->getFields('users', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, 'view', 'in_list');
// Set pagination
$config = array('base_url' => config::siteURL('users/results?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => config::item('max_search_results', 'system'), 'items_per_page' => config::item('users_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('users' => $users, 'fields' => $fields, 'pagination' => $pagination));
// Set meta tags
$this->metatags_model->set('users', 'users_search_results');
// Set title
view::setTitle(__('search_results', 'system'), false);
// Assign actions
view::setAction('users?' . substr($qstring['url'], 0, -1), __('search_modify', 'system'), array('class' => 'icon-text icon-users-search-edit'));
// Load view
view::load('users/index');
}
示例7: deleteType
public function deleteType($typeID, $type)
{
loader::library('dbforge');
$this->dbforge->dropTable(':prefix:users_data_' . $type['keyword']);
// Delete user type
if ($retval = $this->db->delete('users_types', array('type_id' => $typeID), 1)) {
// Update order IDs
$this->db->query("UPDATE `:prefix:users_types` SET `order_id`=`order_id`-1 WHERE `order_id`>?", array($type['order_id']));
// Select fields IDs
$fieldIDs = array();
foreach ($this->db->query("SELECT `field_id`, `category_id`, `keyword` FROM `:prefix:core_fields` WHERE `category_id`=?", array($typeID))->result() as $field) {
$fieldIDs[] = $field['field_id'];
}
// Do we have any field IDs?
if ($fieldIDs) {
// Delete field items
$this->db->query("DELETE FROM `:prefix:core_fields_items` WHERE `field_id` IN (" . implode(',', $fieldIDs) . ")");
}
// Delete fields
$this->db->delete('core_fields', array('category_id' => $typeID));
// Action hook
hook::action('users/types/delete', $typeID, $type);
}
$this->cache->cleanup();
return $retval;
}
示例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($resource = '', $itemID = 0, $total = false, $page = false, $post = true, $info = true, $static = false)
{
// Get vars
if (input::isAjaxRequest() && !$static) {
$resource = input::post_get('resource');
$itemID = (int) input::post_get('item_id');
$post = (bool) input::post_get('post');
$info = (bool) input::post_get('info');
}
$split = (int) input::post_get('split') && (int) input::post_get('split') <= config::item('comments_per_page', 'comments') ? (int) input::post_get('split') : config::item('comments_per_page', 'comments');
// Get resource ID
$resourceID = config::item('resources', 'core', $resource, 'resource_id');
if (!$resourceID || !$itemID) {
return false;
}
// Do we have the number of comments?
if ($total === false) {
// Count comments
$total = $this->comments_model->countComments(array(), array(), array('resource' => $resource, 'item_id' => $itemID));
}
// Post comment
if (input::post('do_save_comment') && session::permission('comments_post', 'comments')) {
if ($this->_saveComment($resource, $itemID)) {
$total++;
}
} elseif (input::post('delete') && session::permission('comments_delete', 'comments')) {
if ($this->_deleteComment($resource, $itemID, (int) input::post('delete'))) {
$total--;
}
}
// Current page
$page = $page ? $page : (int) input::post_get('page', 1);
$page = $page > 0 ? $page : 1;
// Limit
$limit = ($page - 1) * $split . ', ' . $split;
// Get comments
$comments = $this->comments_model->getComments($resource, $itemID, array(), '`c`.`post_date` desc', $limit);
// If no comments were found, try to fetch from from the previous page
if (!$comments && $page > 1) {
$page--;
// Limit
$from = ($page - 1) * $split;
$limit = $from . ', ' . $split;
$comments = $this->comments_model->getComments($resource, $itemID, array(), '`c`.`post_date` desc', $limit);
}
// Pagination config
$config = array('base_url' => 'comments/browse?', 'total_items' => $total, 'items_per_page' => $split, 'current_page' => $page, 'uri_segment' => 'page', 'link_attr' => array('onclick' => "runAjax(this.href,{'resource':'" . $resource . "','item_id':" . $itemID . ",'split':" . $split . ",'post':" . ($post ? 1 : 0) . ",'info':" . ($info ? 1 : 0) . "},'replaceContent','comments-container-" . $resource . "-" . $itemID . "','pagination-" . $resource . "-" . $itemID . "');return false;"));
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('resource' => $resource, 'itemID' => $itemID, 'comments' => $comments, 'pagination' => $pagination, 'split' => $split, 'post' => users_helper::isLoggedin() && $post ? true : false, 'info' => $info), '', 'comments/index');
if (input::isAjaxRequest() && !$static) {
$output = view::load('comments/index', array(), true);
view::ajaxResponse($output);
} else {
view::load('comments/index');
}
}
示例10: captcha
public static function captcha($name, $value = '')
{
$service = config::item('default_captcha', 'security');
$settings = config::item('default_captcha_settings', 'security');
// Load library
loader::library('captchas/' . $service, $settings, 'captcha_' . $service);
$str = codebreeder::instance()->{'captcha_' . $service}->getCaptcha($name);
return $str;
}
示例11: __construct
public function __construct($manifest = array())
{
parent::__construct();
$this->manifest = $manifest;
loader::library('dbforge');
$engines = $this->dbforge->getEngines();
$this->dbEngine = in_array('InnoDB', $engines) ? 'InnoDB' : 'MyISAM';
//$this->dbEngine = 'MyISAM';
}
示例12: 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');
}
示例13: confirm
public function confirm()
{
$class = uri::segment(4);
$action = uri::segment(5) == 'signup' ? 'signup' : 'login';
$service = $this->users_authentication_model->getService($class);
if ($service) {
loader::library('authentication/' . uri::segment(4), $service['settings'], 'users_authentication_' . $class . '_model');
$this->{'users_authentication_' . $class . '_model'}->confirm($action);
}
router::redirect('users/login');
}
示例14: sendFeedback
public function sendFeedback($email, $subject, $message)
{
loader::library('email');
$this->email->reply($email);
$retval = $this->email->sendEmail(config::item('feedback_email', 'feedback'), $subject, $message);
if ($retval) {
// Action hook
hook::action('feedback/send/post', $email, $subject, $message);
}
return $retval;
}
示例15: index
public function index()
{
$service = config::item('default_captcha', 'security');
$settings = config::item('default_captcha_settings', 'security');
// Load library
$captcha = loader::library('captcha', $settings, null);
if (uri::segment(3) == 'reload') {
$captcha->create();
}
echo $captcha->render();
exit;
}