当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_list_modules函数代码示例

本文整理汇总了PHP中qa_list_modules函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_list_modules函数的具体用法?PHP qa_list_modules怎么用?PHP qa_list_modules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qa_list_modules函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_form

 function admin_form(&$qa_content)
 {
     // Process form input
     $ok = null;
     if (qa_clicked('ajax_comment_save')) {
         qa_opt('ajax_comment_enable', (bool) qa_post_text('ajax_comment_enable'));
         qa_opt('ajax_comment_format', (int) qa_post_text('ajax_comment_format'));
         qa_opt('ajax_comment_username', (bool) qa_post_text('ajax_comment_username'));
         qa_opt('ajax_comment_flash_star', (bool) qa_post_text('ajax_comment_flash_star'));
         qa_opt('ajax_comment_answer_reminder', (bool) qa_post_text('ajax_comment_answer_reminder'));
         qa_opt('ajax_comment_answer_reminder_text', qa_post_text('ajax_comment_answer_reminder_text'));
         qa_opt('ajax_comment_popup_notice', (bool) qa_post_text('ajax_comment_popup_notice'));
         qa_opt('ajax_comment_popup_notice_text', qa_post_text('ajax_comment_popup_notice_text'));
         $ok = 'Settings Saved.';
     }
     $formats = array();
     $formats[] = 'plain text';
     $editors = qa_list_modules('viewer');
     if (in_array('Markdown Viewer', $editors)) {
         $formats[] = 'markdown';
     }
     $formats[] = 'html';
     // Create the form for display
     $fields = array();
     $fields[] = array('label' => 'Enable ajax comment form', 'tags' => 'NAME="ajax_comment_enable"', 'value' => qa_opt('ajax_comment_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Comment format', 'tags' => 'NAME="ajax_comment_format"', 'type' => 'select', 'options' => $formats, 'value' => @$formats[qa_opt('ajax_comment_format')]);
     $fields[] = array('label' => 'Add @username to comment box', 'tags' => 'NAME="ajax_comment_username"', 'value' => (int) qa_opt('ajax_comment_username'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Show reminder text if commenting on answer to own question', 'tags' => 'NAME="ajax_comment_answer_reminder" onclick="if(this.checked) jQuery(\'#ajax_comment_answer_reminder_text\').fadeIn(); else jQuery(\'#ajax_comment_answer_reminder_text\').fadeOut();"', 'value' => (int) qa_opt('ajax_comment_answer_reminder'), 'type' => 'checkbox');
     $fields[] = array('tags' => 'id="ajax_comment_answer_reminder_text" name="ajax_comment_answer_reminder_text" style="display:' . (qa_opt('ajax_comment_answer_reminder') ? 'block' : 'none') . '"', 'value' => qa_html(qa_opt('ajax_comment_answer_reminder_text')), 'type' => 'text');
     $fields[] = array('label' => 'Flash select star if commenting on answer to own question', 'tags' => 'NAME="ajax_comment_flash_star"', 'value' => (int) qa_opt('ajax_comment_flash_star'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Show reminder pop-up if if voting up answer to own question', 'tags' => 'NAME="ajax_comment_popup_notice" onclick="if(this.checked) jQuery(\'#ajax_comment_popup_notice_text\').fadeIn(); else jQuery(\'#ajax_comment_popup_notice_text\').fadeOut();"', 'value' => (int) qa_opt('ajax_comment_popup_notice'), 'type' => 'checkbox');
     $fields[] = array('tags' => 'id="ajax_comment_popup_notice_text" name="ajax_comment_popup_notice_text" style="display:' . (qa_opt('ajax_comment_popup_notice') ? 'block' : 'none') . '"', 'value' => qa_html(qa_opt('ajax_comment_popup_notice_text')), 'type' => 'text');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="ajax_comment_save"')));
 }
开发者ID:microbye,项目名称:q2a-comment-ajax,代码行数:34,代码来源:qa-comment-admin.php

示例2: head_custom

 function head_custom()
 {
     qa_html_theme_base::head_custom();
     if (@$this->template == 'user' && qa_opt('signatures_enable')) {
         $formats = qa_list_modules('editor');
         $editorname = $formats[qa_opt('signatures_format')];
         $handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $this->request);
         if (qa_get_logged_in_handle() == $handle && (!$editorname || $editorname == 'Markdown Editor')) {
             $this->output_raw('<script src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'textLimitCount.js" type="text/javascript"></script>');
             $this->output_raw("\n<script>\n\tvar signature_max_length = " . (qa_opt('signatures_length') ? qa_opt('signatures_length') : 1000) . ";\n\tjQuery('document').ready(function(){\n\t\ttextLimiter(jQuery('textarea[name=\"signature_text\"]'),{\n\t\tmaxLength: signature_max_length,\n\t\telCount: 'elCount'\n\t  });\n\t});\n</script>");
         }
     }
 }
开发者ID:NoahY,项目名称:q2a-signatures,代码行数:13,代码来源:qa-sig-layer.php

示例3: admin_form

 function admin_form(&$qa_content)
 {
     // Process form input
     $ok = null;
     if (qa_clicked('signatures_save')) {
         if (qa_post_text('signatures_length') > 1000) {
             $error = 'Max possible signature length is 1000 characters';
         } else {
             if (!qa_opt('signatures_enable') && qa_post_text('signatures_enable')) {
                 qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^usersignatures (' . 'userid INT(11) NOT NULL,' . 'signature VARCHAR (1000) DEFAULT \'\',' . 'format VARCHAR (20) DEFAULT \'\',' . 'id INT(11) NOT NULL AUTO_INCREMENT,' . 'UNIQUE (userid),' . 'PRIMARY KEY (id)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8');
             }
             qa_opt('signatures_enable', (bool) qa_post_text('signatures_enable'));
             qa_opt('signatures_q_enable', (bool) qa_post_text('signatures_q_enable'));
             qa_opt('signatures_a_enable', (bool) qa_post_text('signatures_a_enable'));
             qa_opt('signatures_c_enable', (bool) qa_post_text('signatures_c_enable'));
             qa_opt('signatures_profile_enable', (bool) qa_post_text('signatures_profile_enable'));
             qa_opt('signatures_length', (int) qa_post_text('signatures_length'));
             qa_opt('signatures_format', (int) qa_post_text('signatures_format'));
             qa_opt('signatures_html', (bool) qa_post_text('signatures_html'));
             qa_opt('signatures_header', qa_post_text('signatures_header'));
             qa_opt('signatures_footer', qa_post_text('signatures_footer'));
             $ok = 'Settings Saved.';
         }
     }
     // Create the form for display
     $formats = qa_list_modules('editor');
     foreach ($formats as $key => $format) {
         if (!strlen($format)) {
             $formats[$key] = qa_lang_html('admin/basic_editor');
         }
     }
     $fields = array();
     $fields[] = array('label' => 'Enable signatures', 'tags' => 'NAME="signatures_enable"', 'value' => qa_opt('signatures_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'in questions', 'tags' => 'NAME="signatures_q_enable"', 'value' => qa_opt('signatures_q_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'in answers', 'tags' => 'NAME="signatures_a_enable"', 'value' => qa_opt('signatures_a_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'in comments', 'tags' => 'NAME="signatures_c_enable"', 'value' => qa_opt('signatures_c_enable'), 'type' => 'checkbox');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Show signatures in public profiles', 'tags' => 'NAME="signatures_profile_enable"', 'value' => qa_opt('signatures_profile_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Signature length (chars)', 'type' => 'number', 'value' => (int) qa_opt('signatures_length'), 'tags' => 'NAME="signatures_length"', 'note' => 'max possible is 1000 characters');
     $fields[] = array('label' => 'Signature format', 'tags' => 'NAME="signatures_format"', 'type' => 'select', 'options' => $formats, 'value' => @$formats[qa_opt('signatures_format')]);
     $fields[] = array('label' => 'Allow HTML', 'tags' => 'NAME="signatures_html"', 'value' => qa_opt('signatures_html'), 'type' => 'checkbox');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Signature header', 'type' => 'text', 'value' => qa_html(qa_opt('signatures_header')), 'tags' => 'NAME="signatures_header"');
     $fields[] = array('label' => 'Signature footer', 'type' => 'text', 'value' => qa_html(qa_opt('signatures_footer')), 'tags' => 'NAME="signatures_footer"');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="signatures_save"')));
 }
开发者ID:NoahY,项目名称:q2a-signatures,代码行数:46,代码来源:qa-sig-admin.php

示例4: qa_html

        if (strlen(@$metadata['description'])) {
            $deschtml = qa_html($metadata['description']) . '<BR>';
        } else {
            $deschtml = '';
        }
        $pluginhtml = $namehtml . ' ' . $authorhtml . '<BR>' . $deschtml . '<SMALL STYLE="color:#666">' . qa_html(dirname($pluginfile) . '/') . '</SMALL>';
        if (is_numeric($metadata['min_q2a']) && (double) QA_VERSION > 0 && $metadata['min_q2a'] > (double) QA_VERSION) {
            $pluginhtml = '<STRIKE STYLE="color:#999">' . $pluginhtml . '</STRIKE><BR><SPAN STYLE="color:#f00">' . qa_lang_html_sub('admin/requires_q2a_version', qa_html($metadata['min_q2a'])) . '</SPAN>';
        }
        $qa_content['form']['fields'][] = array('type' => 'custom', 'html' => $pluginhtml);
    }
}
$formadded = false;
$moduletypes = qa_list_module_types();
foreach ($moduletypes as $type) {
    $modulenames = qa_list_modules($type);
    foreach ($modulenames as $name) {
        $module = qa_load_module($type, $name);
        if (method_exists($module, 'admin_form')) {
            $form = $module->admin_form($qa_content);
            if (!isset($form['title'])) {
                $form['title'] = qa_html($name);
            }
            $identifierhtml = qa_html(md5($type . '/' . $name));
            $form['title'] = '<A NAME="' . $identifierhtml . '">' . $form['title'] . '</A>';
            if (!isset($form['tags'])) {
                $form['tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '#' . $identifierhtml . '"';
            }
            if (!isset($form['style'])) {
                $form['style'] = 'tall';
            }
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-admin-plugins.php

示例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;
}
开发者ID:netham91,项目名称:question2answer,代码行数:12,代码来源:qa-base.php

示例6: qa_lang_html_sub

     $optionfield['note'] = qa_lang_html_sub('main/x_comments', '');
     break;
 case 'match_related_qs':
 case 'match_ask_check_qs':
 case 'match_example_tags':
     qa_optionfield_make_select($optionfield, qa_admin_match_options(), $value, 3);
     break;
 case 'block_bad_words':
     $optionfield['style'] = 'tall';
     $optionfield['rows'] = 4;
     $optionfield['note'] = qa_lang_html('admin/block_words_note');
     break;
 case 'editor_for_qs':
 case 'editor_for_as':
 case 'editor_for_cs':
     $editors = qa_list_modules('editor');
     $selectoptions = array();
     $optionslinks = false;
     foreach ($editors as $editor) {
         $selectoptions[qa_html($editor)] = strlen($editor) ? qa_html($editor) : qa_lang_html('admin/basic_editor');
         if ($editor == $value) {
             $module = qa_load_module('editor', $editor);
             if (method_exists($module, 'admin_form')) {
                 $optionfield['note'] = '<a href="' . qa_admin_module_options_path('editor', $editor) . '">' . qa_lang_html('admin/options') . '</a>';
             }
         }
     }
     qa_optionfield_make_select($optionfield, $selectoptions, $value, '');
     break;
 case 'show_custom_ask':
 case 'extra_field_active':
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-admin-default.php

示例7: 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;
}
开发者ID:roine,项目名称:q2a-badges,代码行数:79,代码来源:qa-plugin.php

示例8: qa_get_request_content

function qa_get_request_content()
{
    $qa_content = qa_get_request_content_base();
    // displays signature form in user profile
    $qa_request = strtolower(qa_request());
    $reqs = explode('/', $qa_request);
    if ($reqs[0] == 'user') {
        // permissions
        if (isset($qa_content['form_profile']['fields']['permits'])) {
            $ov = $qa_content['form_profile']['fields']['permits']['value'];
            $ov = str_replace('[profile/signature_allow]', qa_lang('signature_plugin/signature_allow'), $ov);
            $ov = str_replace('[profile/signature_edit_allow]', qa_lang('signature_plugin/signature_edit_allow'), $ov);
            $qa_content['form_profile']['fields']['permits']['value'] = $ov;
        }
        $qa_content['user_signature_form'] = array();
        $userid = @$qa_content['raw']['userid'];
        if (!$userid) {
            return $qa_content;
        }
        $handles = qa_userids_to_handles(array($userid));
        $handle = $handles[$userid];
        if (qa_get_logged_in_handle() == $handle && !qa_user_permit_error('signature_allow') || !qa_user_permit_error('signature_edit_allow')) {
            $ok = null;
            $formats = qa_list_modules('editor');
            $format = qa_opt('signatures_format');
            $editorname = $formats[$format];
            if (!strlen($editorname)) {
                $editorname = qa_lang_html('admin/basic_editor');
            }
            $editor = qa_load_editor('', '', $editorname);
            qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^usersignatures (' . 'userid INT(11) NOT NULL,' . 'signature VARCHAR (1000) DEFAULT \'\',' . 'format VARCHAR (20) DEFAULT \'\',' . 'id INT(11) NOT NULL AUTO_INCREMENT,' . 'UNIQUE (userid),' . 'PRIMARY KEY (id)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8');
            if (qa_clicked('signature_save')) {
                if (strlen(qa_post_text('signature_text')) > qa_opt('signatures_length')) {
                    $error = 'Max possible signature length is 1000 characters';
                } else {
                    $readdata = $editor->read_post('signature_text');
                    $informat = $readdata['format'];
                    $incontent = qa_post_text('signature_text');
                    qa_db_query_sub('INSERT INTO ^usersignatures (userid,signature,format) VALUES (#,$,$) ON DUPLICATE KEY UPDATE signature=$,format=$', $userid, $incontent, $informat, $incontent, $informat);
                    $ok = 'Signature Saved.';
                }
            }
            $content = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY signature AS signature,format FROM ^usersignatures WHERE userid=#', $userid), true);
            $field = qa_editor_load_field($editor, $qa_content, $content['signature'], $content['format'], 'signature_text', 12, false);
            $field['label'] = qa_lang_html('signature_plugin/signature');
            $fields['content'] = $field;
            if (!$editorname || $editorname == 'Markdown Editor') {
                $fields['elCount'] = array('label' => '<div id="elCount">' . qa_opt('signatures_length') . '</div>', 'type' => 'static');
            }
            $form = array('ok' => $ok && !isset($error) ? $ok : null, 'error' => @$error, 'style' => 'tall', 'title' => '<a name="signature_text"></a>' . qa_lang_html('signature_plugin/signature'), 'tags' => 'action="' . qa_self_html() . '#signature_text" method="POST"', 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="signature_save"')), 'hidden' => array('editor' => qa_html($editorname), 'dosavesig' => '1'));
            $qa_content['user_signature_form'] = $form;
        } else {
            if (qa_opt('signatures_profile_enable')) {
                $content = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY signature as signature, format FROM ^usersignatures WHERE userid=#', $userid), true);
                if (!$content) {
                    return $qa_content;
                }
                $informat = $content['format'];
                $viewer = qa_load_viewer($content['signature'], $informat);
                global $options;
                $signature = qa_viewer_html($content['signature'], $informat, array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
                $fields[] = array('label' => qa_opt('signatures_header') . $signature . qa_opt('signatures_footer'), 'type' => 'static');
                $qa_content['user_signature_form'] = array('title' => 'Signature', 'fields' => $fields, 'style' => 'tall');
            }
        }
    }
    return $qa_content;
}
开发者ID:NoahY,项目名称:q2a-signatures,代码行数:68,代码来源:qa-sig-overrides.php

示例9: ajaxPostComment

 function ajaxPostComment($text, $aid = false)
 {
     if ($aid) {
         $answer = qa_db_single_select(qa_db_full_post_selectspec(null, $aid));
     }
     require_once QA_INCLUDE_DIR . 'qa-page-question-post.php';
     global $qa_login_userid, $qa_cookieid, $question, $questionid, $formtype, $formpostid, $errors, $reloadquestion, $pageerror, $qa_request, $ineditor, $incomment, $informat, $innotify, $inemail, $commentsfollows, $jumptoanchor, $usecaptcha;
     $parent = isset($answer) ? $answer : $question;
     switch (qa_user_permit_error('permit_post_c', 'C')) {
         case 'login':
             $pageerror = qa_insert_login_links(qa_lang_html('question/comment_must_login'), $qa_request);
             break;
         case 'confirm':
             $pageerror = qa_insert_login_links(qa_lang_html('question/comment_must_confirm'), $qa_request);
             break;
         case 'limit':
             $pageerror = qa_lang_html('question/comment_limit');
             break;
         default:
             $pageerror = qa_lang_html('users/no_permission');
             break;
         case false:
             $incomment = qa_post_text('ajax_comment_content');
             if (!isset($incomment)) {
                 $pageerror = qa_lang_html('bork');
             } else {
                 $innotify = qa_post_text('notify') ? true : false;
                 $inemail = qa_post_text('email');
                 $this->ajaxEditor($ineditor, $incomment, $informat, $intext);
                 // use our own format types
                 $formats = array();
                 $formats[] = '';
                 $editors = qa_list_modules('viewer');
                 if (in_array('Markdown Viewer', $editors)) {
                     $formats[] = 'markdown';
                 }
                 $formats[] = 'html';
                 $informat = $formats[qa_opt('ajax_comment_format')];
                 $errors = qa_comment_validate($incomment, $informat, $intext, $innotify, $inemail);
                 if ($usecaptcha) {
                     qa_captcha_validate($_POST, $errors);
                 }
                 if (empty($errors)) {
                     $isduplicate = false;
                     foreach ($commentsfollows as $comment) {
                         if ($comment['basetype'] == 'C' && $comment['parentid'] == $parent['postid'] && !$comment['hidden']) {
                             if (implode(' ', qa_string_to_words($comment['content'])) == implode(' ', qa_string_to_words($incomment))) {
                                 $isduplicate = true;
                             }
                         }
                     }
                     if (!$isduplicate) {
                         if (!isset($qa_login_userid)) {
                             $qa_cookieid = qa_cookie_get_create();
                         }
                         // create a new cookie if necessary
                         // get editor format
                         $commentid = qa_comment_create($qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, $incomment, $informat, $intext, $innotify, $inemail, $question, @$answer, $commentsfollows);
                         qa_report_write_action($qa_login_userid, $qa_cookieid, 'c_post', $questionid, @$answer['postid'], $commentid);
                     } else {
                         $pageerror = qa_lang_html('question/duplicate_content');
                     }
                 }
             }
             break;
     }
     if ($pageerror) {
         $this->output_raw('### ' . $pageerror);
     } else {
         if (!empty($errors)) {
             $this->output_raw('### ' . implode(',', $errors));
         } else {
             // return c_item
             $c_item = $this->ajaxCommentCreate($parent, $commentid);
             if (isset($c_item['classes'])) {
                 $c_item['classes'] .= ' ajax-comment-hidden';
             } else {
                 $c_item['classes'] = ' ajax-comment-hidden';
             }
             $this->c_list_item($c_item);
         }
     }
 }
开发者ID:microbye,项目名称:q2a-comment-ajax,代码行数:83,代码来源:qa-comment-layer.php

示例10: qa_content_prepare


//.........这里部分代码省略.........
        $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
    $userlinks = qa_get_login_links($qa_root_url_relative, isset($topath) ? $topath : qa_path($qa_request, $_GET, ''));
    $qa_content['navigation']['user'] = array();
    if (isset($qa_login_userid)) {
        $qa_content['loggedin'] = qa_lang_html_sub_split('main/logged_in_x', QA_FINAL_EXTERNAL_USERS ? qa_get_logged_in_user_html(qa_get_logged_in_user_cache(), $qa_root_url_relative, false) : qa_get_one_user_html(qa_get_logged_in_handle(), false));
        if (!QA_FINAL_EXTERNAL_USERS) {
            $qa_content['navigation']['user']['account'] = array('url' => qa_path_html('account'), 'label' => qa_lang_html('main/nav_account'));
        }
        if (!empty($userlinks['logout'])) {
            $qa_content['navigation']['user']['logout'] = array('url' => qa_html(@$userlinks['logout']), 'label' => qa_lang_html('main/nav_logout'));
        }
        if (!QA_FINAL_EXTERNAL_USERS) {
            $source = qa_get_logged_in_source();
            if (strlen($source)) {
                $modulenames = qa_list_modules('login');
                foreach ($modulenames as $tryname) {
                    $module = qa_load_module('login', $tryname);
                    if (method_exists($module, 'match_source') && $module->match_source($source) && method_exists($module, 'logout_html')) {
                        ob_start();
                        $module->logout_html(qa_path('logout', array(), qa_opt('site_url')));
                        $qa_content['navigation']['user']['logout'] = array('label' => ob_get_clean());
                    }
                }
            }
        }
    } else {
        $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(isset($topath) ? qa_opt('site_url') . $topath : qa_path($qa_request, $_GET, qa_opt('site_url')), 'menu');
                $qa_content['navigation']['user'][$tryname] = array('label' => ob_get_clean());
            }
        }
        if (!empty($userlinks['login'])) {
            $qa_content['navigation']['user']['login'] = array('url' => qa_html(@$userlinks['login']), 'label' => qa_lang_html('main/nav_login'));
        }
        if (!empty($userlinks['register'])) {
            $qa_content['navigation']['user']['register'] = array('url' => qa_html(@$userlinks['register']), 'label' => qa_lang_html('main/nav_register'));
        }
    }
    $qa_content['script_rel'] = array('qa-content/jquery-1.6.1.min.js');
    if ($voting) {
        $qa_content['error'] = @$qa_vote_error_html;
        $qa_content['script_rel'][] = 'qa-content/qa-votes.js?' . QA_VERSION;
    }
    $qa_content['script_var'] = array('qa_root' => $qa_root_url_relative, 'qa_request' => $qa_request);
    return $qa_content;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:101,代码来源:qa-page.php

示例11: 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;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:33,代码来源:qa-app-admin.php

示例12: qa_load_viewer

function qa_load_viewer($content, $format)
{
    $maxviewer = null;
    $maxquality = 0;
    $modulenames = qa_list_modules('viewer');
    foreach ($modulenames as $tryname) {
        $tryviewer = qa_load_module('viewer', $tryname);
        $tryquality = $tryviewer->calc_quality($content, $format);
        if ($tryquality > $maxquality) {
            $maxviewer = $tryviewer;
            $maxquality = $tryquality;
        }
    }
    return $maxviewer;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:15,代码来源:qa-app-format.php

示例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);
        }
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:15,代码来源:qa-base.php

示例14: qa_content_prepare

    $qa_template = 'custom';
    $qa_content = qa_content_prepare();
    $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'));
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page-default.php

示例15: qa_default_option

function qa_default_option($name)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    $fixed_defaults = array('allow_change_usernames' => 1, 'allow_close_questions' => 1, 'allow_multi_answers' => 1, 'allow_private_messages' => 1, 'allow_self_answer' => 1, 'allow_view_q_bots' => 1, 'avatar_allow_gravatar' => 1, 'avatar_allow_upload' => 1, 'avatar_profile_size' => 200, 'avatar_q_list_size' => 0, 'avatar_q_page_a_size' => 40, 'avatar_q_page_c_size' => 20, 'avatar_q_page_q_size' => 50, 'avatar_store_size' => 400, 'avatar_users_size' => 30, 'captcha_on_anon_post' => 1, 'captcha_on_feedback' => 1, 'captcha_on_register' => 1, 'captcha_on_reset_password' => 1, 'captcha_on_unconfirmed' => 0, 'columns_tags' => 3, 'columns_users' => 2, 'comment_on_as' => 1, 'comment_on_qs' => 0, 'confirm_user_emails' => 1, 'do_ask_check_qs' => 0, 'do_complete_tags' => 1, 'do_count_q_views' => 1, 'do_example_tags' => 1, 'feed_for_activity' => 1, 'feed_for_qa' => 1, 'feed_for_questions' => 1, 'feed_for_unanswered' => 1, 'feed_full_text' => 1, 'feed_number_items' => 50, 'feed_per_category' => 1, 'feedback_enabled' => 1, 'flagging_hide_after' => 5, 'flagging_notify_every' => 2, 'flagging_notify_first' => 1, 'flagging_of_posts' => 1, 'follow_on_as' => 1, 'hot_weight_a_age' => 100, 'hot_weight_answers' => 100, 'hot_weight_q_age' => 100, 'hot_weight_views' => 100, 'hot_weight_votes' => 100, 'mailing_per_minute' => 500, 'match_ask_check_qs' => 3, 'match_example_tags' => 3, 'match_related_qs' => 3, 'max_copy_user_updates' => 10, 'max_len_q_title' => 120, 'max_num_q_tags' => 5, 'max_rate_ip_as' => 50, 'max_rate_ip_cs' => 40, 'max_rate_ip_flags' => 10, 'max_rate_ip_logins' => 20, 'max_rate_ip_messages' => 10, 'max_rate_ip_qs' => 20, 'max_rate_ip_registers' => 5, 'max_rate_ip_uploads' => 20, 'max_rate_ip_votes' => 600, 'max_rate_user_as' => 25, 'max_rate_user_cs' => 20, 'max_rate_user_flags' => 5, 'max_rate_user_messages' => 5, 'max_rate_user_qs' => 10, 'max_rate_user_uploads' => 10, 'max_rate_user_votes' => 300, 'max_store_user_updates' => 50, 'min_len_a_content' => 12, 'min_len_c_content' => 12, 'min_len_q_content' => 0, 'min_len_q_title' => 12, 'min_num_q_tags' => 0, 'moderate_notify_admin' => 1, 'moderate_points_limit' => 150, 'nav_ask' => 1, 'nav_qa_not_home' => 1, 'nav_questions' => 1, 'nav_tags' => 1, 'nav_unanswered' => 1, 'nav_users' => 1, 'neat_urls' => QA_URL_FORMAT_SAFEST, 'notify_users_default' => 1, 'page_size_activity' => 20, 'page_size_ask_check_qs' => 5, 'page_size_ask_tags' => 5, 'page_size_home' => 20, 'page_size_hot_qs' => 20, 'page_size_q_as' => 10, 'page_size_qs' => 20, 'page_size_related_qs' => 5, 'page_size_search' => 10, 'page_size_tag_qs' => 20, 'page_size_tags' => 30, 'page_size_una_qs' => 20, 'page_size_user_posts' => 20, 'page_size_users' => 20, 'pages_prev_next' => 3, 'permit_anon_view_ips' => QA_PERMIT_EDITORS, 'permit_close_q' => QA_PERMIT_EDITORS, 'permit_delete_hidden' => QA_PERMIT_MODERATORS, 'permit_edit_a' => QA_PERMIT_EXPERTS, 'permit_edit_c' => QA_PERMIT_EDITORS, 'permit_edit_q' => QA_PERMIT_EDITORS, 'permit_flag' => QA_PERMIT_CONFIRMED, 'permit_hide_show' => QA_PERMIT_EDITORS, 'permit_moderate' => QA_PERMIT_EXPERTS, 'permit_select_a' => QA_PERMIT_EXPERTS, 'permit_view_q_page' => QA_PERMIT_ALL, 'permit_vote_a' => QA_PERMIT_USERS, 'permit_vote_down' => QA_PERMIT_USERS, 'permit_vote_q' => QA_PERMIT_USERS, 'points_a_selected' => 30, 'points_a_voted_max_gain' => 20, 'points_a_voted_max_loss' => 5, 'points_base' => 100, 'points_multiple' => 10, 'points_post_a' => 4, 'points_post_q' => 2, 'points_q_voted_max_gain' => 10, 'points_q_voted_max_loss' => 3, 'points_select_a' => 3, 'q_urls_title_length' => 50, 'show_a_c_links' => 1, 'show_a_form_immediate' => 'if_no_as', 'show_c_reply_buttons' => 1, 'show_custom_welcome' => 1, 'show_fewer_cs_count' => 5, 'show_fewer_cs_from' => 10, 'show_full_date_days' => 7, 'show_message_history' => 1, 'show_selected_first' => 1, 'show_url_links' => 1, 'show_user_points' => 1, 'show_user_titles' => 1, 'show_when_created' => 1, 'site_theme' => 'Snow', 'smtp_port' => 25, 'sort_answers_by' => 'created', 'tags_or_categories' => 'tc', 'voting_on_as' => 1, 'voting_on_qs' => 1);
    if (isset($fixed_defaults[$name])) {
        $value = $fixed_defaults[$name];
    } else {
        switch ($name) {
            case 'site_url':
                $value = 'http://' . @$_SERVER['HTTP_HOST'] . strtr(dirname($_SERVER['SCRIPT_NAME']), '\\', '/') . '/';
                break;
            case 'site_title':
                $value = qa_default_site_title();
                break;
            case 'site_theme_mobile':
                $value = qa_opt('site_theme');
                break;
            case 'from_email':
                // heuristic to remove short prefix (e.g. www. or qa.)
                $parts = explode('.', @$_SERVER['HTTP_HOST']);
                if (count($parts) > 2 && strlen($parts[0]) < 5 && !is_numeric($parts[0])) {
                    unset($parts[0]);
                }
                $value = 'no-reply@' . (count($parts) > 1 ? implode('.', $parts) : 'example.com');
                break;
            case 'email_privacy':
                $value = qa_lang_html('options/default_privacy');
                break;
            case 'show_custom_sidebar':
                $value = strlen(qa_opt('custom_sidebar')) ? true : false;
                break;
            case 'show_custom_header':
                $value = strlen(qa_opt('custom_header')) ? true : false;
                break;
            case 'show_custom_footer':
                $value = strlen(qa_opt('custom_footer')) ? true : false;
                break;
            case 'show_custom_in_head':
                $value = strlen(qa_opt('custom_in_head')) ? true : false;
                break;
            case 'custom_sidebar':
                $value = qa_lang_html_sub('options/default_sidebar', qa_html(qa_opt('site_title')));
                break;
            case 'editor_for_qs':
            case 'editor_for_as':
                require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                $value = '-';
                // to match none by default, i.e. choose based on who is best at editing HTML
                qa_load_editor('', 'html', $value);
                break;
            case 'permit_post_q':
                // convert from deprecated option if available
                $value = qa_opt('ask_needs_login') ? QA_PERMIT_USERS : QA_PERMIT_ALL;
                break;
            case 'permit_post_a':
                // convert from deprecated option if available
                $value = qa_opt('answer_needs_login') ? QA_PERMIT_USERS : QA_PERMIT_ALL;
                break;
            case 'permit_post_c':
                // convert from deprecated option if available
                $value = qa_opt('comment_needs_login') ? QA_PERMIT_USERS : QA_PERMIT_ALL;
                break;
            case 'permit_retag_cat':
                // convert from previous option that used to contain it too
                $value = qa_opt('permit_edit_q');
                break;
            case 'points_vote_up_q':
            case 'points_vote_down_q':
                $oldvalue = qa_opt('points_vote_on_q');
                $value = is_numeric($oldvalue) ? $oldvalue : 1;
                break;
            case 'points_vote_up_a':
            case 'points_vote_down_a':
                $oldvalue = qa_opt('points_vote_on_a');
                $value = is_numeric($oldvalue) ? $oldvalue : 1;
                break;
            case 'points_per_q_voted_up':
            case 'points_per_q_voted_down':
                $oldvalue = qa_opt('points_per_q_voted');
                $value = is_numeric($oldvalue) ? $oldvalue : 1;
                break;
            case 'points_per_a_voted_up':
            case 'points_per_a_voted_down':
                $oldvalue = qa_opt('points_per_a_voted');
                $value = is_numeric($oldvalue) ? $oldvalue : 2;
                break;
            case 'captcha_module':
                $captchamodules = qa_list_modules('captcha');
                if (count($captchamodules)) {
                    $value = reset($captchamodules);
                } else {
                    $value = '';
                }
                break;
            case 'mailing_from_name':
                $value = qa_opt('site_title');
                break;
//.........这里部分代码省略.........
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:101,代码来源:qa-app-options.php


注:本文中的qa_list_modules函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。