本文整理汇总了PHP中PMF_Utils::makeShorterText方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Utils::makeShorterText方法的具体用法?PHP PMF_Utils::makeShorterText怎么用?PHP PMF_Utils::makeShorterText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Utils
的用法示例。
在下文中一共展示了PMF_Utils::makeShorterText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$metaDescription = $faqconfig->get('main.metaDescription');
}
//
// found a solution ID?
//
$solution_id = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
if (!is_null($solution_id)) {
$title = ' - powered by phpMyFAQ ' . $faqconfig->get('main.currentVersion');
$keywords = '';
$faqData = $faq->getIdFromSolutionId($solution_id);
if (is_array($faqData)) {
$id = $faqData['id'];
$lang = $faqData['lang'];
$title = ' - ' . $faq->getRecordTitle($id);
$keywords = ',' . $faq->getRecordKeywords($id);
$metaDescription = PMF_Utils::makeShorterText(strip_tags($faqData['content']), 12);
}
}
//
// Handle the Tagging ID
//
$tag_id = PMF_Filter::filterInput(INPUT_GET, 'tagging_id', FILTER_VALIDATE_INT);
if (!is_null($tag_id)) {
$title = ' - ' . $oTag->getTagNameById($tag_id);
$keywords = '';
}
//
// Handle the SiteMap
//
$letter = PMF_Filter::filterInput(INPUT_GET, 'letter', FILTER_SANITIZE_STRIPPED);
if (!is_null($letter) && 1 == PMF_String::strlen($letter)) {
示例2: round
?>
</td>
<td><a href="../index.php?action=artikel&cat=<?php
print $data['category_id'];
?>
&id=<?php
print $data['id'];
?>
&artlang=<?php
print $data['lang'];
?>
" title="<?php
print PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8');
?>
"><?php
print PMF_Utils::makeShorterText(PMF_htmlentities(trim($data['question']), ENT_QUOTES, 'utf-8'), 14);
?>
</a></td>
<td><?php
print $data['usr'];
?>
</td>
<td style="width: 50px;"><img src="stat.bar.php?num=<?php
print $data['num'];
?>
" border="0" alt="<?php
print round($data['num'] * 20);
?>
%" width="50" height="15" title="<?php
print round($data['num'] * 20);
?>
示例3: switch
// Handle actions
switch ($action) {
case 'getVersion':
$result = array('version' => $faqconfig->get('main.currentVersion'));
break;
case 'getApiVersion':
$result = array('apiVersion' => (int) $faqconfig->get('main.currentApiVersion'));
break;
case 'search':
$search = new PMF_Search($db, $Language);
$searchString = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED);
$result = $search->search($searchString, false);
$url = $faqconfig->get('main.referenceURL') . '/index.php?action=artikel&cat=%d&id=%d&artlang=%s';
foreach ($result as &$data) {
$data->answer = html_entity_decode(strip_tags($data->answer), ENT_COMPAT, 'utf-8');
$data->answer = PMF_Utils::makeShorterText($data->answer, 12);
$data->link = sprintf($url, $data->category_id, $data->id, $data->lang);
}
break;
case 'getCategories':
$category = new PMF_Category($current_user, $current_groups, true);
$result = $category->categories;
break;
case 'getFaqs':
$faq = new PMF_Faq($current_user, $current_groups);
$result = $faq->getAllRecordPerCategory($categoryId);
break;
case 'getFaq':
$faq = new PMF_Faq($current_user, $current_groups);
$faq->getRecord($recordId);
$result = $faq->faqRecord;
示例4: count
$faq->getAllRecords();
$_records = $faq->faqRecords;
$tot = count($_records);
$end = microtime(true);
$output .= ' #' . $tot . ', done in ' . round($end - $start, 4) . ' sec.' . ($isRequestedByWebLocalhost ? '' : "\n");
$output .= $isRequestedByWebLocalhost ? '' : "\n";
if ($isRequestedByWebLocalhost) {
echo '<pre>';
}
$output = $output . "\n";
echo $output;
$i = 0;
foreach ($_records as $_r) {
$i++;
$output = '';
$output .= sprintf('%0' . strlen((string) $tot) . 'd', $i) . '/' . $tot . '. Checking ' . $_r['solution_id'] . ' (' . PMF_Utils::makeShorterText(strip_tags($_r['title']), 8) . '):';
$start = microtime(true);
if ($oLnk->getEntryState($_r['id'], $_r['lang'], true) === true) {
$output .= $oLnk->verifyArticleURL($_r['content'], $_r['id'], $_r['lang'], true);
}
$end = microtime(true);
$output .= ' done in ' . round($end - $start, 4) . ' sec.';
$output .= $isRequestedByWebLocalhost ? '' : "\n";
if ($isRequestedByWebLocalhost) {
$output = $output . "\n";
}
echo $output;
}
$output = '';
$totEnd = microtime(true);
$output .= $isRequestedByWebLocalhost ? '' : "\n";
示例5: html_entity_decode
$rss->startElement('channel');
$rss->writeElement('title', $faqConfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgOpenQuestions']);
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription')));
$rss->writeElement('link', $faqConfig->get('main.referenceURL'));
$rss->startElementNS('atom', 'link', 'http://www.w3.org/2005/Atom');
$rss->writeAttribute('rel', 'self');
$rss->writeAttribute('type', 'application/rss+xml');
$rss->writeAttribute('href', $faqConfig->get('main.referenceURL') . 'feed/openquestions/rss.php');
$rss->endElement();
if ($num > 0) {
$counter = 0;
foreach ($rssData as $item) {
if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
$counter++;
$rss->startElement('item');
$rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['question'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['username'] . ")");
$rss->startElement('description');
$rss->writeCdata($item['question']);
$rss->endElement();
$rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER['SCRIPT_NAME']) . "?action=open#openq_" . $item['id']);
$rss->writeElement('guid', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER['SCRIPT_NAME']) . "?action=open#openq_" . $item['id']);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['created'], true));
$rss->endElement();
}
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
$headers = array('Content-Type: application/rss+xml', 'Content-Length: ' . strlen($rssData));
$http = new PMF_Helper_Http();
示例6: getStickyRecords
/**
* Prepares and returns the sticky records for the frontend
*
* @return array
*/
public function getStickyRecords()
{
$result = $this->getStickyRecordsData();
$output = array();
if (count($result) > 0) {
foreach ($result as $row) {
$output[] = array('title' => PMF_Utils::makeShorterText($row['thema'], 8), 'url' => $row['url']);
}
} else {
$output['error'] = sprintf('<li>%s</li>', $this->pmf_lang['err_noTopTen']);
}
if (!isset($output['error'])) {
$html = '';
foreach ($output as $entry) {
$html .= sprintf('<li><a href="%s">%s</a></li>', $entry['url'], $entry['title']);
}
$output['html'] = $html;
}
return $output;
}
示例7: str_replace
$metaDescription = $faqConfig->get('main.metaDescription');
}
//
// found a solution ID?
//
$solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
if (!is_null($solutionId)) {
$title = ' - powered by phpMyFAQ ' . $faqConfig->get('main.currentVersion');
$keywords = '';
$faqData = $faq->getIdFromSolutionId($solutionId);
if (is_array($faqData)) {
$id = $faqData['id'];
$lang = $faqData['lang'];
$title = ' - ' . $faq->getRecordTitle($id);
$keywords = ',' . $faq->getRecordKeywords($id);
$metaDescription = str_replace('"', '', PMF_Utils::makeShorterText(strip_tags($faqData['content']), 12));
}
}
//
// Handle the Tagging ID
//
$tag_id = PMF_Filter::filterInput(INPUT_GET, 'tagging_id', FILTER_VALIDATE_INT);
if (!is_null($tag_id)) {
$title = ' - ' . $oTag->getTagNameById($tag_id);
$keywords = '';
}
//
// Handle the SiteMap
//
$letter = PMF_Filter::filterInput(INPUT_GET, 'letter', FILTER_SANITIZE_STRIPPED);
if (!is_null($letter) && 1 == PMF_String::strlen($letter)) {
示例8: Header
/**
* The header of the PDF file
*
* @return void
*/
public function Header()
{
$title = $this->category->name . ': ' . $this->question;
$currentTextColor = $this->TextColor;
$this->SetTextColor(0, 0, 0);
$this->SetFont('arialunicid0', 'B', 18);
$this->MultiCell(0, 9, $title, 0, 'C', 0);
if ($this->enableBookmarks) {
$this->Bookmark(PMF_Utils::makeShorterText($this->question, 5));
}
$this->TextColor = $currentTextColor;
$this->SetMargins(PDF_MARGIN_LEFT, $this->getLastH() + 5, PDF_MARGIN_RIGHT);
}
示例9: foreach
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php'));
if ($num > 0) {
$i = 0;
foreach ($rssData as $item) {
$i++;
// Get the url
$link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']);
if (PMF_RSS_USE_SEO) {
if (isset($item['thema'])) {
$oLink = new PMF_Link($link);
$oLink->itemTitle = html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8');
$link = html_entity_decode($oLink->toString(), ENT_COMPAT, 'UTF-8');
}
}
$rss->startElement('item');
$rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['thema'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")");
$rss->startElement('description');
$rss->writeCdata("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")");
$rss->endElement();
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php') . $link);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
$rss->endElement();
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
示例10: round
?>
</td>
<td><a href="../index.php?action=artikel&cat=<?php
print $data['category_id'];
?>
&id=<?php
print $data['id'];
?>
&artlang=<?php
print $data['lang'];
?>
" title="<?php
print PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8');
?>
"><?php
print PMF_Utils::makeShorterText(PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8'), 14);
?>
</a></td>
<td><?php
print $data['usr'];
?>
</td>
<td style="width: 50px;"><img src="stat.bar.php?num=<?php
print $data['num'];
?>
" border="0" alt="<?php
print round($data['num'] * 20);
?>
%" width="50" height="15" title="<?php
print round($data['num'] * 20);
?>
示例11: html_entity_decode
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgOpenQuestions']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php'));
if ($num > 0) {
$counter = 0;
foreach ($rssData as $item) {
if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
$counter++;
$rss->startElement('item');
$rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item->question), 8) . " (" . $item->username . ")");
$rss->startElement('description');
$rss->writeCdata($item->question);
$rss->endElement();
$rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item->id);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item->date, true));
$rss->endElement();
}
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
示例12: XMLWriter
$rss = new XMLWriter();
$rss->openMemory();
$rss->startDocument('1.0', $PMF_LANG['metaCharset']);
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', utf8_encode($PMF_CONF['main.titleFAQ']) . ' - ' . utf8_encode($PMF_LANG['msgOpenQuestions']));
$rss->writeElement('description', utf8_encode($PMF_CONF['main.metaDescription']));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php'));
if ($num > 0) {
$counter = 0;
foreach ($rssData as $item) {
if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
$counter++;
$rss->startElement('item');
$rss->writeElement('title', utf8_encode(PMF_Utils::makeShorterText($item['question'], 8) . " (" . $item['user'] . ")"));
$rss->startElement('description');
$rss->writeCdata(utf8_encode($item['question']));
$rss->endElement();
$rss->writeElement('link', utf8_encode((isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item['id']));
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['date'], false));
$rss->endElement();
}
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
示例13: foreach
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php'));
if ($num > 0) {
$i = 0;
foreach ($rssData as $item) {
$i++;
// Get the url
$link = str_replace($_SERVER['PHP_SELF'], '/index.php', $item['url']);
if (PMF_RSS_USE_SEO) {
if (isset($item['thema'])) {
$oL = new PMF_Link($link);
$oL->itemTitle = $item['thema'];
$link = $oL->toString();
}
}
$rss->startElement('item');
$rss->writeElement('title', utf8_encode(PMF_Utils::makeShorterText($item['thema'], 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
$rss->startElement('description');
$rss->writeCdata(utf8_encode("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
$rss->endElement();
$rss->writeElement('link', utf8_encode(PMF_Link::getSystemUri('/feed/topten/rss.php') . $link));
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
$rss->endElement();
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
示例14: getStickyRecords
/**
* Prepares and returns the sticky records for the frontend
*
* @return array
*/
public function getStickyRecords()
{
$result = $this->getStickyRecordsData();
$output = array();
if (count($result) > 0) {
foreach ($result as $row) {
$shortTitle = PMF_Utils::makeShorterText($row['thema'], 8);
$output['title'][] = $shortTitle;
$output['url'][] = $row['url'];
}
} else {
$output['error'] = $this->pmf_lang['err_noTopTen'];
}
return $output;
}
示例15: Header
/**
* The header of the PDF file
*
* @return void
*/
public function Header()
{
$title = $this->categories[$this->category]['name'] . ': ' . $this->thema;
$currentTextColor = $this->TextColor;
$this->SetTextColor(0, 0, 0);
$this->SetFont('dejavusans', 'B', 18);
$this->MultiCell(0, 9, $title, 0, 'C', 0);
if ($this->enableBookmarks) {
$this->Bookmark(PMF_Utils::makeShorterText($this->thema, 5));
}
$this->TextColor = $currentTextColor;
$this->SetMargins(PDF_MARGIN_LEFT, $this->getLastH() + 5, PDF_MARGIN_RIGHT);
}