本文整理汇总了PHP中PMF_Link::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Link::toString方法的具体用法?PHP PMF_Link::toString怎么用?PHP PMF_Link::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Link
的用法示例。
在下文中一共展示了PMF_Link::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildSitemapNode
// 1st entry: the faq server itself
$sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php'), PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, PMF_SITEMAP_GOOGLE_PRIORITY_MAX);
// nth entry: each faq
foreach ($items as $item) {
$priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT;
if ($visitsMax - $visitMin > 0) {
$priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + ($item['visits'] - $visitMin) / ($visitsMax - $visitMin)));
}
// a. We use plain PMF urls w/o any SEO schema
$link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']);
// b. We use SEO PMF urls
if (PMF_SITEMAP_GOOGLE_USE_SEO) {
if (isset($item['thema'])) {
$oL = new PMF_Link($link);
$oL->itemTitle = $item['thema'];
$link = $oL->toString();
}
}
$sitemap .= buildSitemapNode(PMF_Link::getSystemUri('/sitemap.google.php') . $link, PMF_Date::createISO8601Date($item['date']), PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY, $priority);
}
$sitemap .= '</urlset>';
$getgezip = PMF_Filter::filterInput(INPUT_GET, PMF_SITEMAP_GOOGLE_GET_GZIP, FILTER_VALIDATE_INT);
if (!is_null($getgezip) && 1 == $getgezip) {
if (function_exists('gzencode')) {
$sitemapGz = gzencode($sitemap);
header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="' . PMF_SITEMAP_GOOGLE_FILENAME_GZ . '"');
header('Content-Length: ' . strlen($sitemapGz));
print $sitemapGz;
} else {
PMF_Helper_Http::getInstance()->printHTTPStatus404();
示例2: sprintf
if ($faq->faqRecord['email'] != '') {
$emailTo = $faq->faqRecord['email'];
}
$_faqUrl = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, 0, $faq->faqRecord['id'], $faq->faqRecord['lang']);
$oLink = new PMF_Link(PMF_Link::getSystemUri() . '?' . $_faqUrl);
$oLink->itemTitle = $faq->faqRecord['title'];
$urlToContent = $oLink->toString();
} else {
$oNews = new PMF_News();
$news = $oNews->getNewsEntry($id);
if ($news['authorEmail'] != '') {
$emailTo = $news['authorEmail'];
}
$oLink = new PMF_Link(PMF_Link::getSystemUri() . '?action=news&newsid=' . $news['id'] . '&newslang=' . $news['lang']);
$oLink->itemTitle = $news['header'];
$urlToContent = $oLink->toString();
}
$commentMail = 'User: ' . $commentData['username'] . ', mailto:' . $commentData['usermail'] . "\n" . 'New comment posted on: ' . $urlToContent . "\n\n" . wordwrap($comment, 72);
$mail = new PMF_Mail();
$mail->unsetFrom();
$mail->setFrom($commentData['usermail']);
$mail->addTo($emailTo);
// Let the category owner get a copy of the message
if ($emailTo != $faqconfig->get('main.administrationMail')) {
$mail->addCc($faqconfig->get('main.administrationMail'));
}
$mail->subject = '%sitename%';
$mail->message = strip_tags($commentMail);
$result = $mail->send();
unset($mail);
$message = $PMF_LANG['msgCommentThanks'];
示例3: Footer
/**
* The footer of the PDF file
*
* @return void
*/
public function Footer()
{
global $PMF_LANG;
$faqconfig = PMF_Configuration::getInstance();
$currentTextColor = $this->TextColor;
$this->SetTextColor(0, 0, 0);
$this->SetY(-25);
$this->SetFont('dejavusans', '', 10);
$this->Cell(0, 10, $PMF_LANG['ad_gen_page'] . ' ' . $this->PageNo() . ' / ' . $this->getAliasNbPages(), 0, 0, 'C');
$this->SetY(-20);
$this->SetFont('dejavusans', 'B', 8);
$this->Cell(0, 10, "(c) " . date("Y") . " " . $faqconfig->get('main.metaPublisher') . " <" . $faqconfig->get('main.administrationMail') . ">", 0, 1, "C");
if ($this->enableBookmarks == false) {
$this->SetY(-15);
$this->SetFont('dejavusans', '', 8);
$baseUrl = '/index.php';
if (is_array($this->faq) && !empty($this->faq)) {
$baseUrl .= '?action=artikel&cat=' . $this->categories[$this->category]['id'];
$baseUrl .= '&id=' . $this->faq['id'];
$baseUrl .= '&artlang=' . $this->faq['lang'];
}
$url = PMF_Link::getSystemScheme() . $_SERVER['HTTP_HOST'] . $baseUrl;
$urlObj = new PMF_Link($url);
$urlObj->itemTitle = $this->thema;
$_url = str_replace('&', '&', $urlObj->toString());
$this->Cell(0, 10, 'URL: ' . $_url, 0, 1, 'C', 0, $_url);
}
$this->TextColor = $currentTextColor;
}
示例4: foreach
$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') . ' - ');
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription')));
$rss->writeElement('link', $faqConfig->get('main.referenceURL'));
if (is_array($records)) {
foreach ($records as $item) {
$link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['record_link']);
if (PMF_RSS_USE_SEO) {
if (isset($item['record_title'])) {
$oLink = new PMF_Link($link, $faqConfig);
$oLink->itemTitle = $item['record_title'];
$link = $oLink->toString();
}
}
$rss->startElement('item');
$rss->writeElement('title', html_entity_decode($item['record_title'] . ' (' . $item['visits'] . ' ' . $PMF_LANG['msgViews'] . ')', ENT_COMPAT, 'UTF-8'));
$rss->startElement('description');
$rss->writeCdata($item['record_preview']);
$rss->endElement();
$rss->writeElement('link', $faqConfig->get('main.referenceURL') . $link);
$rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['record_date'], true));
$rss->endElement();
}
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
示例5: foreach
if (isset($linkArray['href'])) {
foreach (array_unique($linkArray['href']) as $_url) {
if (!(strpos($_url, 'index.php?action=artikel') === false)) {
// Get the Faq link title
$matches = array();
preg_match('/id=([\\d]+)/ism', $_url, $matches);
$_id = $matches[1];
$_title = $faq->getRecordTitle($_id, false);
$_link = substr($_url, 9);
// Move the link to XHTML
if (strpos($_url, '&') === false) {
$_link = str_replace('&', '&', $_link);
}
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $_link);
$oLink->itemTitle = $oLink->tooltip = $_title;
$newFaqPath = $oLink->toString();
$fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
}
}
}
$content = $fixedContent;
// Check for the languages for a faq
$arrLanguage = PMF_Utils::languageAvailable($record_id);
$switchLanguage = '';
$check4Lang = '';
$num = count($arrLanguage);
if ($num > 1) {
foreach ($arrLanguage as $language) {
$check4Lang .= "<option value=\"" . $language . "\"";
$check4Lang .= $lang == $language ? ' selected="selected"' : '';
$check4Lang .= ">" . $languageCodes[strtoupper($language)] . "</option>\n";
示例6: getNews
/**
* Function for generating the HTML fro the current news
*
* @param boolean $showArchive Show archived news
* @param boolean $active Show active news
*
* @return string
*/
public function getNews($showArchive = false, $active = true)
{
$output = '';
$news = $this->getLatestData($showArchive, $active);
foreach ($news as $item) {
$url = sprintf('%s?action=news&newsid=%d&newslang=%s', PMF_Link::getSystemRelativeUri(), $item['id'], $item['lang']);
$oLink = new PMF_Link($url);
if (isset($item['header'])) {
$oLink->itemTitle = $item['header'];
}
$output .= sprintf('<h3><a name="news_%d" href="%s">%s <img class="goNews" src="images/more.gif" width="11" height="11" alt="%s" /></a></h3><div class="block">%s', $item['id'], $oLink->toString(), $item['header'], $item['header'], $item['content']);
if (strlen($item['link']) > 1) {
$output .= sprintf('<br />%s <a href="%s" target="_%s">%s</a>', $this->pmf_lang['msgInfo'], $item['link'], $item['target'], $item['linkTitle']);
}
$output .= sprintf('</div><div class="date">%s</div>', PMF_Date::createIsoDate($item['date']));
}
return '' == $output ? $this->pmf_lang['msgNoNews'] : $output;
}
示例7: foreach
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgTopTen']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$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();
示例8: renderUrl
/**
* Render url for a given page
*
* @param string $url url
* @param integer $page page number
*
* @return string
*/
protected function renderUrl($url, $page)
{
$cleanedUrl = PMF_String::preg_replace(array('$&(amp;|)' . $this->pageParamName . '=(\\d+)$'), '', $url);
$url = sprintf('%s&%s=%d', $cleanedUrl, $this->pageParamName, $page);
$link = new PMF_Link($url);
$link->itemTitle = $this->seoName;
return $link->toString();
}
示例9: sprintf
?>
</div>
<!-- sidebar -->
<div class="well span3">
<!-- form actions -->
<fieldset>
<?php
if (0 !== $faqData['id'] && 'copyentry' !== $action) {
$url = sprintf('%sindex.php?action=artikel&cat=%s&id=%d&artlang=%s', $faqConfig->get('main.referenceURL'), $categories[0]['category_id'], $faqData['id'], $faqData['lang']);
$link = new PMF_Link($url, $faqConfig);
$link->itemTitle = $faqData['title'];
?>
<div class="control-group text-center">
<a class="btn btn-info" href="<?php
echo $link->toString();
?>
">
<?php
echo $PMF_LANG['msgSeeFAQinFrontend'];
?>
</a>
</div>
<?php
}
?>
<div class="control-group">
<label class="control-label" for="dateActualize"><?php
echo $PMF_LANG["ad_entry_date"];
?>
</label>
示例10: sprintf
// Get all data from the news record
$news = $oNews->getNewsEntry($news_id);
$content = $news['content'];
$header = $news['header'];
// Add Glossary entries
$oGlossary = new PMF_Glossary();
$content = $oGlossary->insertItemsIntoContent($content);
$header = $oGlossary->insertItemsIntoContent($header);
// Add information link if existing
if (strlen($news['link']) > 0) {
$content .= sprintf('</p><p>%s<a href="%s" target="%s">%s</a>', $PMF_LANG['msgInfo'], $news['link'], $news['target'], $news['linkTitle']);
}
// Show link to edit the news?
$editThisEntry = '';
if (isset($permission['editnews'])) {
$editThisEntry = sprintf('<a href="%sadmin/index.php?action=news&do=edit&id=%d">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $news_id, $PMF_LANG['ad_menu_news_edit']);
}
// Is the news item expired?
$expired = date('YmdHis') > $news['dateEnd'];
// Does the user have the right to add a comment?
if (!$news['active'] || !$news['allowComments'] || $expired) {
$commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
$oLink = new PMF_Link($_SERVER['SCRIPT_NAME'] . '?' . str_replace('&', '&', $_SERVER['QUERY_STRING']));
$oLink->itemTitle = $header;
$commentHref = $oLink->toString() . '#comment';
$commentMessage = sprintf('<a onclick="javascript:$(\'#comment\').show();" href="%s">%s</a>', $commentHref, $PMF_LANG['newsWriteComment']);
}
// Set the template variables
$tpl->processTemplate("writeContent", array('writeNewsHeader' => $writeNewsHeader, 'writeNewsRSS' => $writeNewsRSS, 'writeHeader' => $header, 'writeContent' => $content, 'writeDateMsg' => $news['active'] && !$expired ? $PMF_LANG['msgLastUpdateArticle'] . '<span id="newsLastUpd">' . $news['date'] . '</span>' : '', 'writeAuthor' => $news['active'] && !$expired ? $PMF_LANG['msgAuthor'] . ': ' . $news['authorName'] : '', 'editThisEntry' => $editThisEntry, 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['newsWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'newsId' => $news_id, 'newsLang' => $news['lang'], 'msgCommentHeader' => $PMF_LANG['msgCommentHeader'], 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgYourComment' => $PMF_LANG['msgYourComment'], 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('writecomment')), 'writeComments' => $comment->getComments($news_id, PMF_Comment::COMMENT_TYPE_NEWS)));
$tpl->includeTemplate('writeContent', 'index');
示例11: foreach
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgTopTen']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$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 = $item['thema'];
$link = html_entity_decode($oLink->toString());
}
}
$rss->startElement('item');
$rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['thema']), 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();
示例12: getStickyRecordsData
/**
* Returns the sticky records with URL and Title
*
* @return array
*/
private function getStickyRecordsData()
{
global $sids;
if ($this->groupSupport) {
$permPart = sprintf("AND\n ( 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("AND\n ( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
}
$now = date('YmdHis');
$query = sprintf("\n SELECT\n fd.id AS id,\n fd.lang AS lang,\n fd.thema AS thema,\n fcr.category_id AS category_id\n FROM\n %sfaqdata fd\n LEFT JOIN\n %sfaqcategoryrelations fcr\n ON\n fd.id = fcr.record_id\n AND\n fd.lang = fcr.record_lang\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.lang = '%s'\n AND \n fd.date_start <= '%s'\n AND \n fd.date_end >= '%s'\n AND \n fd.active = 'yes'\n AND \n fd.sticky = 1\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $this->language, $now, $now, $permPart);
$result = $this->db->query($query);
$sticky = array();
$data = array();
$oldId = 0;
while ($row = $this->db->fetch_object($result)) {
if ($oldId != $row->id) {
$data['thema'] = $row->thema;
$title = $row->thema;
$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->tooltip = $title;
$data['url'] = $oLink->toString();
$sticky[] = $data;
}
$oldId = $row->id;
}
return $sticky;
}
示例13: Footer
/**
* The footer of the PDF file
*
* @return void
*/
public function Footer()
{
global $PMF_LANG;
$faqconfig = PMF_Configuration::getInstance();
$footer = sprintf('(c) %d %s <%s> | %s', date('Y'), $faqconfig->get('main.metaPublisher'), $faqconfig->get('main.administrationMail'), PMF_Date::format(date('Y-m-d H:i')));
$currentTextColor = $this->TextColor;
$this->SetTextColor(0, 0, 0);
$this->SetY(-25);
$this->SetFont($this->currentFont, '', 10);
$this->Cell(0, 10, $PMF_LANG['ad_gen_page'] . ' ' . $this->getAliasNumPage() . ' / ' . $this->getAliasNbPages(), 0, 0, 'C');
$this->SetY(-20);
$this->SetFont($this->currentFont, 'B', 8);
$this->Cell(0, 10, $footer, 0, 1, "C");
if ($this->enableBookmarks == false) {
$this->SetY(-15);
$this->SetFont($this->currentFont, '', 8);
$baseUrl = 'index.php';
if (is_array($this->faq) && !empty($this->faq)) {
$baseUrl .= '?action=artikel&';
if (array_key_exists($this->category, $this->categories)) {
$baseUrl .= 'cat=' . $this->categories[$this->category]['id'];
} else {
$baseUrl .= 'cat=0';
}
$baseUrl .= '&id=' . $this->faq['id'];
$baseUrl .= '&artlang=' . $this->faq['lang'];
}
$url = PMF_Link::getSystemUri('pdf.php') . $baseUrl;
$urlObj = new PMF_Link($url);
$urlObj->itemTitle = $this->question;
$_url = str_replace('&', '&', $urlObj->toString());
$this->Cell(0, 10, 'URL: ' . $_url, 0, 1, 'C', 0, $_url);
}
$this->TextColor = $currentTextColor;
}
示例14: getShareOnTwitterLink
/**
* Returns the current "share on Twitter" URL
*
* @return string
*/
public function getShareOnTwitterLink()
{
$url = sprintf('%sindex.php?action=artikel&cat=%s&id=%d&artlang=%s', $this->_config->get('main.referenceURL'), $this->getCategoryId(), $this->getFaqId(), $this->getLanguage());
$link = new PMF_Link($url, $this->_config);
$link->itemTitle = $this->question;
return sprintf('https://twitter.com/share?url=%s&text=%s', urlencode($link->toString()), $this->getQuestion() . urlencode(' | ' . $url));
}
示例15: getStickyRecordsData
/**
* Returns the sticky records with URL and Title
*
* @return array
*/
private function getStickyRecordsData()
{
global $sids;
$now = date('YmdHis');
$query = sprintf("\n SELECT\n fd.id AS id,\n fd.lang AS lang,\n fd.thema AS thema,\n fcr.category_id AS category_id\n FROM\n %sfaqdata fd\n LEFT JOIN\n %sfaqcategoryrelations fcr\n ON\n fd.id = fcr.record_id\n AND\n fd.lang = fcr.record_lang\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.lang = '%s'\n AND \n fd.date_start <= '%s'\n AND \n fd.date_end >= '%s'\n AND \n fd.active = 'yes'\n AND \n fd.sticky = 1\n %s", PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), $this->_config->getLanguage()->getLanguage(), $now, $now, $this->queryPermission($this->groupSupport));
$result = $this->_config->getDb()->query($query);
$sticky = array();
$data = array();
$oldId = 0;
while ($row = $this->_config->getDb()->fetchObject($result)) {
if ($oldId != $row->id) {
$data['thema'] = $row->thema;
$title = $row->thema;
$url = sprintf('%s?%saction=artikel&cat=%d&id=%d&artlang=%s', PMF_Link::getSystemRelativeUri(), $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link($url, $this->_config);
$oLink->itemTitle = $row->thema;
$oLink->tooltip = $title;
$data['url'] = $oLink->toString();
$sticky[] = $data;
}
$oldId = $row->id;
}
return $sticky;
}