forked from q2a-projects/Q2A-Ultimate-SEO
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoverrides.php
66 lines (50 loc) · 1.76 KB
/
overrides.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
function qa_q_request($questionid, $title)
{
// For qa_string_to_words(), qa_block_words_to_preg(), qa_block_words_replace(), qa_strlen()
require_once QA_INCLUDE_DIR . 'util/string.php';
// URL Clean
if (qa_opt('useo_url_cleanup')) { //clean url's title
$words = qa_opt('useo_url_words_list');
$word_list = qa_block_words_to_preg($words);
$newTitle = trim(qa_block_words_replace($title ?? '', $word_list, ''));
if (qa_strlen($newTitle) > 0 || !qa_opt('useo_url_dont_make_empty')) {
$title = $newTitle;
}
}
// URL Customization
$type = (int)qa_opt('useo_url_q_uppercase_type');
$url = qa_q_request_base($questionid, $title);
if ($type === 0) { // early return, if possible
return $url;
}
$parts = explode('/', $url);
$parts[1] = useo_capitalize($type, $parts[1]);
return implode('/', $parts);
}
function qa_tag_html($tag, $microdata = false, $favorited = false)
{
// For qa_strtolower()
require_once QA_INCLUDE_DIR . 'util/string.php';
// URL Customization
$type = (int)qa_opt('useo_url_tag_uppercase_type');
$tag = useo_capitalize($type, $tag);
// Tag Description
global $useo_tag_desc_list;
$taglc = qa_strtolower($tag ?? '');
$useo_tag_desc_list[$taglc] = true;
return qa_tag_html_base($tag, $microdata, $favorited);
}
function qa_sanitize_html($html, $linksnewwindow = false, $storage = false)
{
$safe = qa_sanitize_html_base($html, $linksnewwindow, $storage);
if ($safe === '') {
return '';
}
return updateRelAttributeFromHtml($safe);
}
function qa_html_convert_urls($html, $newwindow = false)
{
$html = qa_html_convert_urls_base($html, $newwindow);
return updateRelAttributeFromHtml($html);
}