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


PHP qa_load_modules_with函数代码示例

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


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

示例1: main_parts

 function main_parts($content)
 {
     if ($this->template == 'admin' && $this->request == 'admin/plugins') {
         $fields['plugins'] = array('type' => 'custom', 'label' => '<a name="plugin_contents">Plugin Settings:</a>', 'html' => '');
         $moduletypes = qa_list_module_types();
         foreach ($moduletypes as $moduletype) {
             $plugins[] = qa_load_modules_with($moduletype, 'option_default');
         }
         $anchors = array();
         foreach ($content as $key => $part) {
             if (strpos($key, 'form_') === 0) {
                 $content[$key]['title'] .= ' <font size="1" style="cursor:pointer; color:blue" onclick="jQuery(document).scrollTop(0)">top</font>';
                 foreach ($content[$key]['fields'] as $idx => $field) {
                     if (isset($field['tags']) && preg_match('|name="([^"]+)"|i', $field['tags'], $name)) {
                         $name = $name[1];
                         foreach ($plugins as $modules) {
                             foreach ($modules as $module) {
                                 $value = $module->option_default($name);
                                 $value = preg_replace('|\\n|', '\\\\n', $value);
                                 $value = str_replace('"', '&quot;', $value);
                                 $value = str_replace('\'', '\\\'', $value);
                                 if (strlen($value)) {
                                     $content[$key]['fields'][$idx]['label'] = @$content[$key]['fields'][$idx]['label'] . '&nbsp;<input type="button" onclick="$(\'[name=' . $name . ']\').val(\'' . $value . '\')" value="r" style="font-size:8pt; width:10px" title="reset to default value">';
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     qa_html_theme_base::main_parts($content);
 }
开发者ID:NoahY,项目名称:q2a-admin-plus,代码行数:33,代码来源:qa-admin-layer.php

示例2: qa_post_index

function qa_post_index($postid, $type, $questionid, $parentid, $title, $content, $format, $text, $tagstring, $categoryid)
{
    global $qa_post_indexing_suspended;
    if ($qa_post_indexing_suspended > 0) {
        return;
    }
    //	Send through to any search modules for indexing
    $searches = qa_load_modules_with('search', 'index_post');
    foreach ($searches as $search) {
        $search->index_post($postid, $type, $questionid, $parentid, $title, $content, $format, $text, $tagstring, $categoryid);
    }
}
开发者ID:ramo01,项目名称:1kapp,代码行数:12,代码来源:qa-app-post-create.php

示例3: qa_set_logged_in_user

/**
 * Extends the logout functionality by performing some extra clean up for
 * the external login modules.
 *
 * Currently only the login modules using OAuth (like Facebook and Github)
 * need additional logout processing (defined in their do_logout methods). 
 * The OpenID-based login modules will simply use the default functionality.
 *
 * Only logout functionality is affected by this function. Login mechanism
 * is handled by #qa_log_in_external_user function.
 */
function qa_set_logged_in_user($userid, $handle = '', $remember = false, $source = null)
{
    // if a logout was requested, do extra stuff
    if (!isset($userid)) {
        // get all modules which have a custom logout logic
        $loginmodules = qa_load_modules_with('login', 'do_logout');
        // do the work
        foreach ($loginmodules as $module) {
            $module->do_logout();
        }
    }
    // then just perform the default tasks
    qa_set_logged_in_user_base($userid, $handle, $remember, $source);
}
开发者ID:microbye,项目名称:q2a-open-login,代码行数:25,代码来源:qa-open-overrides.php

示例4: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     $loginmodules = qa_load_modules_with('login', 'login_html');
     if (empty($loginmodules)) {
         return;
     }
     $themeobject->output('<div class="open-login-sidebar">', qa_lang_html('plugin_open/login_title'), '</div>', '<p class="open-login-sidebar-buttons">');
     foreach ($loginmodules as $tryname => $module) {
         ob_start();
         $module->login_html(isset($topath) ? qa_opt('site_url') . $topath : qa_path($request, $_GET, qa_opt('site_url')), 'sidebar');
         $label = ob_get_clean();
         if (strlen($label)) {
             $themeobject->output($label);
         }
     }
     $themeobject->output('</p>');
 }
开发者ID:microbye,项目名称:q2a-open-login,代码行数:17,代码来源:qa-open-widget.php

示例5: qa_report_process_stage

function qa_report_process_stage($method)
{
    global $qa_process_reports_suspended;
    if (@$qa_process_reports_suspended) {
        return;
    }
    $qa_process_reports_suspended = true;
    // prevent loop, e.g. because of an error
    $args = func_get_args();
    $args = array_slice($args, 1);
    $processmodules = qa_load_modules_with('process', $method);
    foreach ($processmodules as $processmodule) {
        call_user_func_array(array($processmodule, $method), $args);
    }
    $qa_process_reports_suspended = null;
}
开发者ID:netham91,项目名称:question2answer,代码行数:16,代码来源:qa-base.php

示例6: foreach

    foreach ($modules as $name) {
        $module = qa_load_module($type, $name);
        if (method_exists($module, 'admin_form')) {
            $info = qa_get_module_info($type, $name);
            $pluginoptionmodules[$info['directory']][] = array('type' => $type, 'name' => $name);
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/plugins_title');
$qa_content['error'] = qa_admin_page_error();
$qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
$pluginfiles = glob(QA_PLUGIN_DIR . '*/qa-plugin.php');
foreach ($moduletypes as $type) {
    $modules = qa_load_modules_with($type, 'init_queries');
    foreach ($modules as $name => $module) {
        $queries = $module->init_queries($tables);
        if (!empty($queries)) {
            if (qa_is_http_post()) {
                qa_redirect('install');
            } else {
                $qa_content['error'] = strtr(qa_lang_html('admin/module_x_database_init'), array('^1' => qa_html($name), '^2' => qa_html($type), '^3' => '<a href="' . qa_path_html('install') . '">', '^4' => '</a>'));
            }
        }
    }
}
if (qa_is_http_post() && !qa_check_form_security_code('admin/plugins', qa_post_text('qa_form_security_code'))) {
    $qa_content['error'] = qa_lang_html('misc/form_security_reload');
    $showpluginforms = false;
} else {
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-admin-plugins.php

示例7: display_services

 function display_services(&$qa_content, $has_content)
 {
     if (!$has_content) {
         // no linked logins
         $qa_content['form_nodata'] = array('title' => '<br>' . qa_lang_html('plugin_open/no_logins_title'), 'style' => 'light', 'fields' => array('note' => array('note' => qa_lang_html('plugin_open/no_logins_text'), 'type' => 'static')));
     } else {
         $qa_content['custom'] = '<h2>' . qa_lang_html('plugin_open/link_with_account') . '</h2><p>' . qa_lang_html('plugin_open/no_logins_text') . '</p>';
     }
     // output login providers
     $loginmodules = qa_load_modules_with('login', 'printCode');
     foreach ($loginmodules as $module) {
         ob_start();
         qa_open_login::printCode($module->provider, null, 'associate', 'link');
         $html = ob_get_clean();
         if (strlen($html)) {
             @($qa_content['custom'] .= $html . ' ');
         }
     }
 }
开发者ID:microbye,项目名称:q2a-open-login,代码行数:19,代码来源:qa-open-page-logins.php

示例8: cs_get_widgets

    function cs_get_widgets()
    {
        ob_start();
        foreach (qa_load_modules_with('widget', 'allow_template') as $k => $widget) {
            ?>
				<div class="draggable-widget" data-name="<?php 
            echo $k;
            ?>
">					
					<div class="widget-title"><?php 
            echo $k;
            ?>
 
						<div class="drag-handle icon-move"></div>
						<div class="widget-delete icon-trash"></div>
						<div class="widget-template-to icon-list"></div>
						<div class="widget-options icon-wrench"></div>
					</div>
					<div class="select-template">
						<label>
						<input type="checkbox" name="show_title" checked> Show widget title</label><br />
						<span>Select where you want to show</span>
						<?php 
            $this->get_widget_template_checkbox();
            ?>
					</div>
					<div class="widget-option">
						<?php 
            $this->get_widget_form($k);
            ?>
					</div>
				</div>
				<?php 
        }
        return ob_get_clean();
    }
开发者ID:microbye,项目名称:CleanStrap,代码行数:36,代码来源:widgets.php

示例9: qa_default_option


//.........这里部分代码省略.........
                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;
            case 'mailing_from_email':
                $value = qa_opt('from_email');
                break;
            case 'mailing_subject':
                $value = qa_lang_sub('options/default_subject', qa_opt('site_title'));
                break;
            case 'mailing_body':
                $value = "\n\n\n--\n" . qa_opt('site_title') . "\n" . qa_opt('site_url');
                break;
            default:
                // call option_default method in any registered modules
                $moduletypes = qa_list_module_types();
                foreach ($moduletypes as $moduletype) {
                    $modules = qa_load_modules_with($moduletype, 'option_default');
                    foreach ($modules as $module) {
                        $value = $module->option_default($name);
                        if (strlen($value)) {
                            return $value;
                        }
                    }
                }
                $value = '';
                break;
        }
    }
    return $value;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:101,代码来源:qa-app-options.php

示例10: qa_recalc_perform_step

function qa_recalc_perform_step(&$state)
{
    $continue = false;
    @(list($operation, $length, $next, $done) = explode(',', $state));
    switch ($operation) {
        case 'doreindexcontent':
            qa_recalc_transition($state, 'doreindexcontent_pagereindex');
            break;
        case 'doreindexcontent_pagereindex':
            $pages = qa_db_pages_get_for_reindexing($next, 10);
            if (count($pages)) {
                require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                $lastpageid = max(array_keys($pages));
                foreach ($pages as $pageid => $page) {
                    if (!($page['flags'] & QA_PAGE_FLAGS_EXTERNAL)) {
                        $searchmodules = qa_load_modules_with('search', 'unindex_page');
                        foreach ($searchmodules as $searchmodule) {
                            $searchmodule->unindex_page($pageid);
                        }
                        $searchmodules = qa_load_modules_with('search', 'index_page');
                        if (count($searchmodules)) {
                            $indextext = qa_viewer_text($page['content'], 'html');
                            foreach ($searchmodules as $searchmodule) {
                                $searchmodule->index_page($pageid, $page['tags'], $page['heading'], $page['content'], 'html', $indextext);
                            }
                        }
                    }
                }
                $next = 1 + $lastpageid;
                $done += count($pages);
                $continue = true;
            } else {
                qa_recalc_transition($state, 'doreindexcontent_postcount');
            }
            break;
        case 'doreindexcontent_postcount':
            qa_db_qcount_update();
            qa_db_acount_update();
            qa_db_ccount_update();
            qa_recalc_transition($state, 'doreindexcontent_postreindex');
            break;
        case 'doreindexcontent_postreindex':
            $posts = qa_db_posts_get_for_reindexing($next, 10);
            if (count($posts)) {
                require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                $lastpostid = max(array_keys($posts));
                qa_db_prepare_for_reindexing($next, $lastpostid);
                qa_suspend_update_counts();
                foreach ($posts as $postid => $post) {
                    qa_post_unindex($postid);
                    qa_post_index($postid, $post['type'], $post['questionid'], $post['parentid'], $post['title'], $post['content'], $post['format'], qa_viewer_text($post['content'], $post['format']), $post['tags'], $post['categoryid']);
                }
                $next = 1 + $lastpostid;
                $done += count($posts);
                $continue = true;
            } else {
                qa_db_truncate_indexes($next);
                qa_recalc_transition($state, 'doreindexposts_wordcount');
            }
            break;
        case 'doreindexposts_wordcount':
            $wordids = qa_db_words_prepare_for_recounting($next, 1000);
            if (count($wordids)) {
                $lastwordid = max($wordids);
                qa_db_words_recount($next, $lastwordid);
                $next = 1 + $lastwordid;
                $done += count($wordids);
                $continue = true;
            } else {
                qa_db_tagcount_update();
                // this is quick so just do it here
                qa_recalc_transition($state, 'doreindexposts_complete');
            }
            break;
        case 'dorecountposts':
            qa_recalc_transition($state, 'dorecountposts_postcount');
            break;
        case 'dorecountposts_postcount':
            qa_db_qcount_update();
            qa_db_acount_update();
            qa_db_ccount_update();
            qa_db_unaqcount_update();
            qa_db_unselqcount_update();
            qa_recalc_transition($state, 'dorecountposts_votecount');
            break;
        case 'dorecountposts_votecount':
            $postids = qa_db_posts_get_for_recounting($next, 1000);
            if (count($postids)) {
                $lastpostid = max($postids);
                qa_db_posts_votes_recount($next, $lastpostid);
                $next = 1 + $lastpostid;
                $done += count($postids);
                $continue = true;
            } else {
                qa_recalc_transition($state, 'dorecountposts_acount');
            }
            break;
        case 'dorecountposts_acount':
            $postids = qa_db_posts_get_for_recounting($next, 1000);
            if (count($postids)) {
//.........这里部分代码省略.........
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:101,代码来源:qa-app-recalc.php

示例11: array

        $qa_content['custom'] = $custompage['content'];
        if ($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']))));
        }
    } else {
        $qa_content['error'] = qa_lang_html('users/no_permission');
    }
    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)) {
    $pagemodules = qa_load_modules_with('page', 'match_request');
    $request = qa_request();
    foreach ($pagemodules as $pagemodule) {
        if ($pagemodule->match_request($request)) {
            qa_set_template('plugin');
            return $pagemodule->process_request($request);
        }
    }
}
//	Then, check whether we are showing a custom home page
if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) {
    qa_set_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:ronkeizer,项目名称:question2answer,代码行数:31,代码来源:default.php

示例12: ra_installed_plugin

function ra_installed_plugin()
{
    $tables = qa_db_list_tables_lc();
    $moduletypes = qa_list_module_types();
    $pluginfiles = glob(QA_PLUGIN_DIR . '*/qa-plugin.php');
    foreach ($moduletypes as $type) {
        $modules = qa_load_modules_with($type, 'init_queries');
        foreach ($modules as $name => $module) {
            $queries = $module->init_queries($tables);
            if (!empty($queries)) {
                if (qa_is_http_post()) {
                    qa_redirect('install');
                } else {
                    $qa_content['error'] = strtr(qa_lang_html('admin/module_x_database_init'), array('^1' => qa_html($name), '^2' => qa_html($type), '^3' => '<a href="' . qa_path_html('install') . '">', '^4' => '</a>'));
                }
            }
        }
    }
    if (qa_is_http_post() && !qa_check_form_security_code('admin/plugins', qa_post_text('qa_form_security_code'))) {
        $qa_content['error'] = qa_lang_html('misc/form_security_reload');
        $showpluginforms = false;
    } else {
        $showpluginforms = true;
    }
    $plugin = array();
    if (count($pluginfiles)) {
        foreach ($pluginfiles as $pluginindex => $pluginfile) {
            $plugindirectory = dirname($pluginfile) . '/';
            $hash = qa_admin_plugin_directory_hash($plugindirectory);
            $showthisform = $showpluginforms && qa_get('show') == $hash;
            $contents = file_get_contents($pluginfile);
            $metadata = qa_admin_addon_metadata($contents, array('name' => 'Plugin Name', 'uri' => 'Plugin URI', 'description' => 'Plugin Description', 'version' => 'Plugin Version', 'date' => 'Plugin Date', 'author' => 'Plugin Author', 'author_uri' => 'Plugin Author URI', 'license' => 'Plugin License', 'min_q2a' => 'Plugin Minimum Question2Answer Version', 'min_php' => 'Plugin Minimum PHP Version', 'update' => 'Plugin Update Check URI'));
            if (strlen(@$metadata['name'])) {
                $namehtml = qa_html($metadata['name']);
            } else {
                $namehtml = qa_lang_html('admin/unnamed_plugin');
            }
            $plugin_name = $namehtml;
            if (strlen(@$metadata['uri'])) {
                $plugin_uri = qa_html($metadata['uri']);
            }
            if (strlen(@$metadata['version'])) {
                $plugin_version = qa_html($metadata['version']);
            }
            if (strlen(@$metadata['author'])) {
                $plugin_author = qa_html($metadata['author']);
                if (strlen(@$metadata['author_uri'])) {
                    $plugin_author_url = qa_html($metadata['author_uri']);
                }
            }
            if (strlen(@$metadata['version']) && strlen(@$metadata['update'])) {
                $elementid = 'version_check_' . md5($plugindirectory);
                $plugin_update = '(<span id="' . $elementid . '"></span>)';
                $qa_content['script_onloads'][] = array("qa_version_check(" . qa_js($metadata['update']) . ", 'Plugin Version', " . qa_js($metadata['version'], true) . ", 'Plugin URI', " . qa_js($elementid) . ");");
            }
            if (strlen(@$metadata['description'])) {
                $plugin_description = qa_html($metadata['description']);
            }
            //if (isset($pluginoptionmodules[$plugindirectory]))
            $plugin_option = qa_admin_plugin_options_path($plugindirectory);
            if (qa_qa_version_below(@$metadata['min_q2a'])) {
                $plugin_error = qa_lang_html_sub('admin/requires_q2a_version', qa_html($metadata['min_q2a']));
            } elseif (qa_php_version_below(@$metadata['min_php'])) {
                $plugin_error = qa_lang_html_sub('admin/requires_php_version', qa_html($metadata['min_php']));
            }
            $plugin[] = array('tags' => 'id="' . qa_html($hash) . '"', 'name' => @$plugin_name, 'uri' => @$plugin_uri, 'version' => @$plugin_version, 'author' => @$plugin_author, 'author_url' => @$plugin_author_url, 'update' => @$plugin_update, 'description' => @$plugin_description, 'path' => @$plugindirectory, 'option' => @$plugin_option, 'error' => @$plugin_error, 'fields' => array(array('type' => 'custom')));
        }
    }
    return $plugin;
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:70,代码来源:qa-plugin.php

示例13: unset

    }
    if ($isexternal || !isset($editpage['pageid'])) {
        unset($qa_content['form']['buttons']['saveview']);
    }
    $qa_content['focusid'] = 'name';
} else {
    //	List of standard navigation links
    $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(), 'buttons' => array('save' => array('tags' => 'name="dosaveoptions"', 'label' => qa_lang_html('main/save_button')), 'addpage' => array('tags' => 'name="doaddpage"', 'label' => qa_lang_html('admin/add_page_button')), 'addlink' => array('tags' => 'name="doaddlink"', 'label' => qa_lang_html('admin/add_link_button'))), 'hidden' => array('code' => qa_get_form_security_code('admin/pages')));
    $qa_content['form']['fields']['navlinks'] = array('label' => qa_lang_html('admin/nav_links_explanation'), 'type' => 'static', 'tight' => true);
    foreach ($navoptions as $optionname => $langkey) {
        $qa_content['form']['fields'][$optionname] = array('label' => '<a href="' . qa_path_html($navpaths[$optionname]) . '">' . qa_lang_html($langkey) . '</a>', 'tags' => 'name="option_' . $optionname . '"', 'type' => 'checkbox', 'value' => qa_opt($optionname));
    }
    $qa_content['form']['fields'][] = array('type' => 'blank');
    //	List of suggested plugin pages
    $listhtml = '';
    $pagemodules = qa_load_modules_with('page', 'suggest_requests');
    foreach ($pagemodules as $tryname => $trypage) {
        $suggestrequests = $trypage->suggest_requests();
        foreach ($suggestrequests as $suggestrequest) {
            $listhtml .= '<li><b><a href="' . qa_path_html($suggestrequest['request']) . '">' . qa_html($suggestrequest['title']) . '</a></b>';
            $listhtml .= qa_lang_html_sub('admin/plugin_module', qa_html($tryname));
            $listhtml .= strtr(qa_lang_html('admin/add_link_link'), array('^1' => '<a href="' . qa_path_html(qa_request(), array('doaddlink' => 1, 'text' => $suggestrequest['title'], 'url' => $suggestrequest['request'], 'nav' => @$suggestrequest['nav'])) . '">', '^2' => '</a>'));
            if (method_exists($trypage, 'admin_form')) {
                $listhtml .= ' - <a href="' . qa_admin_module_options_path('page', $tryname) . '">' . qa_lang_html('admin/options') . '</a>';
            }
            $listhtml .= '</li>';
        }
    }
    if (strlen($listhtml)) {
        $qa_content['form']['fields']['plugins'] = array('label' => qa_lang_html('admin/plugin_pages_explanation'), 'type' => 'custom', 'html' => '<ul style="margin-bottom:0;">' . $listhtml . '</ul>');
    }
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-page-admin-pages.php

示例14: qa_content_prepare


//.........这里部分代码省略.........
    foreach ($navpages 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 ($widgets 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(substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $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_path_to_root() . $logourl) . '"' . ($logowidth ? ' width="' . $logowidth . '"' : '') . ($logoheight ? ' height="' . $logoheight . '"' : '') . ' border="0" alt="' . qa_html(qa_opt('site_title')) . '"/></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_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, ''));
    $qa_content['navigation']['user'] = array();
    if (qa_is_logged_in()) {
        $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_path_to_root(), false) : qa_get_one_user_html(qa_get_logged_in_handle(), false));
        $qa_content['navigation']['user']['updates'] = array('url' => qa_path_html('updates'), 'label' => qa_lang_html('main/nav_updates'));
        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)) {
                $loginmodules = qa_load_modules_with('login', 'match_source');
                foreach ($loginmodules as $module) {
                    if ($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());
                    }
                }
            }
        }
        $notices = qa_db_get_pending_result('notices');
        foreach ($notices as $notice) {
            $qa_content['notices'][] = qa_notice_form($notice['noticeid'], qa_viewer_html($notice['content'], $notice['format']), $notice);
        }
    } else {
        require_once QA_INCLUDE_DIR . 'util/string.php';
        if (!QA_FINAL_EXTERNAL_USERS) {
            $loginmodules = qa_load_modules_with('login', 'login_html');
            foreach ($loginmodules as $tryname => $module) {
                ob_start();
                $module->login_html(isset($topath) ? qa_opt('site_url') . $topath : qa_path($request, $_GET, qa_opt('site_url')), 'menu');
                $label = ob_get_clean();
                if (strlen($label)) {
                    $qa_content['navigation']['user'][implode('-', qa_string_to_words($tryname))] = array('label' => $label);
                }
            }
        }
        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'));
        }
    }
    if (QA_FINAL_EXTERNAL_USERS || !qa_is_logged_in()) {
        if (qa_opt('show_notice_visitor') && !isset($topath) && !isset($_COOKIE['qa_noticed'])) {
            $qa_content['notices'][] = qa_notice_form('visitor', qa_opt('notice_visitor'));
        }
    } else {
        setcookie('qa_noticed', 1, time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN);
        // don't show first-time notice if a user has logged in
        if (qa_opt('show_notice_welcome') && qa_get_logged_in_flags() & QA_USER_FLAGS_WELCOME_NOTICE) {
            if ($requestlower != 'confirm' && $requestlower != 'account') {
                // let people finish registering in peace
                $qa_content['notices'][] = qa_notice_form('welcome', qa_opt('notice_welcome'));
            }
        }
    }
    $qa_content['script_rel'] = array('qa-content/jquery-1.11.2.min.js');
    $qa_content['script_rel'][] = 'qa-content/qa-page.js?' . QA_VERSION;
    if ($voting) {
        $qa_content['error'] = @$qa_page_error_html;
    }
    $qa_content['script_var'] = array('qa_root' => qa_path_to_root(), 'qa_request' => $request);
    return $qa_content;
}
开发者ID:Trideon,项目名称:gigolo,代码行数:101,代码来源:qa-page.php

示例15: qa_page_q_edit_c_submit

function qa_page_q_edit_c_submit($comment, $question, $parent, &$in, &$errors)
{
    $commentid = $comment['postid'];
    $prefix = 'c' . $commentid . '_';
    $in = array();
    if ($comment['isbyuser']) {
        $in['notify'] = qa_post_text($prefix . 'notify') ? true : false;
        $in['email'] = qa_post_text($prefix . 'email');
    }
    qa_get_post_content($prefix . 'editor', $prefix . 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
    $errors = array();
    $filtermodules = qa_load_modules_with('filter', 'filter_comment');
    foreach ($filtermodules as $filtermodule) {
        $oldin = $in;
        $filtermodule->filter_comment($in, $errors, $question, $parent, $comment);
        qa_update_post_text($in, $oldin);
    }
    if (empty($errors)) {
        $userid = qa_get_logged_in_userid();
        $handle = qa_get_logged_in_handle();
        $cookieid = qa_cookie_get();
        qa_comment_set_content($comment, $in['content'], $in['format'], $in['text'], $comment['isbyuser'] ? qa_combine_notify_email($comment['userid'], $in['notify'], $in['email']) : $comment['notify'], $userid, $handle, $cookieid, $question, $parent);
        return true;
    }
    return false;
}
开发者ID:robomartin,项目名称:Import-Tags,代码行数:26,代码来源:qa-page-question-post.php


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