本文整理汇总了PHP中qa_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_strtolower函数的具体用法?PHP qa_strtolower怎么用?PHP qa_strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_strtolower函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qa_tag_html
function qa_tag_html($tag, $microformats = false, $favorited = false)
{
global $plugin_tag_desc_list;
$taghtml = qa_tag_html_base($tag, $microformats, $favorited);
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
$plugin_tag_desc_list[$taglc] = true;
$anglepos = strpos($taghtml, '>');
if ($anglepos !== false) {
$taghtml = substr_replace($taghtml, ' TITLE=",TAG_DESC,' . $taglc . ',"', $anglepos, 0);
}
return $taghtml;
}
示例2: process_request
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1];
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Edit the description for Fture test ' . qa_html($tag);
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => 'Save Description')));
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_redirect('tag/' . $tag);
}
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
示例3: process_request
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1];
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($tag));
if (qa_user_permit_error('useo_tag_desc_permit_edit')) {
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'title', qa_post_text('tagtitle'));
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_db_tagmeta_set($taglc, 'icon', qa_post_text('tagicon'));
qa_redirect('tag/' . $tag);
}
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="tagtitle" ID="tagtitle"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description'))), array('label' => 'Icon image:', 'type' => 'text', 'rows' => 1, 'tags' => 'NAME="tagicon" ID="tagicon"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'icon')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button'))));
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
示例4: qa_tag_html
function qa_tag_html($tag, $microformats = false, $favorited = false)
{
// URL Customization
$type = qa_opt('useo_url_tag_uppercase_type');
if ($type == 1) {
// first word's first letter
$taglink = ucfirst($tag);
} else {
if ($type == 2) {
// all word's first letter
$taglink = str_replace(' ', '?', ucwords(str_replace('?', ' ', str_replace(' ', '/', ucwords(str_replace('/', ' ', str_replace(' ', '-', ucwords(str_replace('-', ' ', strtolower($tag))))))))));
} else {
// whole words
$taglink = strtoupper($tag);
}
}
// Tag Description
global $useo_tag_desc_list;
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
$useo_tag_desc_list[$taglc] = true;
return '<a href="' . qa_path_html('tag/' . $taglink) . '"' . ($microformats ? ' rel="tag"' : '') . ' class="qa-tag-link' . ($favorited ? ' qa-tag-favorited' : '') . '">' . qa_html($tag) . '</a>';
}
示例5: qa_get_start
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
// Get popular tags
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
$populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags')));
$tagcount = qa_opt('cache_tagcount');
$pagesize = qa_opt('page_size_tags');
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/popular_tags');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_tags')), 'type' => 'tags');
if (count($populartags)) {
$favoritemap = qa_get_favorite_non_qs_map();
$output = 0;
foreach ($populartags as $word => $count) {
$qa_content['ranking']['items'][] = array('label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]), 'count' => number_format($count));
if (++$output >= $pagesize) {
break;
}
}
} else {
$qa_content['title'] = qa_lang_html('main/no_tags_found');
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagcount, qa_opt('pages_prev_next'));
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = qa_html_suggest_ask();
}
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例6: qa_post_tags_to_tagstring
function qa_post_tags_to_tagstring($tags)
{
if (is_array($tags)) {
$tags = implode(',', $tags);
}
return qa_tags_to_tagstring(array_unique(preg_split('/\\s*[,,]\\s*/', qa_strtolower(strtr($tags, '/', ' ')), -1, PREG_SPLIT_NO_EMPTY)));
}
示例7: qa_get_tags_field_value
function qa_get_tags_field_value($fieldname)
{
require_once QA_INCLUDE_DIR . 'util/string.php';
$text = qa_remove_utf8mb4(qa_post_text($fieldname));
if (qa_opt('tag_separator_comma')) {
return array_unique(preg_split('/\\s*,\\s*/', trim(qa_strtolower(strtr($text, '/', ' '))), -1, PREG_SPLIT_NO_EMPTY));
} else {
return array_unique(qa_string_to_words($text, true, false, false, false));
}
}
示例8: qa_post_text
require_once QA_INCLUDE_DIR . 'util/string.php';
$inname = qa_post_text('name');
$incontent = qa_post_text('content');
$inparentid = $setparent ? qa_get_category_field_value('parent') : $editcategory['parentid'];
$inposition = qa_post_text('position');
$errors = array();
// Check the parent ID
$incategories = qa_db_select_with_pending(qa_db_category_nav_selectspec($inparentid, true));
// Verify the name is legitimate for that parent ID
if (empty($inname)) {
$errors['name'] = qa_lang('main/field_required');
} elseif (qa_strlen($inname) > QA_DB_MAX_CAT_PAGE_TITLE_LENGTH) {
$errors['name'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TITLE_LENGTH);
} else {
foreach ($incategories as $category) {
if (!strcmp($category['parentid'], $inparentid) && strcmp($category['categoryid'], @$editcategory['categoryid']) && qa_strtolower($category['title']) == qa_strtolower($inname)) {
$errors['name'] = qa_lang('admin/category_already_used');
}
}
}
// Verify the slug is legitimate for that parent ID
for ($attempt = 0; $attempt < 100; $attempt++) {
switch ($attempt) {
case 0:
$inslug = qa_post_text('slug');
if (!isset($inslug)) {
$inslug = implode('-', qa_string_to_words($inname));
}
break;
case 1:
$inslug = qa_lang_sub('admin/category_default_slug', $inslug);
示例9: qa_block_words_match_all
function qa_block_words_match_all($string, $wordspreg)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
global $qa_utf8punctuation, $qa_utf8punctuation_keeplength;
if (strlen($wordspreg)) {
// replace all word separators with spaces of same length
if (!is_array($qa_utf8punctuation_keeplength)) {
$qa_utf8punctuation_keeplength = array();
foreach ($qa_utf8punctuation as $key => $value) {
$qa_utf8punctuation_keeplength[$key] = str_repeat(' ', strlen($key));
}
}
$string = strtr(qa_strtolower($string), $qa_utf8punctuation_keeplength);
// assumes UTF-8 case conversion in qa_strtolower does not change byte length
$string = preg_replace('/' . QA_PREG_BLOCK_WORD_SEPARATOR . '/', ' ', $string);
preg_match_all('/' . $wordspreg . '/', ' ' . $string . ' ', $pregmatches, PREG_OFFSET_CAPTURE);
$outmatches = array();
foreach ($pregmatches[0] as $pregmatch) {
$outmatches[$pregmatch[1] - 1] = strlen($pregmatch[0]);
}
return $outmatches;
}
return array();
}
示例10: qa_get_start
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
// Find the questions with this tag
if (!strlen($tag)) {
qa_redirect('tags');
}
list($questions, $tagword) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag));
$pagesize = qa_opt('page_size_tag_qs');
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html($questions);
// Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag));
if (isset($userid) && isset($tagword)) {
$favoritemap = qa_get_favorite_non_qs_map();
$favorite = @$favoritemap['tag'][qa_strtolower($tagword['word'])];
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word']));
}
if (!count($questions)) {
$qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found');
}
$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();
foreach ($questions as $postid => $question) {
$qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question));
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagword['tagcount'], qa_opt('pages_prev_next'));
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = qa_html_suggest_qs_tags(true);
}
if (qa_opt('feed_for_tag_qs')) {
示例11: qa_db_tag_word_selectspec
function qa_db_tag_word_selectspec($tag)
{
return array('columns' => array('wordid', 'word', 'tagcount'), 'source' => '^words WHERE word=$ AND word=$ COLLATE utf8_bin', 'arguments' => array($tag, qa_strtolower($tag)), 'single' => true);
}
示例12: test__qa_strtolower
public function test__qa_strtolower()
{
$test = qa_strtolower('hElLo WoRld');
$this->assertEquals($test, 'hello world');
}
示例13: qa_db_select_with_pending
$userfields = qa_db_select_with_pending(qa_db_userfields_selectspec());
// reload after changes
foreach ($userfields as $userfield) {
if ($userfield['fieldid'] == $editfield['fieldid']) {
$editfield = $userfield;
}
}
}
} elseif (empty($errors)) {
// creating a new user field
for ($attempt = 0; $attempt < 1000; $attempt++) {
$suffix = $attempt ? '-' . (1 + $attempt) : '';
$newtag = qa_substr(implode('-', qa_string_to_words($inname)), 0, QA_DB_MAX_PROFILE_TITLE_LENGTH - strlen($suffix)) . $suffix;
$uniquetag = true;
foreach ($userfields as $userfield) {
if (qa_strtolower(trim($newtag)) == qa_strtolower(trim($userfield['title']))) {
$uniquetag = false;
}
}
if ($uniquetag) {
$fieldid = qa_db_userfield_create($newtag, $inname, $inflags);
qa_db_userfield_move($fieldid, $inposition);
qa_redirect('admin/users');
}
}
qa_fatal_error('Could not create a unique database tag');
}
}
}
// Prepare content for theme
$qa_content = qa_content_prepare();
示例14: cs_relative_post_list
function cs_relative_post_list($limit, $slug, $type, $return = false, $avatar_size)
{
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
if (!empty($slug)) {
if ($type == 'Category') {
$post_type = 'Q';
$categories = explode("/", $slug);
if (count($categories)) {
$category_bread_crup = implode(" > ", $categories);
$category_link = implode("/", $categories);
$categories = array_reverse($categories);
$slug = implode("/", $categories);
}
$posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$
AND categoryid=(SELECT categoryid FROM ^categories WHERE ^categories.backpath=$ LIMIT 1)
ORDER BY ^posts.created DESC LIMIT #', 'Q', $slug, $limit));
//refresh every 15 minutes
$title = 'Questions in <a href="' . qa_path_html('questions/' . qa_strtolower($category_link)) . '">' . $category_bread_crup . '</a>';
} elseif ($type == 'Tags') {
$post_type = 'Q';
$title = 'Questions in <a href="' . qa_path_html('tag/' . qa_strtolower($slug)) . '">' . $slug . '</a>';
$posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$
AND ^posts.postid IN (SELECT postid FROM ^posttags WHERE
wordid=(SELECT wordid FROM ^words WHERE word=$ OR word=$ COLLATE utf8_bin LIMIT 1) ORDER BY postcreated DESC)
ORDER BY ^posts.created DESC LIMIT #', 'Q', $slug, qa_strtolower($slug), $limit));
} else {
// Relative to Keyword
require_once QA_INCLUDE_DIR . 'qa-app-search.php';
$keyword = $slug;
$userid = qa_get_logged_in_userid();
$title = 'Posts About <a href="' . qa_path_html('search/' . qa_strtolower($keyword)) . '">' . $keyword . '</a>';
//$post=qa_get_search_results($keyword, 0, $limit, $userid , false, false);
$words = qa_string_to_words($keyword);
$posts = qa_db_select_with_pending(qa_db_search_posts_selectspec($userid, $words, $words, $words, $words, trim($keyword), 0, false, $limit));
$output = '<h3 class="widget-title">' . $title . '</h3>';
$output .= '<ul class="question-list">';
foreach ($posts as $post) {
$post_type = $post['type'];
if ($post_type == 'Q') {
$what = qa_lang('cleanstrap/asked');
} elseif ($post_type == 'A') {
$what = qa_lang('cleanstrap/answered');
} elseif ('C') {
$what = qa_lang('cleanstrap/commented');
}
$handle = qa_post_userid_to_handle($post['userid']);
$avatar = cs_get_post_avatar($post, $avatar_size);
$output .= '<li id="q-list-' . $post['postid'] . '" class="question-item">';
$output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . $post['userid'] . '">' . $avatar . '</div>';
$output .= '<div class="list-right">';
if ($post_type == 'Q') {
$output .= '<a class="title" href="' . qa_q_path_html($post['postid'], $post['title']) . '" title="' . $post['title'] . '">' . cs_truncate(strip_tags($post['title']), 70) . '</a>';
} elseif ($post_type == 'A') {
$output .= '<p><a href="' . cs_post_link($post['parentid']) . '#a' . $post['postid'] . '">' . cs_truncate(strip_tags($post['content']), 70) . '</a></p>';
} else {
$output .= '<p><a href="' . cs_post_link($post['parentid']) . '#c' . $post['postid'] . '">' . cs_truncate(strip_tags($post['content']), 70) . '</a></p>';
}
$output .= '<div class="meta"><a href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a> ' . $what;
if ($post_type == 'Q') {
$output .= ' <span class="vote-count">' . $post['netvotes'] . ' votes</span>';
$output .= ' <span class="ans-count">' . $post['acount'] . ' ans</span>';
} elseif ($post_type == 'A') {
$output .= ' <span class="vote-count">' . $post['netvotes'] . ' votes</span>';
}
$output .= '</div></div>';
$output .= '</li>';
}
$output .= '</ul>';
if ($return) {
return $output;
}
echo $output;
return;
}
} else {
return;
}
$output = '<h3 class="widget-title">' . $title . '</h3>';
$output .= '<ul class="question-list">';
foreach ($posts as $p) {
if (empty($p['userid'])) {
$p['userid'] = NULL;
}
// to prevent error for anonymous posts while calling qa_post_userid_to_handle()
if ($post_type == 'Q') {
$what = qa_lang_html('cleanstrap/asked');
} elseif ($post_type == 'A') {
$what = qa_lang_html('cleanstrap/answered');
} elseif ('C') {
$what = qa_lang_html('cleanstrap/commented');
}
$handle = qa_post_userid_to_handle($p['userid']);
$avatar = cs_get_avatar($handle, 35, false);
$output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">';
$output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . qa_handle_to_userid($handle) . '">' . (isset($avatar) ? '<img src="' . $avatar . '" />' : '') . '</div>';
$output .= '<div class="list-right">';
if ($post_type == 'Q') {
$output .= '<a class="title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate(qa_html($p['title']), 70) . '</a>';
} elseif ($post_type == 'A') {
$output .= '<p><a href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 70) . '</a></p>';
//.........这里部分代码省略.........
示例15: qa_post_text
$inname = qa_post_text('name');
$inposition = qa_post_text('position');
$inpermit = (int) qa_post_text('permit');
$inurl = qa_post_text('url');
$innewwindow = qa_post_text('newwindow');
$inheading = qa_post_text('heading');
$incontent = qa_post_text('content');
$errors = array();
// Verify the name (navigation link) is legitimate
if (empty($inname)) {
$errors['name'] = qa_lang('main/field_required');
} elseif (qa_strlen($inname) > QA_DB_MAX_CAT_PAGE_TITLE_LENGTH) {
$errors['name'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TITLE_LENGTH);
} else {
foreach ($pages as $page) {
if ($page['pageid'] != @$editpage['pageid'] && qa_strtolower($page['title']) == qa_strtolower($inname)) {
$errors['name'] = qa_lang('admin/page_already_used');
}
}
}
if ($isexternal) {
// Verify the url is legitimate (vaguely)
if (empty($inurl)) {
$errors['url'] = qa_lang('main/field_required');
} elseif (qa_strlen($inurl) > QA_DB_MAX_CAT_PAGE_TAGS_LENGTH) {
$errors['url'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_CAT_PAGE_TAGS_LENGTH);
}
} else {
// Verify the heading is legitimate
if (qa_strlen($inheading) > QA_DB_MAX_TITLE_LENGTH) {
$errors['heading'] = qa_lang_sub('main/max_length_x', QA_DB_MAX_TITLE_LENGTH);