本文整理汇总了PHP中qa_path函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_path函数的具体用法?PHP qa_path怎么用?PHP qa_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_associate
function check_associate($useraccount)
{
$userid = $useraccount['userid'];
$action = null;
$key = null;
if (!empty($_REQUEST['hauth_start'])) {
$key = trim(strip_tags($_REQUEST['hauth_start']));
$action = 'process';
} else {
if (!empty($_REQUEST['hauth_done'])) {
$key = trim(strip_tags($_REQUEST['hauth_done']));
$action = 'process';
} else {
if (!empty($_GET['link'])) {
$key = trim(strip_tags($_GET['link']));
$action = 'login';
}
}
}
if ($key == null) {
return false;
}
$provider = $this->get_ha_provider($key);
$source = strtolower($provider);
if ($action == 'login') {
// handle the login
// after login come back to the same page
$loginCallback = qa_path('', array(), qa_opt('site_url'));
require_once $this->directory . 'Hybrid/Auth.php';
require_once $this->directory . 'qa-open-utils.php';
// prepare the configuration of HybridAuth
$config = $this->get_ha_config($provider, $loginCallback);
try {
// try to login
$hybridauth = new Hybrid_Auth($config);
$adapter = $hybridauth->authenticate($provider);
// if ok, create/refresh the user account
$user = $adapter->getUserProfile();
$duplicates = 0;
if (!empty($user)) {
// prepare some data
$ohandle = null;
}
$oemail = null;
if (empty($user->displayName)) {
$ohandle = $provider;
} else {
$ohandle = preg_replace('/[\\@\\+\\/]/', ' ', $user->displayName);
}
if (strlen(@$user->email) && $user->emailVerified) {
// only if email is confirmed
$oemail = $user->email;
}
$duplicate = qa_db_user_login_find_duplicate__open($source, $user->identifier);
if ($duplicate == null) {
// simply create a new login
qa_db_user_login_sync(true);
qa_db_user_login_add($userid, $source, $user->identifier);
if ($oemail) {
qa_db_user_login_set__open($source, $user->identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $user->identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
// now that everything was added, log out to allow for multiple accounts
$adapter->logout();
// redirect to get rid of parameters
qa_redirect('logins');
} else {
if ($duplicate['userid'] == $userid) {
// trying to add the same account, just update the email/handle
qa_db_user_login_sync(true);
if ($oemail) {
qa_db_user_login_set__open($source, $user->identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $user->identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
// log out to allow for multiple accounts
$adapter->logout();
// redirect to get rid of parameters
qa_redirect('logins');
} else {
if (qa_get('confirm') == 2) {
return $duplicate;
} else {
qa_redirect('logins', array('link' => qa_get('link'), 'confirm' => 2));
}
}
}
} catch (Exception $e) {
qa_redirect('logins', array('provider' => $provider, 'code' => $e->getCode()));
}
}
if ($action == 'process') {
require_once "Hybrid/Auth.php";
require_once "Hybrid/Endpoint.php";
Hybrid_Endpoint::process();
}
return false;
}
示例2: get_field
public function get_field(&$qa_content, $content, $format, $fieldname, $rows)
{
$scriptsrc = $this->urltoroot . 'ckeditor/ckeditor.js?' . QA_VERSION;
$alreadyadded = false;
if (isset($qa_content['script_src'])) {
foreach ($qa_content['script_src'] as $testscriptsrc) {
if ($testscriptsrc == $scriptsrc) {
$alreadyadded = true;
}
}
}
if (!$alreadyadded) {
$uploadimages = qa_opt('wysiwyg_editor_upload_images');
$uploadall = $uploadimages && qa_opt('wysiwyg_editor_upload_all');
$imageUploadUrl = qa_js(qa_path('wysiwyg-editor-upload', array('qa_only_image' => true)));
$fileUploadUrl = qa_js(qa_path('wysiwyg-editor-upload'));
$qa_content['script_src'][] = $scriptsrc;
$qa_content['script_lines'][] = array("var qa_wysiwyg_editor_config = {", "\ttoolbar: [", "\t\t{ name: 'basic', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript' ] },", "\t\t{ name: 'color', items: [ 'TextColor', 'BGColor' ] },", "\t\t{ name: 'align', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },", "\t\t{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteFromWord', '-', 'Undo', 'Redo' ] },", "\t\t'/',", "\t\t{ name: 'font', items: [ 'Font', 'FontSize', 'Format' ] },", "\t\t{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote' ] },", "\t\t{ name: 'links', items: [ 'Link', 'Unlink' ] },", "\t\t{ name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'SpecialChar' ] },", "\t\t{ name: 'last', items: [ 'RemoveFormat', 'Maximize' ] }", "\t],", "\tformat_tags: 'p;h1;h2;h3;pre',", "\tentities: false,", "\tremoveDialogTabs: 'image:advanced;link:advanced;table:advanced',", "\tdisableNativeSpellChecker: false,", "\tdefaultLanguage: 'en',", "\tlanguage: " . qa_js(qa_opt('site_language')) . ",", $uploadimages ? "\tfilebrowserImageUploadUrl: {$imageUploadUrl}," : "", $uploadall ? "\tfilebrowserUploadUrl: {$fileUploadUrl}," : "", "\tcustomConfig: ''", "};");
}
if ($format == 'html') {
$html = $content;
$text = $this->html_to_text($content);
} else {
$text = $content;
$html = qa_html($content, true);
}
return array('tags' => 'name="' . $fieldname . '"', 'value' => qa_html($text), 'rows' => $rows, 'html_prefix' => '<input name="' . $fieldname . '_ckeditor_ok" id="' . $fieldname . '_ckeditor_ok" type="hidden" value="0"><input name="' . $fieldname . '_ckeditor_data" id="' . $fieldname . '_ckeditor_data" type="hidden" value="' . qa_html($html) . '">');
}
示例3: get_field
function get_field(&$qa_content, $content, $format, $fieldname, $rows)
{
$scriptsrc = $this->urltoroot . 'ckeditor.js?' . QA_VERSION;
$alreadyadded = false;
if (isset($qa_content['script_src'])) {
foreach ($qa_content['script_src'] as $testscriptsrc) {
if ($testscriptsrc == $scriptsrc) {
$alreadyadded = true;
}
}
}
if (!$alreadyadded) {
$uploadimages = qa_opt('wysiwyg_editor_upload_images');
$uploadall = $uploadimages && qa_opt('wysiwyg_editor_upload_all');
$qa_content['script_src'][] = $scriptsrc;
$qa_content['script_lines'][] = array("qa_wysiwyg_editor_config={toolbar:[" . "['Bold','Italic','Underline','Strike']," . "['Font','FontSize']," . "['TextColor','BGColor']," . "['Link','Unlink']," . "'/'," . "['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']," . "['NumberedList','BulletedList','-','Outdent','Indent','Blockquote']," . "['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar']," . "['RemoveFormat', 'Maximize']" . "]" . ", defaultLanguage:" . qa_js(qa_opt('site_language')) . ", skin:'v2'" . ", toolbarCanCollapse:false" . ", removePlugins:'elementspath'" . ", resize_enabled:false" . ", autogrow:false" . ", entities:false" . ($uploadimages ? ", filebrowserImageUploadUrl:" . qa_js(qa_path('wysiwyg-editor-upload', array('qa_only_image' => true))) : "") . ($uploadall ? ", filebrowserUploadUrl:" . qa_js(qa_path('wysiwyg-editor-upload')) : "") . "};");
}
if ($format == 'html') {
$html = $content;
$text = $this->html_to_text($content);
} else {
$text = $content;
$html = qa_html($content, true);
}
return array('tags' => 'name="' . $fieldname . '"', 'value' => qa_html($text), 'rows' => $rows, 'html_prefix' => '<input name="' . $fieldname . '_ckeditor_ok" id="' . $fieldname . '_ckeditor_ok" type="hidden" value="0"><input name="' . $fieldname . '_ckeditor_data" id="' . $fieldname . '_ckeditor_data" type="hidden" value="' . qa_html($html) . '">');
}
示例4: logout_html
function logout_html($tourl)
{
require_once QA_INCLUDE_DIR . "qa-base.php";
$_SESSION['logout_url'] = $tourl;
$logout_url = qa_path('auth/logout', null, qa_path_to_root());
echo '<a href="' . $logout_url . '">' . qa_lang_html('main/nav_logout') . '</a>';
}
示例5: admin_form
function admin_form(&$qa_content)
{
// process the admin form if admin hits Save-Changes-button
$ok = null;
if (qa_clicked('q2apro_popularqu_save')) {
qa_opt('q2apro_popularqu_enabled', (bool) qa_post_text('q2apro_popularqu_enabled'));
// empty or 1
qa_opt('q2apro_popularqu_maxqu', (int) qa_post_text('q2apro_popularqu_maxqu'));
qa_opt('q2apro_popularqu_lastdays', (int) qa_post_text('q2apro_popularqu_lastdays'));
qa_opt('q2apro_popularqu_checkhours', (int) qa_post_text('q2apro_popularqu_checkhours'));
qa_opt('q2apro_popularqu_answercount', (bool) qa_post_text('q2apro_popularqu_answercount'));
$ok = qa_lang('admin/options_saved');
// in case the options have been changed, update the widget
q2apro_save_most_viewed_questions();
}
// form fields to display frontend for admin
$fields = array();
$fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/enable_plugin'), 'tags' => 'name="q2apro_popularqu_enabled"', 'value' => qa_opt('q2apro_popularqu_enabled'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_maxqu'), 'tags' => 'name="q2apro_popularqu_maxqu"', 'value' => qa_opt('q2apro_popularqu_maxqu'));
$fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/admin_answercount'), 'tags' => 'name="q2apro_popularqu_answercount"', 'value' => qa_opt('q2apro_popularqu_answercount'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_lastdays'), 'tags' => 'name="q2apro_popularqu_lastdays"', 'value' => qa_opt('q2apro_popularqu_lastdays'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_checkhours'), 'tags' => 'name="q2apro_popularqu_checkhours"', 'value' => qa_opt('q2apro_popularqu_checkhours'));
$fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_lastcache') . ' ' . date('Y-m-d H:i:s', (double) qa_opt('q2apro_popularqu_checktime')));
$fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_remember') . ' <a href="' . qa_path('admin/layout') . '">/admin/layout</a>');
$fields[] = array('type' => 'static', 'note' => '<span style="font-size:75%;color:#789;">' . strtr(qa_lang('q2apro_popularqu_lang/contact'), array('^1' => '<a target="_blank" href="http://www.q2apro.com/forum/">', '^2' => '</a>')) . '</span>');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang('main/save_button'), 'tags' => 'name="q2apro_popularqu_save"')));
}
示例6: qa_question_set_selchildid
function qa_question_set_selchildid($userid, $handle, $cookieid, $oldquestion, $selchildid, $answers)
{
$oldselchildid = $oldquestion['selchildid'];
qa_db_post_set_selchildid($oldquestion['postid'], isset($selchildid) ? $selchildid : null);
qa_db_points_update_ifuser($oldquestion['userid'], 'aselects');
if (isset($oldselchildid)) {
if (isset($answers[$oldselchildid])) {
qa_db_points_update_ifuser($answers[$oldselchildid]['userid'], 'aselecteds');
qa_report_event('a_unselect', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $oldselchildid));
}
}
if (isset($selchildid)) {
$answer = $answers[$selchildid];
qa_db_points_update_ifuser($answer['userid'], 'aselecteds');
if (isset($answer['notify']) && !qa_post_is_by_user($answer, $userid, $cookieid)) {
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$blockwordspreg = qa_get_block_words_preg();
$sendtitle = qa_block_words_replace($oldquestion['title'], $blockwordspreg);
$sendcontent = qa_viewer_text($answer['content'], $answer['format'], array('blockwordspreg' => $blockwordspreg));
qa_send_notification($answer['userid'], $answer['notify'], @$answer['handle'], qa_lang('emails/a_selected_subject'), qa_lang('emails/a_selected_body'), array('^s_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^q_title' => $sendtitle, '^a_content' => $sendcontent, '^url' => qa_path(qa_q_request($oldquestion['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor('A', $selchildid))));
}
qa_report_event('a_select', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $selchildid));
}
}
示例7: get_field
public function get_field(&$qa_content, $content, $format, $fieldname, $rows)
{
$scriptsrc = $this->urltoroot . 'ckeditor/ckeditor.js?' . QA_VERSION;
$alreadyadded = false;
if (isset($qa_content['script_src'])) {
foreach ($qa_content['script_src'] as $testscriptsrc) {
if ($testscriptsrc == $scriptsrc) {
$alreadyadded = true;
}
}
}
if (!$alreadyadded) {
$uploadimages = qa_opt('wysiwyg_editor_upload_images');
$uploadall = $uploadimages && qa_opt('wysiwyg_editor_upload_all');
$imageUploadUrl = qa_js(qa_path('wysiwyg-editor-upload', array('qa_only_image' => true)));
$fileUploadUrl = qa_js(qa_path('wysiwyg-editor-upload'));
$qa_content['script_src'][] = $scriptsrc;
$qa_content['script_lines'][] = array("var qa_wysiwyg_editor_config = {", $uploadimages ? "\tfilebrowserImageUploadUrl: {$imageUploadUrl}," : "", $uploadall ? "\tfilebrowserUploadUrl: {$fileUploadUrl}," : "", "\tdefaultLanguage: 'en',", "\tlanguage: " . qa_js(qa_opt('site_language')) . "", "};");
}
if ($format == 'html') {
$html = $content;
$text = $this->html_to_text($content);
} else {
$text = $content;
$html = qa_html($content, true);
}
return array('tags' => 'name="' . $fieldname . '"', 'value' => qa_html($text), 'rows' => $rows, 'html_prefix' => '<input name="' . $fieldname . '_ckeditor_ok" id="' . $fieldname . '_ckeditor_ok" type="hidden" value="0"><input name="' . $fieldname . '_ckeditor_data" id="' . $fieldname . '_ckeditor_data" type="hidden" value="' . qa_html($html) . '">');
}
示例8: mp_announcement_create
function mp_announcement_create($userid, $handle, $cookieid, $title, $content, $format, $text, $notify, $categoryid)
{
/*
* Proceeds to create an announcement
*
*/
require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
require_once QA_INCLUDE_DIR . 'mp-app-users.php';
// persist data to database
$postid = qa_db_post_create('AN', null, $userid, $cookieid, qa_remote_ip_address(), $title, $content, $format, null, $notify, $categoryid);
qa_user_report_action(qa_get_logged_in_userid(), null, null, null, null);
// update new post with category path hierarchy
qa_db_posts_calc_category_path($postid);
// send notifications
if ($notify && isset($postid)) {
$category = mp_get_categoryinfo($categoryid);
$recipients = mp_get_category_userids($categoryid);
foreach ($recipients as $recipient) {
// retrieve the user flags
$userflags = mp_get_user_flags($recipient['userid']);
// check user flags to determine whether user should be notified or not
// of the new answer post
if (!($userflags & QA_USER_FLAGS_NOTIFY_ANNOUNCEMENTS)) {
qa_send_notification($recipient['userid'], null, null, qa_lang('emails/an_posted_subject'), qa_lang('emails/an_posted_body'), array('^an_handle' => $handle, '^category_title' => $category['title'], '^an_title' => $title, '^an_url' => qa_path('mp-announcements-page', null, qa_opt('site_url'), null, null)));
}
}
}
// report announcement create event
qa_report_event('an_post', $userid, $handle, $cookieid, array('postid' => $postid, 'title' => $title, 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $categoryid, 'notify' => $notify));
return $postid;
}
示例9: qa_get_request_content
function qa_get_request_content()
{
if (qa_opt('news_plugin_active')) {
$requestlower = strtolower(qa_request());
if ($requestlower && $requestlower === 'my-profile') {
$userid = qa_get_logged_in_userid();
if (!$userid) {
qa_redirect();
}
$handles = qa_userids_to_handles(array($userid));
$handle = $handles[$userid];
qa_redirect(qa_path('user/' . $handle));
} else {
if ($requestlower && $requestlower === qa_opt('news_plugin_request')) {
// send on cron
if (qa_opt('news_plugin_send') && qa_get('cron') == qa_opt('news_plugin_cron_rand') && time() >= qa_opt('news_plugin_send_last') + 23 * 60 * 60) {
// minumum cron interval is 23 hours
qa_news_plugin_createNewsletter(true);
return false;
} else {
if (qa_get('cron') == qa_opt('news_plugin_cron_rand')) {
if (!qa_opt('news_plugin_send')) {
error_log('Q2A Newsletter Recreate Error: sending newsletter not allowed via admin/plugins');
} else {
error_log('Q2A Newsletter Recreate Error: cron request before minimum time elapsed');
}
echo "false\n";
return false;
}
}
include qa_opt('news_plugin_loc');
return false;
} else {
if (qa_opt('news_plugin_pdf') && $requestlower && $requestlower === qa_opt('news_plugin_request_pdf')) {
$pdf = file_get_contents(qa_opt('news_plugin_loc_pdf'));
header('Content-Description: File Transfer');
header('Cache-Control: public, must-revalidate, max-age=0');
// HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// force download dialog
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream', false);
header('Content-Type: application/download', false);
header('Content-Type: application/pdf', false);
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename="' . basename(qa_opt('news_plugin_loc_pdf')) . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($pdf));
echo $pdf;
return false;
}
}
}
}
return qa_get_request_content_base();
}
示例10: qa_get_blob_url
function qa_get_blob_url($blobid, $absolute = false)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
return qa_path('blob', array('qa_blobid' => $blobid), $absolute ? qa_opt('site_url') : null, QA_URL_FORMAT_PARAMS);
}
示例11: process_event
public function process_event($event, $userid, $handle, $cookieid, $params)
{
switch ($event) {
case 'q_post':
$this->send_hipchat_notification($this->build_new_question_message(isset($handle) ? $handle : qa_lang('main/anonymous'), $params['title'], qa_q_path($params['postid'], $params['title'], true)));
break;
case 'a_post':
$parentpost = qa_post_get_full($params['parentid']);
$this->send_hipchat_notification($this->build_new_answer_message(isset($handle) ? $handle : qa_lang('main/anonymous'), $parentpost['title'], qa_path(qa_q_request($params['parentid'], $parentpost['title']), null, qa_opt('site_url'), null, qa_anchor('A', $params['postid']))));
break;
}
}
示例12: get_field
function get_field(&$qa_content, $content, $format, $fieldname, $rows, $autofocus)
{
$uploadimages = qa_opt('wysiwyg_editor_upload_images');
$uploadall = $uploadimages && qa_opt('wysiwyg_editor_upload_all');
$qa_content['script_src'][] = $this->urltoroot . 'ckeditor.js?' . QA_VERSION;
$qa_content['script_onloads'][] = "CKEDITOR.replace(" . qa_js($fieldname) . ", {toolbar:[" . "['Bold','Italic','Underline','Strike']," . "['Font','FontSize']," . "['TextColor','BGColor']," . "['Link','Unlink']," . "'/'," . "['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']," . "['NumberedList','BulletedList','-','Outdent','Indent','Blockquote']," . "['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar']," . "['RemoveFormat', 'Maximize']" . "]" . ", defaultLanguage:" . qa_js(qa_opt('site_language')) . ", skin:'v2'" . ", toolbarCanCollapse:false" . ", removePlugins:'elementspath'" . ", resize_enabled:false" . ", autogrow:false" . ", startupFocus:" . ($autofocus ? 'true' : 'false') . ", entities:false" . ($uploadimages ? ", filebrowserImageUploadUrl:" . qa_js(qa_path('wysiwyg-editor-upload', array('qa_only_image' => true))) : "") . ($uploadall ? ", filebrowserUploadUrl:" . qa_js(qa_path('wysiwyg-editor-upload')) : "") . "})";
if ($format == 'html') {
$html = $content;
} else {
$html = qa_html($content, true);
}
return array('tags' => 'NAME="' . $fieldname . '"', 'value' => qa_html($html), 'rows' => $rows);
}
示例13: doctype
function doctype()
{
global $qa_theme_switch_is_mobile;
if ($qa_theme_switch_is_mobile && qa_opt('theme_switch_enable_mobile') && qa_opt('site_theme') != qa_opt('theme_switch_mobile')) {
$this->content['navigation']['footer']['theme_switch'] = array('label' => 'Mobile Version', 'url' => qa_path($this->request, array('theme_switch' => qa_opt('theme_switch_mobile'))));
} else {
if (qa_opt('theme_switch_enable_mobile') && qa_opt('site_theme') == qa_opt('theme_switch_mobile')) {
$this->content['navigation']['footer']['theme_switch'] = array('label' => 'Full Site', 'url' => qa_path($this->request, array('theme_switch' => qa_opt('theme_switch_default'))));
}
}
if (@$_GET['theme_switch']) {
/*
if($userid = qa_get_logged_in_userid()) {
qa_db_query_sub(
'INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES (#,$,$) ON DUPLICATE KEY UPDATE meta_value=$',
$userid,'custom_theme',$_GET['theme_switch'],$_GET['theme_switch']
);
}
*/
setcookie('qa_theme_switch', $_GET['theme_switch'], time() + 86400 * 365, '/', QA_COOKIE_DOMAIN);
qa_redirect($this->request, array());
}
if (qa_opt('theme_switch_enable')) {
if ($this->template == 'user' && !qa_get('tab')) {
// add theme switcher
$handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $this->request);
$theme_form = $this->theme_switch_form();
if ($theme_form) {
// insert our form
if ($this->content['q_list']) {
// paranoia
// array splicing kungfu thanks to Stack Exchange
// This adds form-theme-switch before q_list
$keys = array_keys($this->content);
$vals = array_values($this->content);
$insertBefore = array_search('q_list', $keys);
$keys2 = array_splice($keys, $insertBefore);
$vals2 = array_splice($vals, $insertBefore);
$keys[] = 'form-theme-switch';
$vals[] = $theme_form;
$this->content = array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2));
} else {
$this->content['form-theme-switch'] = $theme_form;
}
// this shouldn't happen
}
}
}
qa_html_theme_base::doctype();
}
示例14: process_request
function process_request($request)
{
@ini_set('display_errors', 0);
// we don't want to show PHP errors inside XML
$titlehtml = qa_html(qa_opt('site_title'));
$template = str_replace('_searchTerms_placeholder_', '{searchTerms}', qa_path('search', array('q' => '_searchTerms_placeholder_'), qa_opt('site_url')));
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">' . "\n";
echo "\t<ShortName>" . $titlehtml . "</ShortName>\n";
echo "\t<Description>" . qa_lang_html('main/search_button') . ' ' . $titlehtml . "</Description>\n";
echo "\t" . '<Url type="text/html" method="get" template="' . qa_html($template) . '"/>' . "\n";
echo "\t<InputEncoding>UTF-8</InputEncoding>\n";
echo '</OpenSearchDescription>' . "\n";
return null;
}
示例15: 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>');
}