本文整理汇总了PHP中qa_html_theme_base::head_title方法的典型用法代码示例。如果您正苦于以下问题:PHP qa_html_theme_base::head_title方法的具体用法?PHP qa_html_theme_base::head_title怎么用?PHP qa_html_theme_base::head_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qa_html_theme_base
的用法示例。
在下文中一共展示了qa_html_theme_base::head_title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: head_title
function head_title()
{
if (qa_opt('buddypress_integration_enable') && qa_opt('buddypress_display_names') && $this->template == 'user' && @$this->content['title']) {
$rest = str_replace('^', '(\\S+)', qa_lang_html('profile/user_x'));
$handle = preg_replace('|' . $rest . '|', '$1', $this->content['title']);
$name = bp_core_get_user_displayname($handle);
if ($name) {
$this->content['title'] = qa_lang_html_sub('profile/user_x', $name) . ' (@' . $handle . ')';
if (isset($this->content['form_activity'])) {
$this->content['form_activity']['title'] = qa_lang_html_sub('profile/activity_by_x', $name);
}
}
}
qa_html_theme_base::head_title();
}
示例2: head_title
function head_title()
{
// Title Customization Options
$title = '';
switch ($this->template) {
case 'qa':
$title_template = qa_opt('useo_title_qa');
if (!empty($title_template)) {
$search = array('%site-title%');
$replace = array(qa_opt('site_title'));
$title = str_replace($search, $replace, $title_template);
}
break;
case 'question':
$category_name = '';
if (isset($this->content["categoryids"]) && !empty($this->content["categoryids"])) {
$category_name = $this->content["q_view"]["raw"]["categoryname"];
}
if (empty($this->meta_title)) {
// title customization
$title_template = qa_opt('useo_title_qa_item');
if (!empty($title_template)) {
$search = array('%site-title%', '%question-title%', '%category-name%');
$replace = array(qa_opt('site_title'), @$this->content['q_view']['raw']['title'], $category_name);
$title = str_replace($search, $replace, $title_template);
}
} else {
// meta editor
$title = $this->meta_title;
}
break;
case 'questions':
$category_name = '';
if (count(explode('/', $this->request)) > 1) {
$category_name = $this->content["q_list"]["qs"][0]["raw"]["categoryname"];
}
$sort = qa_get('sort');
if (empty($sort)) {
$title_template = qa_opt('useo_title_recent');
if (!empty($title_template)) {
$search = array('%site-title%', '%recent-qs-title%', '%category-name%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/recent_qs_title'), $category_name);
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'hot') {
$title_template = qa_opt('useo_title_hot');
if (!empty($title_template)) {
$search = array('%site-title%', '%hot-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/hot_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'votes') {
$title_template = qa_opt('useo_title_voted');
if (!empty($title_template)) {
$search = array('%site-title%', '%voted-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/voted_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'answers') {
$title_template = qa_opt('useo_title_answered');
if (!empty($title_template)) {
$search = array('%site-title%', '%answered-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/answered_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'views') {
$title_template = qa_opt('useo_title_viewed');
if (!empty($title_template)) {
$search = array('%site-title%', '%viewed-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/viewed_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
}
case 'unanswered':
$sort = qa_get('by');
$category_name = '';
if (count(explode('/', $this->request)) > 1) {
$category_name = $this->content["q_list"]["qs"][0]["raw"]["categoryname"];
}
if (empty($sort)) {
$title_template = qa_opt('useo_title_unanswered');
if (!empty($title_template)) {
$search = array('%site-title%', '%unanswered-qs-title%', '%category-name%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/unanswered_qs_title'), $category_name);
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'selected') {
$title_template = qa_opt('useo_title_unselected');
if (!empty($title_template)) {
$search = array('%site-title%', '%unselected-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/unselected_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
} elseif ($sort == 'upvotes') {
$title_template = qa_opt('useo_title_unupvoted');
if (!empty($title_template)) {
$search = array('%site-title%', '%unupvoteda-qs-title%');
$replace = array(qa_opt('site_title'), qa_lang_html('main/unupvoteda_qs_title'));
$title = str_replace($search, $replace, $title_template);
}
//.........这里部分代码省略.........