本文整理汇总了PHP中PMF_Link::getSystemRelativeUri方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Link::getSystemRelativeUri方法的具体用法?PHP PMF_Link::getSystemRelativeUri怎么用?PHP PMF_Link::getSystemRelativeUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Link
的用法示例。
在下文中一共展示了PMF_Link::getSystemRelativeUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
$editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&id=%d&lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $recordId, $lang, $PMF_LANG['ad_entry_edit_1'] . ' ' . $PMF_LANG['ad_entry_edit_2']);
}
// Is the faq expired?
$expired = date('YmdHis') > $faq->faqRecord['dateEnd'];
// Does the user have the right to add a comment?
if (-1 === $user->getUserId() && !$faqConfig->get('records.allowCommentsForGuests') || $faq->faqRecord['active'] === 'no' || 'n' == $faq->faqRecord['comment'] || $expired) {
$commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
$commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#commentForm').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&cat=%s&id=%d&srclang=%s', $sids, $currentCategory, $recordId, $lang);
if (!empty($switchLanguage)) {
$tpl->parseBlock('writeContent', 'switchLanguage', array('msgChangeLanguage' => $PMF_LANG['msgLangaugeSubmit']));
}
if ($user->perm->checkRight($user->getUserId(), 'addtranslation')) {
$tpl->parseBlock('writeContent', 'addTranslation', array('msgTranslate' => $PMF_LANG['msgTranslate']));
}
if ('-' !== $faqTagging->getAllLinkTagsById($recordId)) {
$tpl->parseBlock('writeContent', 'tagsAvailable', array('renderTags' => $PMF_LANG['msg_tags'] . ': ' . $faqTagging->getAllLinkTagsById($recordId)));
}
if ('' !== $htmlAllCategories) {
$tpl->parseBlock('writeContent', 'relatedCategories', array('renderRelatedCategoriesHeader' => $PMF_LANG['msgArticleCategories'], 'renderRelatedCategories' => $htmlAllCategories));
}
if ('' !== $relatedFaqs) {
$tpl->parseBlock('writeContent', 'relatedFaqs', array('renderRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'], 'renderRelatedArticles' => $relatedFaqs));
}
$date = new PMF_Date($faqConfig);
$captchaHelper = new PMF_Helper_Captcha($faqConfig);
$tpl->parse('writeContent', array('baseHref' => $faqSystem->getSystemUri($faqConfig), 'writeRubrik' => $categoryName, 'solution_id' => $faq->faqRecord['solution_id'], 'solution_id_link' => PMF_Link::getSystemRelativeUri() . '?solution_id=' . $faq->faqRecord['solution_id'], 'writeThema' => $question, 'writeContent' => $answer, 'writeDateMsg' => '<dt>' . $PMF_LANG['msgLastUpdateArticle'] . '</dt><dd>' . $date->format($faq->faqRecord['date']) . '</dd>', 'writeRevision' => '<dt>' . $PMF_LANG['ad_entry_revision'] . ':</dt><dd>1.' . $faq->faqRecord['revision_id'] . '</dd>', 'writeAuthor' => '<dt>' . $PMF_LANG['msgAuthor'] . ':</dt><dd>' . $faq->faqRecord['author'] . '</dd>', 'editThisEntry' => $editThisEntry, 'translationUrl' => $translationUrl, 'languageSelection' => PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation'), 'msgTranslateSubmit' => $PMF_LANG['msgTranslateSubmit'], 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $recordId, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'renderVotingStars' => '', 'printVotings' => $faqRating->getVotingResult($recordId), 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'id' => $recordId, 'lang' => $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' => $captchaHelper->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha'], $auth), 'writeComments' => $faqComment->getComments($recordId, PMF_Comment::COMMENT_TYPE_FAQ), 'msg_about_faq' => $PMF_LANG['msg_about_faq']));
$tpl->merge('writeContent', 'index');
示例2: unset
$count++;
if (!($count % 10)) {
ob_flush();
}
}
echo "</div>";
}
// Clear the array with the queries
unset($query);
$query = [];
//
// 2nd UPDATES FROM 2.8.0-alpha2
//
if (version_compare($version, '2.8.0-alpha2', '<')) {
$link = new PMF_Link(null, $faqConfig);
$instanceData = array('url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), 'instance' => $link->getSystemRelativeUri('setup/update.php'), 'comment' => $faqConfig->get('main.titleFAQ'));
$faqInstance = new PMF_Instance($faqConfig);
$faqInstance->addInstance($instanceData);
$faqInstanceMaster = new PMF_Instance_Master($faqConfig);
$faqInstanceMaster->createMaster($faqInstance);
$faqConfig->add('records.autosaveActive', 'false');
$faqConfig->add('records.autosaveSecs', '180');
$faqConfig->add('main.maintenanceMode', 'false');
$faqConfig->add('security.salt', md5($faqConfig->get('main.referenceURL')));
}
//
// UPDATES FROM 2.8.0-alpha3
//
if (version_compare($version, '2.8.0-alpha3', '<')) {
$query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqlinkverifyrules";
$query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES\n (45, 'export', 'Right to export the complete FAQ')";
示例3: 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;
}
示例4: renderCategoryDropDown
/**
* Renders the main navigation dropdown
*
* @return string
*/
public function renderCategoryDropDown()
{
global $sids, $PMF_LANG;
$open = 0;
$output = '';
$numCategories = $this->Category->height();
$this->Category->expandAll();
if ($numCategories > 0) {
for ($y = 0; $y < $this->Category->height(); $y = $this->Category->getNextLineTree($y)) {
list($hasChild, $categoryName, $parent, $description) = $this->Category->getLineDisplay($y);
$level = $this->Category->treeTab[$y]['level'];
$leveldiff = $open - $level;
$numChilds = $this->Category->treeTab[$y]['numChilds'];
if (!isset($number[$parent])) {
$number[$parent] = 0;
}
if ($this->_config->get('records.hideEmptyCategories') && 0 === $number[$parent] && '-' === $hasChild) {
continue;
}
if ($leveldiff > 1) {
$output .= '</li>';
for ($i = $leveldiff; $i > 1; $i--) {
$output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + $i + 1), str_repeat("\t", $level + $i));
}
}
if ($level < $open) {
if ($level - $open == -1) {
$output .= '</li>';
}
$output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + 2), str_repeat("\t", $level + 1));
} elseif ($level == $open && $y != 0) {
$output .= "</li>\n";
}
if ($level > $open) {
$output .= sprintf("\n%s<ul class=\"dropdown-menu\">\n%s", str_repeat("\t", $level + 1), str_repeat("\t", $level + 1));
if ($numChilds > 0) {
$output .= '<li class="dropdown-submenu">';
} else {
$output .= '<li>';
}
} else {
$output .= str_repeat("\t", $level + 1);
if ($numChilds > 0) {
$output .= '<li class="dropdown-submenu">';
} else {
$output .= '<li>';
}
}
$url = sprintf('%s?%saction=show&cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $parent);
$oLink = new PMF_Link($url, $this->_config);
$oLink->itemTitle = $categoryName;
$oLink->text = $categoryName;
$oLink->tooltip = $description;
$output .= $oLink->toHtmlAnchor();
$open = $level;
}
if (isset($level) && $level > 0) {
$output .= str_repeat("</li>\n\t</ul>\n\t", $level);
}
return $output;
} else {
$output = '<li><a href="#">' . $PMF_LANG['no_cats'] . '</a></li>';
}
return $output;
}
示例5: startInstall
//.........这里部分代码省略.........
echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are too short.' . ' Please set your password and your retyped password with a minimum of 6 characters.</p>';
PMF_System::renderFooter(true);
}
if ($password != $password_retyped) {
echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are not equal.' . ' Please check your password and your retyped password.</p>';
PMF_System::renderFooter(true);
}
$language = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING, 'en');
$realname = PMF_Filter::filterInput(INPUT_POST, 'realname', FILTER_SANITIZE_STRING, '');
$email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, '');
$permLevel = PMF_Filter::filterInput(INPUT_POST, 'permLevel', FILTER_SANITIZE_STRING, 'basic');
$instanceSetup = new PMF_Instance_Setup();
$instanceSetup->setRootDir(PMF_ROOT_DIR);
// Write the DB variables in database.php
if (!$instanceSetup->createDatabaseFile($dbSetup)) {
echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/database.php.</p>";
$this->_system->cleanInstallation();
PMF_System::renderFooter(true);
}
// check LDAP if available
if (extension_loaded('ldap') && !is_null($ldapEnabled)) {
if (!$instanceSetup->createLdapFile($ldapSetup, '')) {
echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/ldap.php.</p>";
$this->_system->cleanInstallation();
PMF_System::renderFooter(true);
}
}
// connect to the database using config/database.php
require PMF_ROOT_DIR . '/config/database.php';
$db = PMF_Db::factory($dbSetup['dbType']);
$db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']);
if (!$db) {
echo "<p class=\"alert alert-danger\"><strong>DB Error:</strong> " . $db->error() . "</p>\n";
$this->_system->cleanInstallation();
PMF_System::renderFooter(true);
}
require PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php';
// CREATE TABLES
require PMF_ROOT_DIR . '/setup/assets/sql/stopwords.sql.php';
// INSERTs for stopwords
$this->_system->setDatabase($db);
echo '<p>';
// Erase any table before starting creating the required ones
if (!PMF_System::isSqlite($dbSetup['dbType'])) {
$this->_system->dropTables($uninst);
}
// Start creating the required tables
$count = 0;
foreach ($query as $executeQuery) {
$result = @$db->query($executeQuery);
if (!$result) {
echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again or send
us a <a href=\\"http://www.phpmyfaq.de\\" target=\\"_blank\\">bug report</a>.</p>';
printf('<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', $db->error());
printf('<code>%s</code>', htmlentities($executeQuery));
$this->_system->dropTables($uninst);
$this->_system->cleanInstallation();
PMF_System::renderFooter(true);
}
usleep(2500);
$count++;
if (!($count % 10)) {
echo '| ';
}
}
$link = new PMF_Link(null, $configuration);
// add main configuration, add personal settings
$this->_mainConfig['main.metaPublisher'] = $realname;
$this->_mainConfig['main.administrationMail'] = $email;
$this->_mainConfig['main.language'] = $language;
$this->_mainConfig['security.permLevel'] = $permLevel;
foreach ($this->_mainConfig as $name => $value) {
$configuration->add($name, $value);
}
$configuration->update(array('main.referenceURL' => $link->getSystemUri('/setup/index.php')));
$configuration->add('security.salt', md5($configuration->get('main.referenceURL')));
// add admin account and rights
$admin = new PMF_User($configuration);
if (!$admin->createUser($loginname, $password, 1)) {
printf("<p class=\"alert alert-danger\"><strong>Fatal installation error:</strong><br>" . "Couldn't create the admin user: %s</p>\n", $admin->error());
$this->_system->cleanInstallation();
PMF_System::renderFooter(true);
}
$admin->setStatus('protected');
$adminData = array('display_name' => $realname, 'email' => $email);
$admin->setUserData($adminData);
// add default rights
foreach ($this->_mainRights as $right) {
$admin->perm->grantUserRight(1, $admin->perm->addRight($right));
}
// Add anonymous user account
$instanceSetup->createAnonymousUser($configuration);
// Add master instance
$instanceData = array('url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), 'instance' => $link->getSystemRelativeUri('setup/index.php'), 'comment' => 'phpMyFAQ ' . PMF_System::getVersion());
$faqInstance = new PMF_Instance($configuration);
$faqInstance->addInstance($instanceData);
$faqInstanceMaster = new PMF_Instance_Master($configuration);
$faqInstanceMaster->createMaster($faqInstance);
echo '</p>';
}
示例6: getPath
/**
* Gets the path from root to child as breadcrumbs
*
* @param integer $id Category ID
* @param string $separator Path separator
* @param boolean $renderAsMicroData Renders breadcrumbs as HTML5 microdata
* @param string $useCssClass Use CSS class "breadcrumb"
* @return string
*/
public function getPath($id, $separator = ' / ', $renderAsMicroData = false, $useCssClass = 'breadcrumb')
{
global $sids;
$ids = $this->getNodes($id);
$num = count($ids);
$temp = $catid = $desc = $breadcrumb = [];
for ($i = 0; $i < $num; $i++) {
$t = $this->getLineCategory($ids[$i]);
if (array_key_exists($t, $this->treeTab)) {
$temp[] = $this->treeTab[$this->getLineCategory($ids[$i])]['name'];
$catid[] = $this->treeTab[$this->getLineCategory($ids[$i])]['id'];
$desc[] = $this->treeTab[$this->getLineCategory($ids[$i])]['description'];
}
}
if (isset($this->treeTab[$this->getLineCategory($id)]['name'])) {
$temp[] = $this->treeTab[$this->getLineCategory($id)]['name'];
$catid[] = $this->treeTab[$this->getLineCategory($id)]['id'];
$desc[] = $this->treeTab[$this->getLineCategory($id)]['description'];
}
// @todo Maybe this should be done somewhere else ...
if ($renderAsMicroData) {
foreach ($temp as $k => $category) {
$url = sprintf('%s?%saction=show&cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $catid[$k]);
$oLink = new PMF_Link($url, $this->_config);
$oLink->text = sprintf('<span itemprop="title">%s</span>', $category);
$oLink->itemTitle = $category;
$oLink->tooltip = $desc[$k];
$oLink->setItemProperty('url');
if (0 == $k) {
$oLink->setRelation('index');
}
$breadcrumb[] = sprintf('<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">%s</li>', $oLink->toHtmlAnchor());
}
$temp = $breadcrumb;
return sprintf('<ul class="%s">%s</ul>', $useCssClass, implode('', $temp));
} else {
return implode($separator, $temp);
}
}
示例7: renderRelatedFaqs
/**
* @param PMF_Search_Resultset $resultSet
* @param integer $recordId
*
* @return string
*/
public function renderRelatedFaqs(PMF_Search_Resultset $resultSet, $recordId)
{
$html = '';
$numOfResults = $resultSet->getNumberOfResults();
if ($numOfResults > 0) {
$html .= '<ul>';
$counter = 0;
foreach ($resultSet->getResultset() as $result) {
if ($counter >= 5) {
continue;
}
if ($recordId == $result->id) {
continue;
}
$counter++;
$url = sprintf('%s?action=artikel&cat=%d&id=%d&artlang=%s', PMF_Link::getSystemRelativeUri(), $result->category_id, $result->id, $result->lang);
$oLink = new PMF_Link($url, $this->_config);
$oLink->itemTitle = $result->question;
$oLink->text = $result->question;
$oLink->tooltip = $result->question;
$html .= '<li>' . $oLink->toHtmlAnchor() . '</li>';
}
$html .= '</ul>';
}
return $html;
}
示例8: array_slice
/**
* There are meanwhile over 600 language
* vars and we won't to show them all
* at once, so let's paginate.
*/
$itemsPerPage = 32;
if (!isset($_SESSION['trans'])) {
/**
* English is our exemplary language
*/
$_SESSION['trans']['leftVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_en.php");
$_SESSION['trans']['rightVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_{$translateLang}.php");
}
$leftVarsOnly = array_slice($_SESSION['trans']['leftVarsOnly'], ($page - 1) * $itemsPerPage, $itemsPerPage);
$rightVarsOnly =& $_SESSION['trans']['rightVarsOnly'];
$options = array('baseUrl' => PMF_Link::getSystemRelativeUri('index.php') . '?' . str_replace('&', '&', $_SERVER['QUERY_STRING']), 'total' => count($_SESSION['trans']['leftVarsOnly']), 'perPage' => $itemsPerPage, 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$pagination = new PMF_Pagination($options);
$pageBar = $pagination->render();
/**
* These keys always exist as they are defined when creating translation.
* We use these values to add the correct number of input boxes.
* Left column will always have 2 boxes, right - 1 to 6+ boxes.
*/
$leftNPlurals = (int) $_SESSION['trans']['leftVarsOnly']['PMF_LANG[nplurals]'];
$rightNPlurals = (int) $rightVarsOnly['PMF_LANG[nplurals]'];
printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_translations']);
printf('<p style="color: red;">%s</p>', $PMF_LANG['msgTransToolNoteFileSaving']);
$NPluralsErrorReported = false;
?>
<form id="transDiffForm">
<table class="list" style="width: 100%">
示例9: 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;
}
示例10: array_slice
/**
* There are meanwhile over 600 language
* vars and we won't to show them all
* at once, so let's paginate.
*/
$itemsPerPage = 32;
if (!isset($_SESSION['trans'])) {
/**
* English is our exemplary language
*/
$_SESSION['trans']['leftVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_en.php");
$_SESSION['trans']['rightVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_{$translateLang}.php");
}
$leftVarsOnly = array_slice($_SESSION['trans']['leftVarsOnly'], ($page - 1) * $itemsPerPage, $itemsPerPage);
$rightVarsOnly =& $_SESSION['trans']['rightVarsOnly'];
$options = array('baseUrl' => PMF_Link::getSystemRelativeUri('index.php') . '?' . str_replace('&', '&', $_SERVER['QUERY_STRING']), 'total' => count($_SESSION['trans']['leftVarsOnly']), 'perPage' => $itemsPerPage);
$pagination = new PMF_Pagination($faqConfig, $options);
$pageBar = $pagination->render();
/**
* These keys always exist as they are defined when creating translation.
* We use these values to add the correct number of input boxes.
* Left column will always have 2 boxes, right - 1 to 6+ boxes.
*/
$leftNPlurals = (int) $_SESSION['trans']['leftVarsOnly']['PMF_LANG[nplurals]'];
$rightNPlurals = (int) $rightVarsOnly['PMF_LANG[nplurals]'];
printf('<header class="row"><div class="col-lg-12"><h2 class="page-header"><i class="fa fa-wrench"></i> %s</h2></div></header>', $PMF_LANG['ad_menu_translations']);
$NPluralsErrorReported = false;
?>
<div class="row">
<div class="col-lg-12">
<p class="alert alert-info">
示例11: 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;
}
示例12: sprintf
$htmlAllCategories .= sprintf("<li>%s</li>\n", $path);
}
$htmlAllCategories .= ' </ul>';
$htmlAllCategories .= ' </div>';
}
// Related FAQs
$faqSearchResult->reviewResultset($faqRelation->getAllRelatedById($faq->faqRecord['id'], $faq->faqRecord['title'], $faq->faqRecord['keywords']));
$relatedFaqs = PMF_Helper_Search::getInstance()->renderRelatedFaqs($faqSearchResult, $faq->faqRecord['id']);
// Show link to edit the faq?
$editThisEntry = '';
if (isset($permission['editbt']) && $permission['editbt']) {
$editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&id=%d&lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $faq->faqRecord['id'], $lang, $PMF_LANG['ad_entry_edit_1'] . ' ' . $PMF_LANG['ad_entry_edit_2']);
}
// Is the faq expired?
$expired = date('YmdHis') > $faq->faqRecord['dateEnd'];
// Does the user have the right to add a comment?
if ($faq->faqRecord['active'] != 'yes' || 'n' == $faq->faqRecord['comment'] || $expired) {
$commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
$commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#commentForm').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&cat=%s&id=%d&srclang=%s', $sids, $currentCategory, $faq->faqRecord['id'], $lang);
if (!empty($switchLanguage)) {
$tpl->processBlock('writeContent', 'switchLanguage', array('msgChangeLanguage' => $PMF_LANG['msgLangaugeSubmit']));
}
if (isset($permission['addtranslation']) && $permission['addtranslation']) {
$tpl->processBlock('writeContent', 'addTranslation', array('msgTranslate' => $PMF_LANG['msgTranslate']));
}
// Set the template variables
$tpl->processTemplate('writeContent', array('writeRubrik' => $categoryName, 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $question, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $htmlAllCategories, 'writeContent' => $answer, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $faqTagging->getAllLinkTagsById($faq->faqRecord['id']), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relatedFaqs, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::format($faq->faqRecord['date']), 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'translationUrl' => $translationUrl, 'languageSelection' => PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation'), 'msgTranslateSubmit' => $PMF_LANG['msgTranslateSubmit'], 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $faq->faqRecord['id'], 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $faqRating->getVotingResult($recordId), 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'id' => $faq->faqRecord['id'], 'lang' => $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()->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha']), 'writeComments' => $faqComment->getComments($faq->faqRecord['id'], PMF_Comment::COMMENT_TYPE_FAQ), 'msg_about_faq' => $PMF_LANG['msg_about_faq']));
$tpl->includeTemplate('writeContent', 'index');
示例13: renderSearchResult
/**
* Renders the result page for the main search page
*
* @param PMF_Search_Resultset $resultSet PMF_Search_Resultset object
* @param integer $currentPage Current page number
*
* @return string
*/
public function renderSearchResult(PMF_Search_Resultset $resultSet, $currentPage)
{
$html = '';
$confPerPage = PMF_Configuration::getInstance()->get('main.numberOfRecordsPerPage');
$numOfResults = $resultSet->getNumberOfResults();
$totalPages = ceil($numOfResults / $confPerPage);
$lastPage = $currentPage * $confPerPage;
$firstPage = $lastPage - $confPerPage;
if ($lastPage > $numOfResults) {
$lastPage = $numOfResults;
}
if (0 < $numOfResults) {
$html .= sprintf("<p>%s</p>\n", $this->plurals->GetMsg('plmsgSearchAmount', $numOfResults));
if (1 < $totalPages) {
$html .= sprintf("<p><strong>%s%d %s %s</strong></p>\n", $this->translation['msgPage'], $currentPage, $this->translation['msgVoteFrom'], $this->plurals->GetMsg('plmsgPagesTotal', $totalPages));
}
$html .= "<ul class=\"phpmyfaq_ul\">\n";
foreach ($resultSet->getResultset() as $result) {
$categoryName = $this->categoryLayout->renderBreadcrumb(array($result->category_id));
$question = PMF_Utils::chopString($result->question, 15);
$answerPreview = PMF_Utils::chopString(strip_tags($result->answer), 25);
$searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $this->searchterm);
$searchterm = preg_quote($searchterm, '/');
$searchItems = explode(' ', $searchterm);
if (PMF_String::strlen($searchItems[0]) > 1) {
foreach ($searchItems as $item) {
if (PMF_String::strlen($item) > 2) {
$question = PMF_Utils::setHighlightedString($question, $item);
$answerPreview = PMF_Utils::setHighlightedString($answerPreview, $item);
}
}
}
// Build the link to the faq record
$currentUrl = sprintf('%s?%saction=artikel&cat=%d&id=%d&artlang=%s&highlight=%s', PMF_Link::getSystemRelativeUri(), $this->sessionId, $result->category_id, $result->id, $result->lang, urlencode($searchterm));
$oLink = new PMF_Link($currentUrl);
$oLink->text = $oLink->itemTitle = $oLink->tooltip = $result->question;
$html .= sprintf("<li><strong>%s</strong>: %s<br /><div class=\"searchpreview\"><strong>%s</strong> %s...</div><br /></li>\n", $categoryName, $oLink->toHtmlAnchor(), $this->translation['msgSearchContent'], $answerPreview);
}
$html .= "</ul>\n";
if (1 > $totalPages) {
$html .= $this->pagination->render();
}
} else {
$html = $this->translation['err_noArticles'];
}
return $html;
}
示例14: getAllRelatedById
/**
* Returns all relevant articles for a FAQ record with the same language
*
* @param integer $record_id FAQ ID
* @param string $thema FAQ title
*
* @return string
*/
public function getAllRelatedById($record_id, $article_name, $keywords)
{
global $sids;
$relevantslisting = '';
$begriffe = str_replace('-', ' ', $article_name) . $keywords;
$search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType()));
$i = $last_id = 0;
$search->setDatabaseHandle($this->db)->setTable(SQLPREFIX . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS thema', 'fd.content AS content'))->setJoinedTable(SQLPREFIX . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->language->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords'));
$result = $search->search($begriffe);
while (($row = $this->db->fetchObject($result)) && $i < PMF_Configuration::getInstance()->get('records.numberOfRelatedArticles')) {
if ($row->id == $record_id || $row->id == $last_id) {
continue;
}
$relevantslisting .= '' == $relevantslisting ? '<ul>' : '';
$relevantslisting .= '<li>';
$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 = $row->thema;
$oLink->tooltip = $row->thema;
$relevantslisting .= $oLink->toHtmlAnchor() . '</li>';
$i++;
$last_id = $row->id;
}
$relevantslisting .= $i > 0 ? '</ul>' : '';
return '' == $relevantslisting ? '-' : $relevantslisting;
}
示例15: array
$templateVars['renderUpdateUserScript'] = true;
$templateVars['updateUserId'] = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT, 0);
}
$twig->loadTemplate('user/list.twig')->display($templateVars);
}
// show list of all users
if ($userAction == 'listallusers' && $user->perm->checkRight($user->getUserId(), 'edituser')) {
$templateVars = array('PMF_LANG' => $PMF_LANG, 'displayPagination' => false, 'message' => $message, 'users' => array());
$allUsers = $user->getAllUsers();
$numUsers = count($allUsers);
$page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 0);
$perPage = 10;
$numPages = ceil($numUsers / $perPage);
$lastPage = $page * $perPage;
$firstPage = $lastPage - $perPage;
$baseUrl = sprintf('%s?action=user&user_action=listallusers&page=%d', PMF_Link::getSystemRelativeUri(), $page);
if ($perPage < $numUsers) {
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => $numUsers, 'perPage' => $perPage, 'pageParamName' => 'page');
$pagination = new PMF_Pagination($faqConfig, $options);
$templateVars['displayPagination'] = true;
$templateVars['pagination'] = $pagination->render();
}
$counter = $displayedCounter = 0;
foreach ($allUsers as $userId) {
$user->getUserById($userId);
if ($displayedCounter >= $perPage) {
continue;
}
$counter++;
if ($counter <= $firstPage) {