function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; global $qa_login_userid, $questionid, $relatedcount, $question, $relatedquestions, $qa_cookieid, $usershtml; list($question, $relatedquestions) = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $questionid), qa_db_related_qs_selectspec($qa_login_userid, $questionid)); if ($relatedcount > 1 && !$question['hidden']) { $minscore = qa_match_to_min_score(qa_opt('match_related_qs')); foreach ($relatedquestions as $key => $related) { if ($related['postid'] == $questionid || $related['score'] < $minscore) { unset($relatedquestions[$key]); } } if (count($relatedquestions)) { $themeobject->output('<h2>' . qa_lang('main/related_qs_title') . '</h2>'); } else { $themeobject->output('<h2>' . qa_lang('main/no_related_qs_title') . '</h2>'); } $upper = qa_opt('related_qs_num') < count($relatedquestions) ? qa_opt('related_qs_num') : count($relatedquestions); foreach ($relatedquestions as $related) { if ($upper <= 0) { break; } $themeobject->output('<p style="margin:0 0 10px 0; font-weight:bold;"><a href="' . qa_path_html(qa_q_request($related['postid'], $related['title'])) . '">' . $related['title'] . '</a></p>'); $upper--; } } }
public function q_list($q_list) { if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) { // first check it is not an empty list and the feature is turned on // Collect the question ids of all items in the question list (so we can do this in one DB query) $postids = array(); foreach ($q_list['qs'] as $question) { if (isset($question['raw']['postid'])) { $postids[] = $question['raw']['postid']; } } if (!empty($postids)) { // Retrieve the content for these questions from the database $maxlength = qa_opt('mouseover_content_max_len'); $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids); $postinfo = qa_db_read_all_assoc($result, 'postid'); // Get the regular expression fragment to use for blocked words and the maximum length of content to show $blockwordspreg = qa_get_block_words_preg(); // Now add the popup to the title for each question foreach ($q_list['qs'] as $index => $question) { if (isset($postinfo[$question['raw']['postid']])) { $thispost = $postinfo[$question['raw']['postid']]; $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg)); $text = preg_replace('/\\s+/', ' ', $text); // Remove duplicated blanks, new line characters, tabs, etc $text = qa_shorten_string_line($text, $maxlength); $title = isset($question['title']) ? $question['title'] : ''; $q_list['qs'][$index]['title'] = $this->getHtmlTitle(qa_html($text), $title); } } } } parent::q_list($q_list); // call back through to the default function }
function doctype() { $this->content['navigation']['footer']['feedback']['label'] = '<div class="feedback-image"></div>'; $this->content['search']['button_label'] = ''; $this->content['logo'] = '<A HREF="../" CLASS="qa-logo-link">' . qa_opt('site_title') . '</A>'; qa_html_theme_base::doctype(); }
function head_custom() { parent::head_custom(); $tmpl = array('ask', 'question'); if (!in_array($this->template, $tmpl)) { return; } $hidecss = qa_opt($this->cssopt) === '1'; $usehljs = qa_opt($this->hljsopt) === '1'; $wmd_buttons = QA_HTML_THEME_LAYER_URLTOROOT . 'pagedown/wmd-buttons.png'; $this->output_raw("<style>\n" . ".wmd-button > span { background-image: url('{$wmd_buttons}') }\n"); // display CSS for Markdown Editor if (!$hidecss) { $cssWMD = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/wmd.css'); $this->output_raw($cssWMD); // display CSS for HighlightJS if ($usehljs) { $cssHJS = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/highlightjs.css'); $this->output_raw($cssHJS); } } $this->output_raw("</style>\n\n"); // set up HighlightJS if ($usehljs) { $this->output_raw("<script src=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/highlight.min.js\"></script>\n" . "<script type=\"text/javascript\">\n" . "\$(function(){\n" . "\t\$('.wmd-input').keypress(function(){\n" . "\t\twindow.clearTimeout(hljs.Timeout);\n" . "\t\thljs.Timeout = window.setTimeout(function() {\n" . "\t\t\thljs.initHighlighting.called = false;\n" . "\t\t\thljs.initHighlighting();\n" . "\t\t}, 500);\n" . "\t});\n" . "\twindow.setTimeout(function() {\n" . "\t\thljs.initHighlighting.called = false;\n" . "\t\thljs.initHighlighting();\n" . "\t}, 500);\n" . "});\n" . "</script>\n\n"); } //by hoangweb //$cssHJS = file_get_contents( QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/hoangweb/dropzone.css' ); //print css /*$this->output_raw("<style>\n"); $this->output_raw($cssHJS); $this->output_raw("</style>\n\n");*/ $this->output_raw("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/dropzone.css\"/>"); $this->output_raw("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/style.css\"/>"); $this->output_raw("<script src=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/dropzone.js\"></script>"); }
function admin_form(&$qa_content) { // Process form input $ok = null; if (qa_clicked('adchat_save_button')) { qa_opt('adchat_plugin_css', qa_post_text('adchat_plugin_css')); if (qa_post_text('adchat-expand-categories') == 1) { qa_opt('adchat-expand-categories', "1"); } else { qa_opt('adchat-expand-categories', "0"); } $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('adchat_reset_button')) { foreach ($_POST as $i => $v) { $def = $this->option_default($i); if ($def !== null) { qa_opt($i, $def); } } $ok = qa_lang('admin/options_reset'); } } // Create the form for display $fields = array(); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'Adchat custom css', 'tags' => 'NAME="adchat_plugin_css"', 'value' => qa_opt('adchat_plugin_css'), 'type' => 'textarea', 'rows' => 20); $fields[] = array('label' => 'Make all categories into chat room', 'note' => 'Otherwise only top level categories are made to chat room', 'tags' => 'NAME="adchat-expand-categories"', 'value' => qa_opt('adchat-expand-categories'), 'type' => 'checkbox'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="adchat_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="adchat_reset_button"'))); }
function qa_permit_check($opt) { if (qa_opt($opt) == QA_PERMIT_POINTS) { return qa_get_logged_in_points() >= qa_opt($opt . '_points'); } return !qa_permit_value_error(qa_opt($opt), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags()); }
function qa_share_buttons($q_view) { if (qa_opt('expert_question_enable')) { $qid = $q_view['raw']['postid']; $expert = qa_db_read_one_value(qa_db_query_sub("SELECT meta_value FROM ^postmeta WHERE meta_key='is_expert_question' AND post_id=#", $qid), true); if ($expert) { return; } } $url = qa_path_html(qa_q_request($q_view['raw']['postid'], $q_view['raw']['title']), null, qa_opt('site_url')); $code = array('facebook' => '<iframe src="//www.facebook.com/plugins/like.php?href=' . qa_path_html(qa_q_request($this->content['q_view']['raw']['postid'], $this->content['q_view']['raw']['title']), null, qa_opt('site_url')) . '&send=false&layout=standard&width=53&layout=button_count&show_faces=false&action=like&colorscheme=light&font&height=20&appId=170382616390886" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:53px; height:20px;" allowTransparency="true"></iframe>', 'twitter' => '<a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a>', 'google' => '<g:plusone size="medium" count="false"></g:plusone>', 'linkedin' => '<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share"></script>', 'email' => '<a title="Share this question via email" id="share-button-email" href="mailto:?subject=' . rawurlencode('[' . qa_opt('site_title') . '] ' . $q_view['raw']['title']) . '&body=' . rawurlencode($url) . '"><img height="24" src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'qa-share-mail.png' . '"/></a>'); // sort by weight $weight = array('facebook' => qa_opt('share_plugin_facebook_weight'), 'twitter' => qa_opt('share_plugin_twitter_weight'), 'google' => qa_opt('share_plugin_google_weight'), 'linkedin' => qa_opt('share_plugin_linkedin_weight'), 'email' => qa_opt('share_plugin_email_weight')); asort($weight); // output foreach ($weight as $key => $val) { if (qa_opt('share_plugin_' . $key)) { $shares[] = $code[$key]; } } if (empty($shares)) { return null; } $output = implode(' ', $shares); return $output; }
function qa_priv_notification($uid, $oid, $badge_slug) { require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-emails.php'; if (QA_FINAL_EXTERNAL_USERS) { $publictohandle = qa_get_public_from_userids(array($uid)); $handle = @$publictohandle[$uid]; } else { $user = qa_db_single_select(qa_db_user_account_selectspec($uid, true)); $handle = @$user['handle']; } $subject = qa_opt('badge_email_subject'); $body = qa_opt('badge_email_body'); $body = preg_replace('/\\^if_post_text="([^"]*)"/', $oid ? '$1' : '', $body); // if post text $site_url = qa_opt('site_url'); $profile_url = qa_path_html('user/' . $handle, null, $site_url); if ($oid) { $post = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $oid), true); if ($post['parentid']) { $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $post['parentid']), true); } if (isset($parent)) { $anchor = urlencode(qa_anchor($post['basetype'], $oid)); $post_title = $parent['title']; $post_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor); } else { $post_title = $post['title']; $post_url = qa_path_html(qa_q_request($post['postid'], $post['title']), null, qa_opt('site_url')); } } $subs = array('^badge_name' => qa_opt('badge_' . $badge_slug . '_name'), '^post_title' => @$post_title, '^post_url' => @$post_url, '^profile_url' => $profile_url, '^site_url' => $site_url); qa_send_notification($uid, '@', $handle, $subject, $body, $subs); }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { if (!qa_opt('event_logger_to_database')) { return; } $badges = qa_db_read_all_assoc(qa_db_query_sub('SELECT event,handle,params, UNIX_TIMESTAMP(datetime) AS datetime FROM ^eventlog WHERE event=$' . (qa_opt('badge_widget_date_max') ? ' AND DATE_SUB(CURDATE(),INTERVAL ' . (int) qa_opt('badge_widget_date_max') . ' DAY) <= datetime' : '') . ' ORDER BY datetime DESC' . (qa_opt('badge_widget_list_max') ? ' LIMIT ' . (int) qa_opt('badge_widget_list_max') : ''), 'badge_awarded')); if (empty($badges)) { return; } $themeobject->output('<h2>' . qa_lang('badges/badge_widget_title') . '</h2>'); foreach ($badges as $badge) { $params = array(); $paramsa = explode("\t", $badge['params']); foreach ($paramsa as $param) { $parama = explode('=', $param); $params[$parama[0]] = $parama[1]; } $slug = $params['badge_slug']; $typea = qa_get_badge_type_by_slug($slug); $types = $typea['slug']; $typed = $typea['name']; $badge_name = qa_lang('badges/' . $slug); if (!qa_opt('badge_' . $slug . '_name')) { qa_opt('badge_' . $slug . '_name', $badge_name); } $var = qa_opt('badge_' . $slug . '_var'); $name = qa_opt('badge_' . $slug . '_name'); $desc = qa_badge_desc_replace($slug, $var, $name); $string = '<span class="badge-' . $types . '" title="' . $desc . ' (' . $typed . ')">' . qa_html($name) . '<br/>- ' . $badge['handle'] . ' -</span>'; $themeobject->output('<div class="badge-widget-entry" style="padding-top:8px;">', $string, '</div>'); } }
function admin_form(&$qa_content) { // process the admin form if admin hit Save-Changes-button $ok = null; if (qa_clicked('qa_blog_save')) { qa_opt('qa_blog_enabled', (bool) qa_post_text('qa_blog_enabled')); qa_opt('qa_blog_title', qa_post_text('qa_blog_title')); qa_opt('qa_blog_tagline', qa_post_text('qa_blog_tagline')); qa_opt('qa_blog_cat_1', qa_post_text('qa_blog_cat_1')); qa_opt('qa_blog_cat_2', qa_post_text('qa_blog_cat_2')); qa_opt('qa_blog_cat_3', qa_post_text('qa_blog_cat_3')); qa_opt('qa_blog_cat_4', qa_post_text('qa_blog_cat_4')); qa_opt('qa_blog_cat_5', qa_post_text('qa_blog_cat_5')); qa_opt('qa_blog_rules', qa_post_text('qa_blog_rules')); qa_opt('qa_blog_content_max', (int) qa_post_text('qa_blog_content_max_field')); $ok = qa_lang('qa_blog_lang/blog_save'); } qa_set_display_rules($qa_content, array('field_2' => 'field_1', 'field_3' => 'field_1', 'field_5' => 'field_1', 'field_6' => 'field_1', 'field_7' => 'field_1', 'field_8' => 'field_1', 'field_9' => 'field_1', 'field_10' => 'field_1', 'field_11' => 'field_1')); // form fields to display frontend for admin $fields = array(); $fields[] = array('label' => qa_lang('qa_blog_lang/enable_plugin'), 'type' => 'checkbox', 'value' => qa_opt('qa_blog_enabled'), 'tags' => 'name="qa_blog_enabled" id="field_1"'); $fields[] = array('id' => 'field_2', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/blog_title'), 'value' => qa_opt('qa_blog_title'), 'tags' => 'name="qa_blog_title"'); $fields[] = array('id' => 'field_3', 'type' => 'textarea', 'label' => qa_lang('qa_blog_lang/blog_tagline'), 'value' => qa_opt('qa_blog_tagline'), 'rows' => 4, 'tags' => 'name="qa_blog_tagline"'); $fields[] = array('id' => 'field_5', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_1'), 'value' => qa_opt('qa_blog_cat_1'), 'tags' => 'name="qa_blog_cat_1"'); $fields[] = array('id' => 'field_6', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_2'), 'value' => qa_opt('qa_blog_cat_2'), 'tags' => 'name="qa_blog_cat_2"'); $fields[] = array('id' => 'field_7', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_3'), 'value' => qa_opt('qa_blog_cat_3'), 'tags' => 'name="qa_blog_cat_3"'); $fields[] = array('id' => 'field_8', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_4'), 'value' => qa_opt('qa_blog_cat_4'), 'tags' => 'name="qa_blog_cat_4"'); $fields[] = array('id' => 'field_9', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_5'), 'value' => qa_opt('qa_blog_cat_5'), 'tags' => 'name="qa_blog_cat_5"'); $fields[] = array('id' => 'field_10', 'type' => 'textarea', 'label' => qa_lang('qa_blog_lang/blog_rules'), 'value' => qa_opt('qa_blog_rules'), 'tags' => 'name="qa_blog_rules"', 'rows' => 4); $fields[] = array('id' => 'field_11', 'label' => qa_lang('qa_blog_lang/content_max'), 'suffix' => qa_lang('qa_blog_lang/suffix'), 'type' => 'number', 'value' => (int) qa_opt('qa_blog_content_max'), 'tags' => 'name="qa_blog_content_max_field"'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="qa_blog_save"'))); }
function admin_form(&$qa_content) { // Process form input $ok = null; if (qa_clicked('cp_save')) { // Save qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta ( meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, post_id bigint(20) unsigned NOT NULL, meta_key varchar(255) DEFAULT \'\', meta_value longtext, PRIMARY KEY (meta_id), KEY post_id (post_id), KEY meta_key (meta_key) ) ENGINE=MyISAM DEFAULT CHARSET=utf8'); qa_opt('cp_enable', (bool) qa_post_text('cp_enable')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('cp_reset')) { // Reset foreach ($_POST as $i => $v) { $def = $this->option_default($i); if ($def !== null) { qa_opt($i, $def); } } qa_opt('cp_enable', true); $ok = qa_lang('admin/options_reset'); } } // Create the form for display $fields = array(); $fields[] = array('label' => qa_lang('cp/enable_community_posts'), 'tags' => 'NAME="cp_enable"', 'value' => qa_opt('cp_enable'), 'type' => 'checkbox'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="cp_save"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="cp_reset"'))); }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { $out = ''; require_once QA_INCLUDE_DIR . 'qa-app-users.php'; if (qa_is_logged_in()) { $out = ' <button id="adchattoggle" class="adchattoggle">Show/Hide Chat </button>'; $out .= '<div class="adchat" id="adchat" style="display:'; if (@$_COOKIE['showadchat'] == 'block') { $out .= "block"; } else { $out .= "none"; } $out .= '">'; $out .= ' <iframe src="' . $this->urltoroot . 'chat/" style="border:0; width:100%; height:480px;"></iframe> </div>'; } else { $out = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="' . qa_html(qa_opt("adsense_publisher_id")) . '" data-ad-slot="' . qa_html(qa_opt("adsense_adunit_id")) . '" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>'; } $output = '<div class="adchat-widget-container">' . $out . '</div>'; $themeobject->output($output); }
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; }
function embed_replace($text) { $w = qa_opt('embed_video_width'); $h = qa_opt('embed_video_height'); $w2 = qa_opt('embed_image_width'); $h2 = qa_opt('embed_image_height'); $types = array('youtube' => array(array('https{0,1}:\\/\\/w{0,3}\\.*youtube\\.com\\/watch\\?\\S*v=([A-Za-z0-9_-]+)[^< ]*', '<iframe width="' . $w . '" height="' . $h . '" src="http://www.youtube.com/embed/$1?wmode=transparent" frameborder="0" allowfullscreen></iframe>'), array('https{0,1}:\\/\\/w{0,3}\\.*youtu\\.be\\/([A-Za-z0-9_-]+)[^< ]*', '<iframe width="' . $w . '" height="' . $h . '" src="http://www.youtube.com/embed/$1?wmode=transparent" frameborder="0" allowfullscreen></iframe>')), 'vimeo' => array(array('https{0,1}:\\/\\/w{0,3}\\.*vimeo\\.com\\/([0-9]+)[^< ]*', '<iframe src="http://player.vimeo.com/video/$1?title=0&byline=0&portrait=0&wmode=transparent" width="' . $w . '" height="' . $h . '" frameborder="0"></iframe>')), 'metacafe' => array(array('https{0,1}:\\/\\/w{0,3}\\.*metacafe\\.com\\/watch\\/([0-9]+)\\/([a-z0-9_]+)[^< ]*', '<embed flashVars="playerVars=showStats=no|autoPlay=no" src="http://www.metacafe.com/fplayer/$1/$2.swf" width="' . $w . '" height="' . $h . '" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_$1" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>')), 'dailymotion' => array(array('https{0,1}:\\/\\/w{0,3}\\.*dailymotion\\.com\\/video\\/([A-Za-z0-9]+)[^< ]*', '<iframe frameborder="0" width="' . $w . '" height="' . $h . '" src="http://www.dailymotion.com/embed/video/$1?wmode=transparent"></iframe>')), 'image' => array(array('(https*:\\/\\/[-\\%_\\/.a-zA-Z0-9+]+\\.(png|jpg|jpeg|gif|bmp))[^< ]*', '<img src="$1" style="max-width:' . $w2 . 'px;max-height:' . $h2 . 'px" />', 'img')), 'mp3' => array(array('(https*:\\/\\/[-\\%_\\/.a-zA-Z0-9]+\\.mp3)[^< ]*', qa_opt('embed_mp3_player_code'), 'mp3')), 'gmap' => array(array('(https*:\\/\\/maps.google.com\\/?[^< ]+)', '<iframe width="' . qa_opt('embed_gmap_width') . '" height="' . qa_opt('embed_gmap_height') . '" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$1&ie=UTF8&output=embed"></iframe><br /><small><a href="$1&ie=UTF8&output=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>', 'gmap'))); foreach ($types as $t => $ra) { foreach ($ra as $r) { if (!isset($r[2]) && !qa_opt('embed_enable') || isset($r[2]) && !qa_opt('embed_enable_' . $r[2])) { continue; } if (isset($r[2]) && @$r[2] == 'img' && qa_opt('embed_enable_thickbox') && preg_match('/MSIE [5-7]/', $_SERVER['HTTP_USER_AGENT']) == 0) { preg_match_all('/' . $r[0] . '/', $text, $imga); if (!empty($imga)) { foreach ($imga[1] as $img) { $replace = '<a href="' . $img . '" class="thickbox"><img src="' . $img . '" style="max-width:' . $w2 . 'px;max-height:' . $h2 . 'px" /></a>'; $text = preg_replace('|<a[^>]+>' . $img . '</a>|i', $replace, $text); $text = preg_replace('|(?<![\'"=])' . $img . '|i', $replace, $text); } } continue; } $text = preg_replace('/<a[^>]+>' . $r[0] . '<\\/a>/i', $r[1], $text); $text = preg_replace('/(?<![\'"=])' . $r[0] . '/i', $r[1], $text); } } return $text; }
function admin_form(&$qa_content) { $ok = null; if (qa_clicked('short_url_save_button')) { qa_opt('short_url_content_on', (bool) qa_post_text('short_url_content_on')); qa_opt('short_url_bitly_username', (string) qa_post_text('short_url_bitly_username')); qa_opt('short_url_bitly_api_key', (string) qa_post_text('short_url_bitly_api_key')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('short_url_reset_button')) { foreach ($_POST as $i => $v) { $def = $this->option_default($i); if ($def !== null) { qa_opt($i, $def); } } $ok = qa_lang('admin/options_reset'); } } $fields = array(); $ready = strlen(qa_opt('short_url_bitly_username')) && strlen(qa_opt('short_url_bitly_api_key')); if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') { $fields[] = array('label' => 'You cannot enable when in localhost', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox', 'disabled' => 'disabled'); } else { $fields[] = array('label' => 'Enable Short Url', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox'); } $fields[] = array('label' => 'Your Bitly username', 'tags' => 'NAME="short_url_bitly_username"', 'value' => qa_opt('short_url_bitly_username'), 'type' => 'string'); $fields[] = array('label' => 'Your Bitly api key', 'tags' => 'NAME="short_url_bitly_api_key"', 'value' => qa_opt('short_url_bitly_api_key'), 'type' => 'string', 'error' => $ready ? null : 'You can find your api key <a href="https://bitly.com/a/your_api_key">here</a>'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="short_url_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="short_url_reset_button"'))); }
public function process_request($request) { if ($request == 'facebook-login') { $app_id = qa_opt('facebook_app_id'); $app_secret = qa_opt('facebook_app_secret'); $tourl = qa_get('to'); if (!strlen($tourl)) { $tourl = qa_path_absolute(''); } if (strlen($app_id) && strlen($app_secret)) { require_once $this->directory . 'facebook.php'; $facebook = new Facebook(array('appId' => $app_id, 'secret' => $app_secret, 'cookie' => true)); $fb_userid = $facebook->getUser(); if ($fb_userid) { try { $user = $facebook->api('/me?fields=email,name,verified,location,website,about,picture.width(250)'); if (is_array($user)) { qa_log_in_external_user('facebook', $fb_userid, array('email' => @$user['email'], 'handle' => @$user['name'], 'confirmed' => @$user['verified'], 'name' => @$user['name'], 'location' => @$user['location']['name'], 'website' => @$user['website'], 'about' => @$user['bio'], 'avatar' => strlen(@$user['picture']['data']['url']) ? qa_retrieve_url($user['picture']['data']['url']) : null)); } } catch (FacebookApiException $e) { } } else { qa_redirect_raw($facebook->getLoginUrl(array('redirect_uri' => $tourl))); } } qa_redirect_raw($tourl); } }
function admin_form(&$qa_content) { // Process form input $ok = null; if (qa_clicked('prevnav_save_button')) { qa_opt('prevnav_plugin_css', qa_post_text('prevnav_plugin_css')); qa_opt('prevnav_plugin_widget_only', (bool) qa_post_text('prevnav_plugin_widget_only')); qa_opt('prevnav_plugin_widget_title', qa_post_text('prevnav_plugin_widget_title')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('prevnav_reset_button')) { foreach ($_POST as $i => $v) { $def = $this->option_default($i); if ($def !== null) { qa_opt($i, $def); } } $ok = qa_lang('admin/options_reset'); } } // Create the form for display $fields = array(); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'PrevNav buttons custom css', 'tags' => 'NAME="prevnav_plugin_css"', 'value' => qa_opt('prevnav_plugin_css'), 'type' => 'textarea', 'rows' => 20); $fields[] = array('label' => 'Widget Title', 'tags' => 'NAME="prevnav_plugin_widget_title"', 'value' => qa_opt('prevnav_plugin_widget_title')); $fields[] = array('type' => 'blank'); $fields[] = array('type' => 'blank'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="prevnav_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="prevnav_reset_button"'))); }
public function q_list($q_list) { if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) { // first check it is not an empty list and the feature is turned on // Collect the question ids of all items in the question list (so we can do this in one DB query) $postids = array(); foreach ($q_list['qs'] as $question) { if (isset($question['raw']['postid'])) { $postids[] = $question['raw']['postid']; } } if (!empty($postids)) { // Retrieve the content for these questions from the database and put into an array fetching // the minimal amount of characters needed to determine the string should be shortened or not $maxlength = qa_opt('mouseover_content_max_len'); $result = qa_db_query_sub('SELECT postid, LEFT(content, #) content, format FROM ^posts WHERE postid IN (#)', $maxlength + 1, $postids); $postinfo = qa_db_read_all_assoc($result, 'postid'); // Get the regular expression fragment to use for blocked words and the maximum length of content to show $blockwordspreg = qa_get_block_words_preg(); // Now add the popup to the title for each question foreach ($q_list['qs'] as $index => $question) { if (isset($postinfo[$question['raw']['postid']])) { $thispost = $postinfo[$question['raw']['postid']]; $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg)); $text = qa_shorten_string_line($text, $maxlength); $title = isset($question['title']) ? $question['title'] : ''; $q_list['qs'][$index]['title'] = sprintf('<span title="%s">%s</span>', qa_html($text), $title); } } } } qa_html_theme_base::q_list($q_list); // call back through to the default function }
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) . '">'); }
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) . '">'); }
function q_list($q_list) { if (count(@$q_list['qs']) && qa_opt('mouseover_content_on')) { // first check it is not an empty list and the feature is turned on // Collect the question ids of all items in the question list (so we can do this in one DB query) $postids = array(); foreach ($q_list['qs'] as $question) { if (isset($question['raw']['postid'])) { $postids[] = $question['raw']['postid']; } } if (count($postids)) { // Retrieve the content for these questions from the database and put into an array $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids); $postinfo = qa_db_read_all_assoc($result, 'postid'); // Get the regular expression fragment to use for blocked words and the maximum length of content to show $blockwordspreg = qa_get_block_words_preg(); $maxlength = qa_opt('mouseover_content_max_len'); // Now add the popup to the title for each question foreach ($q_list['qs'] as $index => $question) { $thispost = @$postinfo[$question['raw']['postid']]; if (isset($thispost)) { $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg)); $text = qa_shorten_string_line($text, $maxlength); $q_list['qs'][$index]['title'] = '<SPAN TITLE="' . qa_html($text) . '">' . @$question['title'] . '</SPAN>'; } } } } qa_html_theme_base::q_list($q_list); // call back through to the default function }
function cs_stats_chart($type = 'bar') { $o = '<div class="site-status-inner clearfix">'; if ($type == 'bar') { $o .= '<div class="bar-float"><div class="sparkline" data-type="bar" data-bar-color="#E45840" data-bar-width="30" data-height="80"> <!--' . qa_opt('cache_qcount') . ',' . qa_opt('cache_acount') . ',' . qa_opt('cache_ccount') . ',' . qa_opt('cache_unaqcount') . ',' . qa_opt('cache_unselqcount') . '--></div> <ul class="list-inline text-muted axis"> <li>' . qa_lang_html('cleanstrap/que') . '</li><li>' . qa_lang_html('cleanstrap/ans') . '</li><li>' . qa_lang_html('cleanstrap/com') . '</li><li>' . qa_lang_html('cleanstrap/ua') . '</li><li>' . qa_lang_html('cleanstrap/us') . '</li> </ul></div> <div class="acti-indicators"> <ul> <li><i class="fa fa-circle text-info" style="color:#233445"></i> ' . qa_lang_html('cleanstrap/questions') . ' <span>' . qa_opt('cache_qcount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#3fcf7f"></i> ' . qa_lang_html('cleanstrap/answers') . ' <span>' . qa_opt('cache_acount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#FF5F5F"></i> ' . qa_lang_html('cleanstrap/comments') . ' <span>' . qa_opt('cache_ccount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#13C4A5"></i> ' . qa_lang_html('cleanstrap/unanswered') . ' <span>' . qa_opt('cache_unaqcount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#F4C414"></i> ' . qa_lang_html('cleanstrap/unselected') . ' <span>' . qa_opt('cache_unselqcount') . '</span></li> </ul> </div>'; } else { $o .= '<div class="bar-float"><div class="sparkline pieact inline" data-type="pie" data-height="130" data-slice-colors="[\'#233445\',\'#3fcf7f\',\'#ff5f5f\',\'#f4c414\',\'#13c4a5\']">' . qa_opt('cache_qcount') . ',' . qa_opt('cache_acount') . ',' . qa_opt('cache_ccount') . ',' . qa_opt('cache_unaqcount') . ',' . qa_opt('cache_unselqcount') . '</div> <div class="line pull-in"></div></div> <div class="acti-indicators"> <ul> <li><i class="fa fa-circle text-info" style="color:#233445"></i> ' . qa_lang_html('cleanstrap/questions') . '<span>' . qa_opt('cache_qcount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#3fcf7f"></i> ' . qa_lang_html('cleanstrap/answers') . ' <span>' . qa_opt('cache_acount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#FF5F5F"></i> ' . qa_lang_html('cleanstrap/comments') . ' <span>' . qa_opt('cache_ccount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#13C4A5"></i> ' . qa_lang_html('cleanstrap/unanswered') . ' <span>' . qa_opt('cache_unaqcount') . '</span></li> <li><i class="fa fa-circle text-info" style="color:#F4C414"></i> ' . qa_lang_html('cleanstrap/unselected') . '<span>' . qa_opt('cache_unselqcount') . '</span></li> </ul> </div>'; } $o .= '</div>'; return $o; }
function admin_form(&$qa_content) { $ok = null; if (qa_clicked('obvious_save_button')) { qa_opt('obvious_content_on', (bool) qa_post_text('obvious_content_on')); qa_opt('obvious_content_color', (string) qa_post_text('obvious_content_color')); qa_opt('obvious_max_tags', (int) qa_post_text('obvious_max_tags')); qa_opt('obvious_content_category_on', (bool) qa_post_text('obvious_content_category_on')); qa_opt('obvious_content_category_color', (string) qa_post_text('obvious_content_category_color')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('obvious_reset_button')) { foreach ($_POST as $i => $v) { $def = $this->option_default($i); if ($def !== null) { qa_opt($i, $def); } } $ok = qa_lang('admin/options_reset'); } } $fields = array(); $fields[] = array('label' => 'Enable Obvious Favorite Tags', 'tags' => 'NAME="obvious_content_on"', 'value' => qa_opt('obvious_content_on'), 'type' => 'checkbox'); $fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_color"', 'value' => qa_opt('obvious_content_color'), 'type' => 'string'); $fields[] = array('label' => 'Enable Obvious Favorite Category', 'tags' => 'NAME="obvious_content_category_on"', 'value' => qa_opt('obvious_content_category_on'), 'type' => 'checkbox'); $fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_category_color"', 'value' => qa_opt('obvious_content_category_color'), 'type' => 'string'); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'Maximum tags for the Widget', 'tags' => 'NAME="obvious_max_tags"', 'value' => qa_opt('obvious_max_tags'), 'type' => 'int'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="obvious_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="obvious_reset_button"'))); }
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)); } }
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null) { require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-updates.php'; $userid = qa_get_logged_in_userid(); // Chop down to size, get user information for display if (isset($pagesize)) { $questions = array_slice($questions, 0, $pagesize); } $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions)); $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))); $qa_content['q_list']['qs'] = array(); if (count($questions)) { $qa_content['title'] = $sometitle; $defaults = qa_post_html_defaults('Q'); foreach ($questions as $question) { $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults)); } } else { $qa_content['title'] = $nonetitle; } if (isset($count) && isset($pagesize)) { $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams); } return $qa_content; }
function q2apro_save_most_viewed_questions() { // save checktime of cache qa_opt('q2apro_popularqu_checktime', time()); $maxquestions = qa_opt('q2apro_popularqu_maxqu'); $lastdays = qa_opt('q2apro_popularqu_lastdays'); $ourTopQuestions = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, title, acount FROM `^posts` WHERE `created` > NOW() - INTERVAL # DAY AND `type` = "Q" AND `closedbyid` IS NULL ORDER BY views DESC LIMIT #;', $lastdays, $maxquestions)); $saveoutput = ''; foreach ($ourTopQuestions as $qu) { $activity_url = qa_path_html(qa_q_request($qu['postid'], $qu['title']), null, qa_opt('site_url'), null, null); $questionlink = '<a href="' . $activity_url . '">' . htmlspecialchars($qu['title']) . '</a>'; $answercnt = ''; if (qa_opt('q2apro_popularqu_answercount')) { $acnttitle = $qu['acount'] == 1 ? qa_lang('q2apro_popularqu_lang/answer_one') : $qu['acount'] . ' ' . qa_lang('q2apro_popularqu_lang/answers'); $answercnt = ' <span title="' . $acnttitle . '">(' . $qu['acount'] . ')</span>'; } $saveoutput .= '<li> ' . $questionlink . $answercnt . ' </li> '; } // save into cache qa_opt('q2apro_popularqu_cached', $saveoutput); }
function qa_wall_error_html($fromuserid, $touserid, $touserflags) { require_once QA_INCLUDE_DIR . 'qa-app-limits.php'; if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) { if ($touserflags & QA_USER_FLAGS_NO_WALL_POSTS && !(isset($fromuserid) && $fromuserid == $touserid)) { return qa_lang_html('profile/post_wall_blocked'); } else { switch (qa_user_permit_error('permit_post_wall', QA_LIMIT_WALL_POSTS)) { case 'limit': return qa_lang_html('profile/post_wall_limit'); break; case 'login': return qa_insert_login_links(qa_lang_html('profile/post_wall_must_login'), qa_request()); break; case 'confirm': return qa_insert_login_links(qa_lang_html('profile/post_wall_must_confirm'), qa_request()); break; case 'approve': return qa_lang_html('profile/post_wall_must_be_approved'); break; case false: return false; break; } } } return qa_lang_html('users/no_permission'); }
function head_custom() { parent::head_custom(); if ($this->template != 'plugin' || $this->request != 'chat') { return; } $hidecss = qa_opt($this->optcss) === '1'; if (!$hidecss) { $chat_css = ' <style> #qa-chat-form { text-align: center; } .qa-chat-post { width: 600px; } #qa-chat-list, .qa-chat-item, #qa-chat-user-list, .qa-chat-user-item { display: block; list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.4; } #qa-chat-list { width: 728px; margin: 1em auto; } .qa-chat-item { overflow: hidden; padding: 4px 0; border-top: 1px solid #eee; } .qa-chat-item:last-child { border-bottom: 1px solid #eee; } .qa-chat-item-meta { float: left; width: 110px; padding-right: 20px; font-size: 11px; color: #999; text-align: right; } .qa-chat-item-data { float: left; width: 598px; } .qa-chat-user-item { padding: 2px 4px; } .qa-chat-user-item:hover { background: rgba(255,255,255,0.4); } .qa-chat-idle, .qa-chat-idle > a { color: #aaa; } .qa-chat-kick { float: right; cursor: pointer; width: 10px; height: 10px; border-radius: 10px; background: #999; margin-top: 5px; } .qa-chat-kick:hover { background: #f00; } .qa-chat-service { background: #fffae4; } </style>'; $this->output_raw($chat_css); } }
function head_css() { qa_html_theme_base::head_css(); if (strlen(qa_opt('facebook_app_id')) && strlen(qa_opt('facebook_app_secret'))) { $this->output('<style><!--', '.fb-login-button.fb_iframe_widget.fb_hide_iframes span {display:none;}', '--></style>'); } }
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'db/selects.php'; $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags'))); $maxcount = reset($populartags); // $themeobject->output(sprintf('<h2 style="margin-top: 0; padding-top: 0;">%s</h2>', qa_lang_html('main/popular_tags'))); // $themeobject->output('<div style="font-size: 10px;">'); $themeobject->output(sprintf('<div class="panel panel-primary" style="padding: 0;"><div class="panel-heading"><h3 class="panel-title">%s</h3></div>', qa_lang_html('main/popular_tags'))); $themeobject->output('<div class="panel-body">'); $maxsize = qa_opt('tag_cloud_font_size'); $minsize = qa_opt('tag_cloud_minimal_font_size'); $scale = qa_opt('tag_cloud_size_popular'); $blockwordspreg = qa_get_block_words_preg(); foreach ($populartags as $tag => $count) { $matches = qa_block_words_match_all($tag, $blockwordspreg); if (empty($matches)) { if ($scale) { $size = number_format($maxsize * $count / $maxcount, 1); if ($size < $minsize) { $size = $minsize; } } else { $size = $maxsize; } $themeobject->output(sprintf('<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>', qa_path_html('tag/' . $tag), $size, qa_html($tag))); } } // $themeobject->output('</div>'); $themeobject->output('</div></div>'); }