本文整理汇总了PHP中PMF_String::htmlspecialchars方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_String::htmlspecialchars方法的具体用法?PHP PMF_String::htmlspecialchars怎么用?PHP PMF_String::htmlspecialchars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_String
的用法示例。
在下文中一共展示了PMF_String::htmlspecialchars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildSitemapNode
function buildSitemapNode($location, $lastmod = null, $changeFreq = null, $priority = null)
{
if (!isset($lastmod)) {
$lastmod = PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false);
}
if (!isset($changeFreq)) {
$changeFreq = PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY;
}
$node = '<url>' . '<loc>' . PMF_String::htmlspecialchars($location) . '</loc>' . '<lastmod>' . $lastmod . '</lastmod>' . '<changefreq>' . $changeFreq . '</changefreq>' . (isset($priority) ? '<priority>' . $priority . '</priority>' : '') . '</url>';
return $node;
}
示例2: addPost
/**
* Adds a post to Twitter
*
* @param string $question Question
* @param string $tags String of tags
* @param string $link URL to FAQ
*
* @return void
*/
public function addPost($question, $tags, $link)
{
$hashtags = '';
if ($tags != '') {
$hashtags = '#' . str_replace(',', ' #', $tags);
}
$message = PMF_String::htmlspecialchars($question);
$message .= ' ' . $hashtags;
$message .= ' ' . $link;
$this->connection->post('statuses/update', array('status' => $message));
}
示例3: trim
$mquery[] = trim(PMF_String::substr($dat, 0, -1));
}
}
$k = 0;
$g = 0;
printf("<p>%s</p>\n", $PMF_LANG['ad_csv_process']);
$num = count($mquery);
$kg = '';
for ($i = 0; $i < $num; $i++) {
$mquery[$i] = PMF_DB_Helper::alignTablePrefix($mquery[$i], $table_prefix, PMF_Db::getTablePrefix());
$kg = $faqConfig->getDb()->query($mquery[$i]);
if (!$kg) {
printf('<div style="alert alert-danger"><strong>Query</strong>: "%s" failed (Reason: %s)</div>%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), $faqConfig->getDb()->error(), "\n");
$k++;
} else {
printf('<!-- <div style="alert alert-success"><strong>Query</strong>: "%s" okay</div> -->%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), "\n");
$g++;
}
}
printf('<p class="alert alert-success">%d %s %d %s</p>', $g, $PMF_LANG['ad_csv_of'], $num, $PMF_LANG['ad_csv_suc']);
}
} else {
switch ($_FILES['userfile']['error']) {
case 1:
$errorMessage = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case 2:
$errorMessage = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
break;
case 3:
$errorMessage = 'The uploaded file was only partially uploaded.';
示例4: updateGlossaryItem
/**
* Updates an item and definition into the database
*
* @param integer $id Glossary ID
* @param string $item Item
* @param string $definition Definition
*
* @return boolean
*/
public function updateGlossaryItem($id, $item, $definition)
{
$this->item = $this->config->getDb()->escape($item);
$this->definition = $this->config->getDb()->escape($definition);
$query = sprintf("\n UPDATE\n %sfaqglossary\n SET\n item = '%s',\n definition = '%s'\n WHERE\n id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), PMF_String::htmlspecialchars($this->item), PMF_String::htmlspecialchars($this->definition), (int) $id, $this->config->getLanguage()->getLanguage());
if ($this->config->getDb()->query($query)) {
return true;
}
return false;
}
示例5: PMF_Questionnaire_Data
<input type="checkbox" name="q[other][]" value="ruby" />Ruby / Ruby on Rails
<input type="checkbox" name="q[other][]" value="python" />Python
</fieldset>
<br />
<p class="center">Additional to your input we're going to submit some information about your system setup for statstic purpose.</p>
<p class="center">We are not storing any personal information. You can see the data by clicking <a href="#" onclick="show('configliste');return false;">here</a>.</p>
<div id="configliste" class="collapsed">
<a href="#" onclick="hide('configliste'); return false;">hide again</a>
<dl>
<?php
$q = new PMF_Questionnaire_Data($configs);
$options = $q->get();
array_walk($options, 'data_printer');
echo '</dl><input type="hidden" name="systemdata" value="' . PMF_String::htmlspecialchars(serialize($q->get()), ENT_QUOTES) . '" />';
?>
</div>
<p class="center"><input type="submit" value="Click here to submit the data and fnish the installation process" /></p>
</form>
<div id="questionnaireThanks" style="display:none;">
<p class="center"><b>Thank you for giving your feedback!</b></p>
<p class="center">You can visit <a href="../index.php">your version of phpMyFAQ</a> or</p>
<p class="center">login into your <a href="../admin/index.php">admin section</a>.</p>
</div>
<br />
<?php
// Remove 'scripts' folder: no need of prompt anything to the user
if (file_exists(PMF_ROOT_DIR . "/scripts") && is_dir(PMF_ROOT_DIR . "/scripts")) {
@rmdir(PMF_ROOT_DIR . "/scripts");
}
示例6: header
if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/solution_id_' . $inputSearchTerm . '.html');
} else {
header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/index.php?solution_id=' . $inputSearchTerm);
}
exit;
}
$category->buildTree();
$mostPopularSearchData = $faqSearch->getMostPopularSearches($faqconfig->get('search.numberSearchTerms'));
// Set base URL scheme
if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
$baseUrl = sprintf("%ssearch.html?search=%s&seite=%d%s&searchcategory=%d", PMF_Link::getSystemRelativeUri('index.php'), urlencode($inputSearchTerm), $page, $languages, $inputCategory);
} else {
$baseUrl = sprintf('%s?%saction=search&search=%s&seite=%d%s&searchcategory=%d', PMF_Link::getSystemRelativeUri(), empty($sids) ? '' : '$sids&', urlencode($inputSearchTerm), $page, $languages, $inputCategory);
}
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => $faqSearchResult->getNumberOfResults(), 'perPage' => PMF_Configuration::getInstance()->get('records.numberOfRecordsPerPage'), 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG['msgNext'] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG['msgPrevious'] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$faqPagination = new PMF_Pagination($options);
$faqCategoryHelper = PMF_Helper_Category::getInstance();
$faqCategoryHelper->setCategory($category);
$faqSearchHelper = PMF_Helper_Search::getInstance();
$faqSearchHelper->setSearchterm($inputSearchTerm);
$faqSearchHelper->setCategory($category);
$faqSearchHelper->setPagination($faqPagination);
$faqSearchHelper->setPlurals($plr);
$faqSearchHelper->setSessionId($sids);
if ('' == $searchResult && !is_null($inputSearchTerm)) {
$searchResult = $faqSearchHelper->renderSearchResult($faqSearchResult, $page);
}
$tpl->processTemplate('writeContent', array('msgAdvancedSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgAdvancedSearch'], 'msgSearch' => $PMF_LANG['msgSearch'], 'searchString' => PMF_String::htmlspecialchars($inputSearchTerm, ENT_QUOTES, 'utf-8'), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $faqCategoryHelper->renderCategoryOptions($inputCategory), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $searchResult, 'openSearchLink' => $faqSearchHelper->renderOpenSearchLink(), 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => $faqSearchHelper->renderMostPopularSearches($mostPopularSearchData)));
$tpl->includeTemplate('writeContent', 'index');
示例7: unset
$result = $mail->send();
unset($mail);
$message = array('success' => $PMF_LANG['msgMailContact']);
} else {
$message = array('error' => $PMF_LANG['err_sendMail']);
}
break;
// Send mails to friends
// Send mails to friends
case 'sendtofriends':
$name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
$attached = PMF_Filter::filterInput(INPUT_POST, 'message', FILTER_SANITIZE_STRIPPED);
$mailto = PMF_Filter::filterInputArray(INPUT_POST, array('mailto' => array('filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_NULL_ON_FAILURE)));
if (!is_null($name) && !empty($name) && !is_null($email) && !empty($email) && is_array($mailto) && !empty($mailto['mailto'][0]) && checkBannedWord(PMF_String::htmlspecialchars($attached))) {
foreach ($mailto['mailto'] as $recipient) {
$recipient = trim(strip_tags($recipient));
if (!empty($recipient)) {
$mail = new PMF_Mail();
$mail->setReplyTo($email, $name);
$mail->addTo($recipient);
$mail->subject = $PMF_LANG["msgS2FMailSubject"] . $name;
$mail->message = sprintf("%s\r\n\r\n%s\r\n%s\r\n\r\n%s", $faqconfig->get('main.send2friendText'), $PMF_LANG['msgS2FText2'], $link, $attached);
// Send the email
$result = $mail->send();
unset($mail);
usleep(250);
}
}
$message = array('success' => $PMF_LANG['msgS2FThx']);
示例8: header
* @link http://www.phpmyfaq.de
* @since 2002-09-16
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
$faqsession->userTracking('sendmail_send2friend', 0);
$captcha = new PMF_Captcha($sids);
$name = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$mailfrom = PMF_Filter::filterInput(INPUT_POST, 'mailfrom', FILTER_VALIDATE_EMAIL);
$mailto = PMF_Filter::filterInputArray(INPUT_POST, array('mailto' => array('filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_NULL_ON_FAILURE)));
$link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
$attached = PMF_Filter::filterInput(INPUT_POST, 'zusatz', FILTER_SANITIZE_STRIPPED);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
if (!is_null($name) && !is_null($mailfrom) && is_array($mailto) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($attached)) && $captcha->checkCaptchaCode($code)) {
// Backward compatibility: extract article info from the link, no template change required
$cat = $id = $artlang = null;
preg_match('`index\\.php\\?action=artikel&cat=(?<cat>[\\d]+)&id=(?<id>[\\d]+)&artlang=(?<artlang>[^$]+)$`', $link, $matches);
if (isset($matches['cat'])) {
$cat = (int) $matches['cat'];
}
if (isset($matches['id'])) {
$id = (int) $matches['id'];
}
if (isset($matches['artlang'])) {
$artlang = $matches['artlang'];
}
// Sanity check
if (is_null($cat) || is_null($id) || is_null($artlang)) {
header('HTTP/1.1 403 Forbidden');
示例9: searchEngine
$record_ids = $tagging->getRecordsByTagId($inputTag);
$printResult = $faq->showAllRecordsByIds($record_ids);
}
//
// Handle the full text search stuff
//
if (!is_null($inputSearchTerm) || !is_null($search)) {
if (!is_null($inputSearchTerm)) {
$inputSearchTerm = $db->escapeString(strip_tags($inputSearchTerm));
}
if (!is_null($search)) {
$inputSearchTerm = $db->escapeString(strip_tags($search));
}
$printResult = searchEngine($inputSearchTerm, $inputCategory, $allLanguages);
$inputSearchTerm = stripslashes($inputSearchTerm);
$faqsearch->logSearchTerm($inputSearchTerm);
}
// Change a little bit the $searchCategory value;
$inputCategory = '%' == $inputCategory ? 0 : $inputCategory;
$faqsession->userTracking('fulltext_search', $inputSearchTerm);
$openSearchLink = sprintf('<a class="searchplugin" href="#" onclick="window.external.AddSearchProvider(\'%s/opensearch.php\');">%s</a>', PMF_Link::getSystemUri('/index.php'), $PMF_LANG['opensearch_plugin_install']);
$mostPopularSearches = '';
$mostPopularSearchData = $faqsearch->getMostPopularSearches($faqconfig->get('main.numberSearchTerms'));
foreach ($mostPopularSearchData as $searchItem) {
if (PMF_String::strlen($searchItem['searchterm']) > 0) {
$mostPopularSearches .= sprintf('<li><a href="?search=%s&submit=Search&action=search">%s</a> (%dx)</li>', urlencode($searchItem['searchterm']), $searchItem['searchterm'], $searchItem['number']);
}
}
$categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
$tpl->processTemplate('writeContent', array('msgSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgSearch'], 'searchString' => PMF_String::htmlspecialchars($inputSearchTerm, ENT_QUOTES, 'utf-8'), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $categoryLayout->renderOptions(array($inputCategory)), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $printResult, 'openSearchLink' => $openSearchLink, 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => '<ul class="phpmyfaq_ul">' . $mostPopularSearches . '</ul>'));
$tpl->includeTemplate('writeContent', 'index');
示例10: PMF_Search
$retval = $mail->send();
}
return $retval;
}
if (!is_null($username) && !empty($usermail) && !empty($content) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($content)) && $captcha->checkCaptchaCode($code)) {
$pmf_sw = PMF_Stopwords::getInstance();
$search_stuff = $pmf_sw->clean($content);
$search = new PMF_Search($db, $Language);
$search_result = array();
$counter = 0;
foreach ($search_stuff as $word) {
$tmp = $search->search($word);
foreach ($tmp as $foundItem) {
if (!isset($foundItem->id, $search_result[$foundItem->category_id])) {
$counter++;
$foundItem->searchterm = PMF_String::htmlspecialchars(stripslashes($word), ENT_QUOTES, 'utf-8');
$search_result[$foundItem->category_id][$foundItem->id] = $foundItem;
}
}
}
if ($search_result) {
$faqUser = new PMF_Faq_User();
$faqGroup = new PMF_Faq_Group();
$search_result_html = '<p>' . $plr->GetMsg('plmsgSearchAmount', count($search_result)) . "</p>\n";
$counter = 0;
foreach ($search_result as $cat_id => $cat_contents) {
$tmp_result_html = '';
foreach ($cat_contents as $cat_content_item) {
$b_permission = false;
//Groups Permission Check
if ($faqconfig->get('main.permLevel') == 'medium') {
示例11: isset
$groupPermission = $faq->getPermission('group', $faqData['id']);
if (count($groupPermission) == 0 || $groupPermission[0] == -1) {
$allGroups = true;
$restrictedGroups = false;
$groupPermission[0] = -1;
} else {
$allGroups = false;
$restrictedGroups = true;
}
// Set data for forms
$faqData['title'] = isset($faqData['title']) ? PMF_String::htmlspecialchars($faqData['title']) : '';
$faqData['content'] = isset($faqData['content']) ? trim(PMF_String::htmlentities($faqData['content'])) : '';
$faqData['tags'] = isset($faqData['tags']) ? PMF_String::htmlspecialchars($faqData['tags']) : '';
$faqData['keywords'] = isset($faqData['keywords']) ? PMF_String::htmlspecialchars($faqData['keywords']) : '';
$faqData['author'] = isset($faqData['author']) ? PMF_String::htmlspecialchars($faqData['author']) : $user->getUserData('display_name');
$faqData['email'] = isset($faqData['email']) ? PMF_String::htmlspecialchars($faqData['email']) : $user->getUserData('email');
$faqData['isoDate'] = isset($faqData['date']) ? $faqData['date'] : date('Y-m-d H:i');
$faqData['date'] = isset($faqData['date']) ? $date->format($faqData['date']) : $date->format(date('Y-m-d H:i'));
$faqData['changed'] = isset($faqData['changed']) ? $faqData['changed'] : '';
if (isset($faqData['comment']) && $faqData['comment'] == 'y') {
$faqData['comment'] = ' checked="checked"';
} elseif ($faqConfig->get('records.defaultAllowComments')) {
$faqData['comment'] = ' checked="checked"';
} else {
$faqData['comment'] = '';
}
// Start header
?>
<header>
<h2>
<?php
示例12: getRecordsFromLetter
/**
* Returns all records from the current first letter
*
* @param string $letter Letter
* @return array
* @since 2007-03-30
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
*/
public function getRecordsFromLetter($letter = 'A')
{
global $sids, $PMF_LANG;
if ($this->groupSupport) {
$permPart = sprintf("( fdg.group_id IN (%s)\n OR\n (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
} else {
$permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
}
$letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
$writeMap = '';
switch ($this->type) {
case 'db2':
case 'sqlite':
$query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTR(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
break;
default:
$query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTRING(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
break;
}
$result = $this->db->query($query);
$oldId = 0;
while ($row = $this->db->fetch_object($result)) {
if ($oldId != $row->id) {
$title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
$url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $title;
$oLink->tooltip = $title;
$writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
$writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
}
$oldId = $row->id;
}
$writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
return $writeMap;
}
示例13: trim
$mquery[] = trim(PMF_String::substr($dat, 0, -1));
}
}
$k = 0;
$g = 0;
printf("<p>%s</p>\n", $PMF_LANG['ad_csv_process']);
$num = count($mquery);
$kg = '';
for ($i = 0; $i < $num; $i++) {
$mquery[$i] = alignTablePrefix($mquery[$i], $table_prefix, SQLPREFIX);
$kg = $db->query($mquery[$i]);
if (!$kg) {
printf('<div style="font-size: 9px;"><strong>Query</strong>: "%s" <span style="color: red;">failed (Reason: %s)</span></div>%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), $db->error(), "\n");
$k++;
} else {
printf('<!-- <div style="font-size: 9px;"><strong>Query</strong>: "%s" <span style="color: green;">okay</span></div> -->%s', PMF_String::htmlspecialchars($mquery[$i], ENT_QUOTES, 'utf-8'), "\n");
$g++;
}
}
printf('<p class="success">%d %s %d %s</p>', $g, $PMF_LANG['ad_csv_of'], $num, $PMF_LANG['ad_csv_suc']);
}
} else {
switch ($_FILES['userfile']['error']) {
case 1:
$errorMessage = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case 2:
$errorMessage = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
break;
case 3:
$errorMessage = 'The uploaded file was only partially uploaded.';
示例14: printHTMLTagsCloud
/**
* Returns the HTML for the Tags Cloud
*
* @return string
*/
public function printHTMLTagsCloud()
{
global $sids;
$html = '';
$tags = array();
// Limit the result set (see: PMF_TAGS_CLOUD_RESULT_SET_SIZE)
// for avoiding an 'heavy' load during the evaluation
// of the number of records for each tag
$tagList = $this->getAllTags('', true);
foreach ($tagList as $tagId => $tagName) {
$totFaqByTag = count($this->getRecordsByTagName($tagName));
if ($totFaqByTag > 0) {
$tags[$tagName]['id'] = $tagId;
$tags[$tagName]['name'] = $tagName;
$tags[$tagName]['count'] = $totFaqByTag;
}
}
$min = 0;
$max = 0;
foreach ($tags as $tag) {
if ($min > $tag['count']) {
$min = $tag['count'];
}
if ($max < $tag['count']) {
$max = $tag['count'];
}
}
$CSSRelevanceLevels = 5;
$CSSRelevanceMinLevel = 1;
$CSSRelevanceMaxLevel = $CSSRelevanceLevels - $CSSRelevanceMinLevel;
$CSSRelevanceLevel = 3;
$html = '<div class="tagscloud">';
$i = 0;
foreach ($tags as $tag) {
$i++;
if ($max - $min > 0) {
$CSSRelevanceLevel = (int) ($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min));
}
$class = 'relevance' . $CSSRelevanceLevel;
$html .= '<span class="' . $class . '">';
$title = PMF_String::htmlspecialchars($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
$url = sprintf($sids . 'action=search&tagging_id=%d', $tag['id']);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $tag['name'];
$oLink->text = $tag['name'];
$oLink->tooltip = $title;
$html .= $oLink->toHtmlAnchor();
$html .= (count($tags) == $i ? '' : ' ') . '</span>';
}
$html .= '</div>';
return $html;
}
示例15: _generateDocBookExport2
/**
* Wrapper for the PMF_Export_Docbook class
*
*/
private static function _generateDocBookExport2()
{
// TODO: check/refine/improve/fix docbook.php and add toString method before recoding the method in order to use faq and news classes.
global $PMF_CONF, $PMF_LANG;
// XML DocBook export
$parentID = 0;
$rubrik = 0;
$sql = '';
$selectString = '';
$db = PMF_Db::getInstance();
$export = new PMF_Export_Docbook();
$export->delete_file();
// Set the FAQ title
$faqtitel = PMF_String::htmlspecialchars($PMF_CONF['main.titleFAQ']);
// Print the title of the FAQ
$export->xmlContent = '<?xml version="1.0" encoding="' . $PMF_LANG['metaCharset'] . '"?>' . '<book lang="en">' . '<title>phpMyFAQ</title>' . '<bookinfo>' . '<title>' . $faqtitel . '</title>' . '</bookinfo>';
// include the news
$result = $db->query("SELECT id, header, artikel, datum FROM " . SQLPREFIX . "faqnews");
// Write XML file
$export->write_file();
// Transformation of the news entries
if ($db->num_rows($result) > 0) {
$export->xmlContent .= '<part><title>News</title>';
while ($row = $db->fetch_object($result)) {
$datum = $export->aktually_date($row->datum);
$export->xmlContent .= '<article>' . '<title>' . $row->header . '</title>' . '<para>' . wordwrap($datum, 20) . '</para>';
$replacedString = ltrim(str_replace('<br />', '', $row->artikel));
$export->TableImageText($replacedString);
$export->xmlContent .= '</article>';
}
$export->xmlContent .= '</part>';
}
$export->write_file();
// Transformation of the articles
$export->xmlContent .= '<part>' . '<title>Artikel</title>' . '<preface>' . '<title>Rubriken</title>';
// Selection of the categories
$export->recursive_category($parentID);
$export->xmlContent .= '</preface>' . '</part>' . '</book>';
$export->write_file();
}