function qa_q_request($questionid, $title) { // URL Clean if (qa_opt('useo_url_cleanup')) { //clean url's title $words = qa_opt('useo_url_words_list'); $raw_title = $title; // ~~ str_replace method //$word_list = explode(',', $words); //$title = str_replace($word_list, '', $raw_title); // ~~preg_replace method with Q2A functions require_once QA_INCLUDE_DIR . 'qa-util-string.php'; $word_list = qa_block_words_to_preg($words); $title = trim(qa_block_words_replace($title, $word_list, '')); if (strlen($title) == 0 && qa_opt('useo_url_dont_make_empty')) { $title = $raw_title; } } $url = qa_q_request_base($questionid, $title); // capitalize letters if (qa_opt('useo_url_q_uppercase')) { $type = qa_opt('useo_url_q_uppercase_type'); if ($type == 1) { // first word's first letter $parts = explode('/', $url); $parts[1] = ucfirst($parts[1]); $url = implode('/', $parts); } else { if ($type == 2) { // all word's first letter $url = str_replace(' ', '?', ucwords(str_replace('?', ' ', str_replace(' ', '/', ucwords(str_replace('/', ' ', str_replace(' ', '-', ucwords(str_replace('-', ' ', strtolower($url)))))))))); } else { // whole words $url = strtoupper($url); } } } return $url; }
function qa_q_request($questionid, $title) { $title = Pinyin::getPinyin($title); return qa_q_request_base($questionid, $title); }