本文整理汇总了PHP中qa_load_module函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_load_module函数的具体用法?PHP qa_load_module怎么用?PHP qa_load_module使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_load_module函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_captcha_validate_post
function qa_captcha_validate_post(&$errors)
{
if (qa_captcha_available()) {
$captcha = qa_load_module('captcha', qa_opt('captcha_module'));
if (!$captcha->validate_post($error)) {
$errors['captcha'] = $error;
return false;
}
}
return true;
}
示例2: ra_widget
function ra_widget($name, $t)
{
$module = qa_load_module('widget', $name);
$module->output_widget('side', 'top', $t, $t->template, $t->request, $t->content);
}
示例3: qa_db_install_tables
if (qa_clicked('nonuser')) {
qa_db_install_tables();
$success .= 'The additional Question2Answer database tables have been created.';
}
if (qa_clicked('upgrade')) {
qa_db_upgrade_tables();
$success .= 'Your Question2Answer database has been updated.';
}
if (qa_clicked('repair')) {
qa_db_install_tables();
$success .= 'The Question2Answer database tables have been repaired.';
}
if (qa_clicked('module')) {
$moduletype = qa_post_text('moduletype');
$modulename = qa_post_text('modulename');
$module = qa_load_module($moduletype, $modulename);
$queries = $module->init_queries(qa_db_list_tables_lc());
if (!empty($queries)) {
if (!is_array($queries)) {
$queries = array($queries);
}
foreach ($queries as $query) {
qa_db_upgrade_query($query);
}
}
$success .= 'The ' . $modulename . ' ' . $moduletype . ' module has completed database initialization.';
}
if (qa_clicked('super')) {
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
$inemail = qa_post_text('email');
示例4: get_widget_form
function get_widget_form($name, $options = false)
{
$module = qa_load_module('widget', $name);
if (is_object($module) && method_exists($module, 'cs_widget_form')) {
$fields = $module->cs_widget_form();
if ($options) {
foreach ($options as $k => $opt) {
if (isset($fields['fields'][$k])) {
$fields['fields'][$k]['value'] = $opt;
}
}
}
$this->form($fields);
}
}
示例5: qa_load_modules_with
function qa_load_modules_with($type, $method)
{
$modules = array();
$trynames = qa_list_modules($type);
foreach ($trynames as $tryname) {
$module = qa_load_module($type, $tryname);
if (method_exists($module, $method)) {
$modules[$tryname] = $module;
}
}
return $modules;
}
示例6: qa_get_badge_list
function qa_get_badge_list()
{
// badges - add to this list to add a new badge, it will be imported when you run this function. Don't change existing slugs!
$badges = array();
if (!QA_FINAL_EXTERNAL_USERS) {
$badges['verified'] = array('type' => 0);
$badges['profiler'] = array('type' => 0);
$badges['avatar'] = array('type' => 0);
}
$badges['nice_question'] = array('var' => 2, 'type' => 0);
$badges['good_question'] = array('var' => 5, 'type' => 1);
$badges['great_question'] = array('var' => 10, 'type' => 2);
$badges['notable_question'] = array('var' => 50, 'type' => 0);
$badges['popular_question'] = array('var' => 100, 'type' => 1);
$badges['famous_question'] = array('var' => 500, 'type' => 2);
$badges['nice_answer'] = array('var' => 2, 'type' => 0);
$badges['good_answer'] = array('var' => 5, 'type' => 1);
$badges['great_answer'] = array('var' => 10, 'type' => 2);
$badges['nice_answer_old'] = array('var' => 30, 'type' => 0);
$badges['good_answer_old'] = array('var' => 60, 'type' => 1);
$badges['great_answer_old'] = array('var' => 120, 'type' => 2);
$badges['gifted'] = array('var' => 1, 'type' => 0);
$badges['wise'] = array('var' => 10, 'type' => 1);
$badges['enlightened'] = array('var' => 30, 'type' => 2);
$badges['grateful'] = array('var' => 1, 'type' => 0);
$badges['respectful'] = array('var' => 20, 'type' => 1);
$badges['reverential'] = array('var' => 50, 'type' => 2);
$badges['liked'] = array('var' => 20, 'type' => 0);
$badges['loved'] = array('var' => 50, 'type' => 1);
$badges['revered'] = array('var' => 200, 'type' => 2);
$badges['asker'] = array('var' => 10, 'type' => 0);
$badges['questioner'] = array('var' => 25, 'type' => 1);
$badges['inquisitor'] = array('var' => 50, 'type' => 2);
$badges['answerer'] = array('var' => 25, 'type' => 0);
$badges['lecturer'] = array('var' => 50, 'type' => 1);
$badges['preacher'] = array('var' => 100, 'type' => 2);
$badges['commenter'] = array('var' => 50, 'type' => 0);
$badges['commentator'] = array('var' => 100, 'type' => 1);
$badges['annotator'] = array('var' => 500, 'type' => 2);
$badges['voter'] = array('var' => 10, 'type' => 0);
$badges['avid_voter'] = array('var' => 50, 'type' => 1);
$badges['devoted_voter'] = array('var' => 200, 'type' => 2);
$badges['editor'] = array('var' => 1, 'type' => 0);
$badges['copy_editor'] = array('var' => 15, 'type' => 1);
$badges['senior_editor'] = array('var' => 50, 'type' => 2);
$badges['watchdog'] = array('var' => 1, 'type' => 0);
$badges['bloodhound'] = array('var' => 10, 'type' => 1);
$badges['pitbull'] = array('var' => 30, 'type' => 2);
$badges['reader'] = array('var' => 20, 'type' => 0);
$badges['avid_reader'] = array('var' => 50, 'type' => 1);
$badges['devoted_reader'] = array('var' => 200, 'type' => 2);
$badges['dedicated'] = array('var' => 10, 'type' => 0);
$badges['devoted'] = array('var' => 25, 'type' => 1);
$badges['zealous'] = array('var' => 50, 'type' => 2);
$badges['visitor'] = array('var' => 30, 'type' => 0);
$badges['trouper'] = array('var' => 100, 'type' => 1);
$badges['veteran'] = array('var' => 200, 'type' => 2);
$badges['regular'] = array('var' => 90, 'type' => 0);
$badges['old_timer'] = array('var' => 180, 'type' => 1);
$badges['ancestor'] = array('var' => 365, 'type' => 2);
$badges['100_club'] = array('var' => 100, 'type' => 0);
$badges['1000_club'] = array('var' => 1000, 'type' => 1);
$badges['10000_club'] = array('var' => 10000, 'type' => 2);
$badges['medalist'] = array('var' => 10, 'type' => 0);
$badges['champion'] = array('var' => 30, 'type' => 1);
$badges['olympian'] = array('var' => 100, 'type' => 2);
// get badges from other plugins - experimental!
$moduletypes = qa_list_module_types();
foreach ($moduletypes as $moduletype) {
$modulenames = qa_list_modules($moduletype);
foreach ($modulenames as $modulename) {
$module = qa_load_module($moduletype, $modulename);
if (method_exists($module, 'custom_badges')) {
$badges = array_merge($badges, $module->custom_badges());
}
}
}
return $badges;
}
示例7: qa_get_post_content
function qa_get_post_content($editorfield, $contentfield, &$ineditor, &$incontent, &$informat, &$intext)
{
require_once QA_INCLUDE_DIR . 'util/string.php';
$ineditor = qa_post_text($editorfield);
$editor = qa_load_module('editor', $ineditor);
$readdata = $editor->read_post($contentfield);
// sanitise 4-byte Unicode
$incontent = qa_remove_utf8mb4($readdata['content']);
$informat = $readdata['format'];
$intext = qa_remove_utf8mb4(qa_viewer_text($incontent, $informat));
}
示例8: ajaxEditor
function ajaxEditor(&$ineditor, &$incontent, &$informat, &$intext)
{
$ineditor = qa_post_text('editor');
$editor = qa_load_module('editor', $ineditor);
$readdata = $editor->read_post('ajax_comment_content');
$incontent = $readdata['content'];
$informat = $readdata['format'];
$viewer = qa_load_viewer($incontent, $informat);
$intext = $viewer->get_text($incontent, $informat, array());
}
示例9: cs_get_widget
function cs_get_widget($name, $show_title = false, $position)
{
$module = qa_load_module('widget', ltrim($name));
if (is_object($module)) {
ob_start();
echo '<div class="widget ' . strtolower(str_replace(' ', '_', $name)) . '">';
$module->output_widget('side', 'top', $this, $this->template, $this->request, $this->content);
echo '</div>';
$this->output(ob_get_clean());
}
return;
}
示例10: qa_content_prepare
function qa_content_prepare($voting = false, $categoryids = null)
{
global $qa_root_url_relative, $qa_request, $qa_template, $qa_login_userid, $qa_vote_error_html, $qa_nav_pages_cached, $qa_widgets_cached, $QA_CONST_ROUTING;
if (QA_DEBUG_PERFORMANCE) {
qa_usage_mark('control');
}
if (isset($categoryids) && !is_array($categoryids)) {
// accept old-style parameter
$categoryids = array($categoryids);
}
$lastcategoryid = count($categoryids) ? end($categoryids) : null;
$qa_content = array('content_type' => 'text/html; charset=utf-8', 'site_title' => qa_html(qa_opt('site_title')), 'head_lines' => array(), 'navigation' => array('user' => array(), 'main' => array(), 'footer' => array('feedback' => array('url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback')))), 'sidebar' => qa_opt('show_custom_sidebar') ? qa_opt('custom_sidebar') : null, 'sidepanel' => qa_opt('show_custom_sidepanel') ? qa_opt('custom_sidepanel') : null, 'widgets' => array());
if (qa_opt('show_custom_in_head')) {
$qa_content['head_lines'][] = qa_opt('custom_in_head');
}
if (qa_opt('show_custom_header')) {
$qa_content['body_header'] = qa_opt('custom_header');
}
if (qa_opt('show_custom_footer')) {
$qa_content['body_footer'] = qa_opt('custom_footer');
}
if (isset($categoryids)) {
$qa_content['categoryids'] = $categoryids;
}
foreach ($qa_nav_pages_cached as $page) {
if ($page['nav'] == 'B') {
qa_navigation_add_page($qa_content['navigation']['main'], $page);
}
}
if (qa_opt('nav_home') && qa_opt('show_custom_home')) {
$qa_content['navigation']['main']['$'] = array('url' => qa_path_html(''), 'label' => qa_lang_html('main/nav_home'));
}
if (qa_opt('nav_activity')) {
$qa_content['navigation']['main']['activity'] = array('url' => qa_path_html('activity'), 'label' => qa_lang_html('main/nav_activity'));
}
$hascustomhome = qa_has_custom_home();
if (qa_opt($hascustomhome ? 'nav_qa_not_home' : 'nav_qa_is_home')) {
$qa_content['navigation']['main'][$hascustomhome ? 'qa' : '$'] = array('url' => qa_path_html($hascustomhome ? 'qa' : ''), 'label' => qa_lang_html('main/nav_qa'));
}
if (qa_opt('nav_questions')) {
$qa_content['navigation']['main']['questions'] = array('url' => qa_path_html('questions'), 'label' => qa_lang_html('main/nav_qs'));
}
if (qa_opt('nav_hot')) {
$qa_content['navigation']['main']['hot'] = array('url' => qa_path_html('hot'), 'label' => qa_lang_html('main/nav_hot'));
}
if (qa_opt('nav_unanswered')) {
$qa_content['navigation']['main']['unanswered'] = array('url' => qa_path_html('unanswered'), 'label' => qa_lang_html('main/nav_unanswered'));
}
if (qa_using_tags() && qa_opt('nav_tags')) {
$qa_content['navigation']['main']['tag'] = array('url' => qa_path_html('tags'), 'label' => qa_lang_html('main/nav_tags'));
}
if (qa_using_categories() && qa_opt('nav_categories')) {
$qa_content['navigation']['main']['categories'] = array('url' => qa_path_html('categories'), 'label' => qa_lang_html('main/nav_categories'));
}
if (qa_opt('nav_users')) {
$qa_content['navigation']['main']['user'] = array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/nav_users'));
}
if (qa_user_permit_error('permit_post_q') != 'level') {
$qa_content['navigation']['main']['ask'] = array('url' => qa_path_html('ask', qa_using_categories() && strlen($lastcategoryid) ? array('cat' => $lastcategoryid) : null), 'label' => qa_lang_html('main/nav_ask'));
}
if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$qa_content['navigation']['main']['admin'] = array('url' => qa_path_html(isset($_COOKIE['qa_admin_last']) && isset($QA_CONST_ROUTING[$_COOKIE['qa_admin_last']]) ? $_COOKIE['qa_admin_last'] : 'admin'), 'label' => qa_lang_html('main/nav_admin'));
}
$qa_content['search'] = array('form_tags' => 'METHOD="GET" ACTION="' . qa_path_html('search') . '"', 'form_extra' => qa_path_form_html('search'), 'title' => qa_lang_html('main/search_title'), 'field_tags' => 'NAME="q"', 'button_label' => qa_lang_html('main/search_button'));
if (!qa_opt('feedback_enabled')) {
unset($qa_content['navigation']['footer']['feedback']);
}
foreach ($qa_nav_pages_cached as $page) {
if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') {
qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page);
}
}
$regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side');
$placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom');
foreach ($qa_widgets_cached as $widget) {
if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) {
// see if it has been selected for display on this template
$region = @$regioncodes[substr($widget['place'], 0, 1)];
$place = @$placecodes[substr($widget['place'], 1, 2)];
if (isset($region) && isset($place)) {
// check region/place codes recognized
$module = qa_load_module('widget', $widget['title']);
if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template($qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) {
$qa_content['widgets'][$region][$place][] = $module;
}
// if module loaded and happy to be displayed here, tell theme about it
}
}
}
$logoshow = qa_opt('logo_show');
$logourl = qa_opt('logo_url');
$logowidth = qa_opt('logo_width');
$logoheight = qa_opt('logo_height');
if ($logoshow) {
$qa_content['logo'] = '<A HREF="' . qa_path_html('') . '" CLASS="qa-logo-link" TITLE="' . qa_html(qa_opt('site_title')) . '">' . '<IMG SRC="' . qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : $qa_root_url_relative . $logourl) . '"' . ($logowidth ? ' WIDTH="' . $logowidth . '"' : '') . ($logoheight ? ' HEIGHT="' . $logoheight . '"' : '') . ' BORDER="0"/></A>';
} else {
$qa_content['logo'] = '<A HREF="' . qa_path_html('') . '" CLASS="qa-logo-link">' . qa_html(qa_opt('site_title')) . '</A>';
}
$topath = qa_get('to');
// lets user switch between login and register without losing destination page
//.........这里部分代码省略.........
示例11: qa_lang
$pageerror = qa_lang('users/login_limit');
}
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/login_title');
$qa_content['error'] = @$pageerror;
if (empty($inemailhandle) || isset($errors['emailhandle'])) {
$forgotpath = qa_path('forgot');
} else {
$forgotpath = qa_path('forgot', array('e' => $inemailhandle));
}
$forgothtml = '<A HREF="' . qa_html($forgotpath) . '">' . qa_lang_html('users/forgot_link') . '</A>';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'ok' => $passwordsent ? qa_lang_html('users/password_sent') : null, 'fields' => array('email_handle' => array('label' => qa_lang_html('users/email_handle_label'), 'tags' => 'NAME="emailhandle" ID="emailhandle"', 'value' => qa_html(@$inemailhandle), 'error' => qa_html(@$errors['emailhandle'])), 'password' => array('type' => 'password', 'label' => qa_lang_html('users/password_label'), 'tags' => 'NAME="password" ID="password"', 'value' => qa_html(@$inpassword), 'error' => empty($errors['password']) ? '' : qa_html(@$errors['password']) . ' - ' . $forgothtml . ' ->' . qa_html(@$errors['category']) . '<-', 'note' => $passwordsent ? qa_lang_html('users/password_sent') : $forgothtml), 'category' => array('label' => qa_lang_html('question/q_category_label'), 'tags' => 'NAME="category" ID="category"', 'value' => qa_html(@$incategory), 'error' => qa_html(@$errors['category'])), 'remember' => array('type' => 'checkbox', 'label' => qa_lang_html('users/remember_label'), 'tags' => 'NAME="remember"', 'value' => @$inremember ? true : false)), 'buttons' => array('login' => array('label' => qa_lang_html('users/login_button'))), 'hidden' => array('dologin' => '1'));
$modulenames = qa_list_modules('login');
foreach ($modulenames as $tryname) {
$module = qa_load_module('login', $tryname);
if (method_exists($module, 'login_html')) {
ob_start();
$module->login_html(qa_opt('site_url') . qa_get('to'), 'login');
$html = ob_get_clean();
if (strlen($html)) {
@($qa_content['custom'] .= '<BR>' . $html . '<BR>');
}
}
}
$qa_content['focusid'] = isset($inemailhandle) && !isset($errors['emailhandle']) ? 'password' : 'emailhandle';
// add handling of sub categories
//if (qa_using_categories() && count($categories)) {
// $incategoryid=qa_get_category_field_value('category');
// if (!isset($incategoryid))
// $incategoryid=qa_get('cat');
示例12: qa_admin_is_slug_reserved
function qa_admin_is_slug_reserved($requestpart)
{
global $QA_CONST_ROUTING, $QA_CONST_PATH_MAP;
$requestpart = trim(strtolower($requestpart));
if (isset($QA_CONST_ROUTING[$requestpart]) || isset($QA_CONST_ROUTING[$requestpart . '/']) || is_numeric($requestpart)) {
return true;
}
if (isset($QA_CONST_PATH_MAP)) {
foreach ($QA_CONST_PATH_MAP as $requestmap) {
if (trim(strtolower($requestmap)) == $requestpart) {
return true;
}
}
}
switch ($requestpart) {
case '':
case 'qa':
case 'feed':
case 'install':
case 'url':
case 'image':
case 'ajax':
return true;
}
$modulenames = qa_list_modules('page');
foreach ($modulenames as $tryname) {
$trypage = qa_load_module('page', $tryname);
if (method_exists($trypage, 'match_request') && $trypage->match_request($requestpart)) {
return true;
}
}
return false;
}
示例13: qa_report_event
function qa_report_event($event, $userid, $handle, $cookieid, $params = array())
{
global $qa_event_reports_suspended;
if ($qa_event_reports_suspended > 0) {
return;
}
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
$modulenames = qa_list_modules('event');
foreach ($modulenames as $tryname) {
$trymodule = qa_load_module('event', $tryname);
if (method_exists($trymodule, 'process_event')) {
$trymodule->process_event($event, $userid, $handle, $cookieid, $params);
}
}
}
示例14: qa_html
$qa_content['title'] = qa_html($custompage['heading']);
$qa_content['custom'] = $custompage['content'];
if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid']))));
}
return $qa_content;
}
// Then, see if we should redirect because the 'qa' page is the same as the home page
if ($explicitqa && !qa_is_http_post() && !qa_has_custom_home()) {
qa_redirect(qa_category_path_request($categories, $categoryid), $_GET);
}
// Then, if there's a slug that matches no category, check page modules provided by plugins
if (!$explicitqa && $countslugs && !isset($categoryid)) {
$modulenames = qa_list_modules('page');
foreach ($modulenames as $tryname) {
$trypage = qa_load_module('page', $tryname);
if (method_exists($trypage, 'match_request') && $trypage->match_request($qa_request)) {
$qa_template = 'plugin';
return $trypage->process_request($qa_request);
}
}
}
// Then, check whether we are showing a custom home page
if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) {
$qa_template = 'custom';
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_html(qa_opt('custom_home_heading'));
if (qa_opt('show_home_description')) {
$qa_content['description'] = qa_html(qa_opt('home_description'));
}
$qa_content['custom'] = qa_opt('custom_home_content');
示例15: html_to_text
function html_to_text($html)
{
$viewer = qa_load_module('viewer', '');
return $viewer->get_text($html, 'html', array());
}