本文整理汇总了PHP中PMF_Language类的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Language类的具体用法?PHP PMF_Language怎么用?PHP PMF_Language使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PMF_Language类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Create and return an instance
*
* @param string $language
*
* @return PMF_String_Basic
*/
public static function getInstance($encoding = null, $language = 'en')
{
if (!self::$instance) {
self::$instance = new self();
self::$instance->encoding = self::DEFAULT_ENCODING;
self::$instance->language = PMF_Language::isASupportedLanguage($language) ? $language : self::DEFAULT_LANGUAGE;
}
return self::$instance;
}
示例2: renderInputForm
/**
* @param mixed $key
* @param string $type
*
* @return void
*/
function renderInputForm($key, $type)
{
global $PMF_LANG, $faqConfig;
switch ($type) {
case 'area':
printf('<textarea name="edit[%s]" rows="4" class="form-control">%s</textarea>', $key, str_replace('<', '<', str_replace('>', '>', $faqConfig->get($key))));
printf("</div>\n");
break;
case 'input':
if ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenKey' == $key && isset($_SESSION['access_token'])) {
$value = $_SESSION['access_token']['oauth_token'];
} elseif ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenSecret' == $key && isset($_SESSION['access_token'])) {
$value = $_SESSION['access_token']['oauth_token_secret'];
} else {
$value = str_replace('"', '"', $faqConfig->get($key));
}
printf('<input class="form-control" type="%s" name="edit[%s]" value="%s" step="1" min="0">', is_numeric($value) ? 'number' : 'text', $key, $value);
echo "</div>\n";
break;
case 'select':
printf('<select name="edit[%s]" size="1" class="form-control">', $key);
switch ($key) {
case 'main.language':
$languages = PMF_Language::getAvailableLanguages();
if (count($languages) > 0) {
echo PMF_Language::languageOptions(str_replace(array('language_', '.php'), '', $faqConfig->get('main.language')), false, true);
} else {
echo '<option value="language_en.php">English</option>';
}
break;
case 'records.orderby':
echo PMF_Configuration::sortingOptions($faqConfig->get($key));
break;
case 'records.sortby':
printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_desc']);
printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_asc']);
break;
case 'security.permLevel':
echo PMF_Perm::permOptions($faqConfig->get($key));
break;
case 'main.templateSet':
$faqSystem = new PMF_System();
$templates = $faqSystem->getAvailableTemplates();
foreach ($templates as $template => $selected) {
printf("<option%s>%s</option>", $selected === true ? ' selected' : '', $template);
}
break;
case "records.attachmentsStorageType":
foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
$selected = $faqConfig->get($key) == $i ? ' selected' : '';
printf('<option value="%d"%s>%s</option>', $i, $selected, $item);
}
break;
case "records.orderingPopularFaqs":
printf('<option value="visits"%s>%s</option>', 'visits' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.visits']);
printf('<option value="voting"%s>%s</option>', 'voting' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.voting']);
break;
case "search.relevance":
printf('<option value="thema,content,keywords"%s>%s</option>', 'thema,content,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-content-keywords']);
printf('<option value="thema,keywords,content"%s>%s</option>', 'thema,keywords,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-keywords-content']);
printf('<option value="content,thema,keywords"%s>%s</option>', 'content,thema,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-thema-keywords']);
printf('<option value="content,keywords,thema"%s>%s</option>', 'content,keywords,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-keywords-thema']);
printf('<option value="keywords,content,thema"%s>%s</option>', 'keywords,content,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-content-thema']);
printf('<option value="keywords,thema,content"%s>%s</option>', 'keywords,thema,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-thema-content']);
break;
}
echo "</select>\n</div>\n";
break;
case 'checkbox':
printf('<div class="checkbox"><input type="checkbox" name="edit[%s]" value="true"', $key);
if ($faqConfig->get($key)) {
echo ' checked';
}
if ('security.ldapSupport' === $key && !extension_loaded('ldap')) {
echo ' disabled';
}
if ('security.useSslOnly' === $key && empty($_SERVER['HTTPS'])) {
echo ' disabled';
}
if ('security.ssoSupport' === $key && empty($_SERVER['REMOTE_USER'])) {
echo ' disabled';
}
echo ">\n</div></div>\n";
break;
case 'print':
printf('<input type="text" readonly name="edit[%s]" class="form-control" value="%s"></div>', $key, str_replace('"', '"', $faqConfig->get($key)), $faqConfig->get($key));
break;
}
}
示例3: printInputFieldByType
function printInputFieldByType($key, $type)
{
global $PMF_LANG;
$faqconfig = PMF_Configuration::getInstance();
switch ($type) {
case 'area':
printf('<textarea name="edit[%s]" cols="60" rows="6" style="width: 500px;">%s</textarea>', $key, str_replace('<', '<', str_replace('>', '>', $faqconfig->get($key))));
printf("<br />\n");
break;
case 'input':
printf('<input type="text" name="edit[%s]" size="75" value="%s" style="width: 500px;" />', $key, str_replace('"', '"', $faqconfig->get($key)));
printf("<br />\n");
break;
case 'select':
printf('<select name="edit[%s]" size="1" style="width: 500px;">', $key);
switch ($key) {
case 'main.language':
$languages = PMF_Language::getAvailableLanguages();
if (count($languages) > 0) {
print PMF_Language::languageOptions(str_replace(array("language_", ".php"), "", $faqconfig->get('main.language')), false, true);
} else {
print '<option value="language_en.php">English</option>';
}
break;
case 'records.orderby':
print sortingOptions($faqconfig->get($key));
break;
case 'records.sortby':
printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_desc']);
printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_asc']);
break;
case 'main.permLevel':
print PMF_Perm::permOptions($faqconfig->get($key));
break;
case "main.templateSet":
/**
* TODO: do get availiable template sets in the PMF_Template
*/
foreach (new DirectoryIterator('../template') as $item) {
if (!$item->isDot() && $item->isDir()) {
$selected = PMF_Template::getTplSetName() == $item ? ' selected="selected"' : '';
printf("<option%s>%s</option>", $selected, $item);
}
}
break;
case "main.attachmentsStorageType":
foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
$selected = $faqconfig->get($key) == $i ? ' selected="selected"' : '';
printf('<option value="%d"%s>%s</option>', $i, $selected, $item);
}
break;
}
print "</select>\n<br />\n";
break;
case 'checkbox':
printf('<input type="checkbox" name="edit[%s]" value="true"', $key);
if ($faqconfig->get($key)) {
print ' checked="checked"';
}
print " /><br />\n";
break;
case 'print':
printf('<input type="hidden" name="edit[%s]" size="80" value="%s" />%s<br />', $key, str_replace('"', '"', $faqconfig->get($key)), $faqconfig->get($key));
break;
}
}
示例4: array
?>
</h3>
</header>
<div id="editTranslations">
<?php
if ($faqconfig->get('main.googleTranslationKey') == '') {
print $PMF_LANG["msgNoGoogleApiKeyFound"];
} else {
?>
<p>
<label for="langTo"><?php
print $PMF_LANG["ad_entry_locale"];
?>
:</label>
<?php
print PMF_Language::selectLanguages($LANGCODE, false, array(), 'langTo');
?>
</p>
<input type="hidden" name="used_translated_languages" id="used_translated_languages" value="" />
<div id="getedTranslations">
</div>
<?php
}
?>
</div>
<?php
}
?>
<p>
<input class="submit" type="submit" name="submit" value="<?php
print $PMF_LANG["ad_categ_add"];
示例5: isset
">
<div id="container">
<header id="header">
<?php
if (isset($auth) && is_null($action)) {
?>
<div id="loginBox">
<div id="languageSelection">
<form action="index.php<?php
print isset($action) ? '?action=' . $action : '';
?>
" method="post">
<?php
print PMF_Language::selectLanguages($LANGCODE, true);
?>
</form>
</div>
</div>
<?php
}
?>
<h1><a class="mainpage" href="../"><?php
print $faqconfig->get('main.titleFAQ');
?>
</a></h1>
<?php
if (isset($auth)) {
?>
示例6: sprintf
$minVisits = $_r['visits'];
}
if ($maxVisits < $_r['visits']) {
$maxVisits = $_r['visits'];
}
if ($record_id == $_r['id'] && $lang == $_r['lang']) {
$currVisits = $_r['visits'];
}
}
if ($maxVisits - $minVisits > 0) {
$percentage = 100 * ($currVisits - $minVisits) / ($maxVisits - $minVisits);
}
$faqPopularity = $currVisits . '/' . (int) $percentage . '%';
$translationForm = '';
if (count($arrLanguage) < count(PMF_Language::getAvailableLanguages())) {
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&cat=%s&id=%d&srclang=%s', $sids, $currentCategory, $record_id, $lang);
$translationForm = '
<form action="' . $translationUrl . '" method="post" style="display: inline;">
<img src="images/translate.gif" alt="' . $PMF_LANG['msgTranslate'] . '" title="' . $PMF_LANG['msgTranslate'] . '" width="16" height="16" border="0" /> ' . $PMF_LANG['msgTranslate'] . ' ' . PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation') . ' <input class="submit" type="submit" name="submit" value="' . $PMF_LANG['msgTranslateSubmit'] . '" />
</form>';
}
// Get rating
$recordRating = $faqrating->fetch($record_id);
if (!is_null($recordRating)) {
$printVoting = sprintf(' %s (%s)', round($recordRating->sumVotings / $recordRating->numVotings, 2), $plr->GetMsg('plmsgVotes', $recordRating->numVotings));
} else {
$printVoting = sprintf('0 (%s)', $plr->GetMsg('plmsgVotes', 0));
}
// Set the template variables
$tpl->processTemplate("writeContent", array('writeRubrik' => $categoryName . '<br />', 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $thema, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $writeMultiCategories, 'writeContent' => $content, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $tagging->getAllLinkTagsById($record_id), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relevant->getAllRelatedById($record_id, $faq->faqRecord['title'], $faq->faqRecord['keywords']), 'writePopularity' => $faqPopularity, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . $faq->faqRecord['date'], 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'writeDiggMsgTag' => 'Digg it!', 'link_digg' => sprintf('http://digg.com/submit?phase=2&url=%s', urlencode($diggItUrl)), 'writeFacebookMsgTag' => 'Share on Facebook', 'link_facebook' => sprintf('http://www.facebook.com/sharer.php?u=%s', urlencode($facebookUrl)), 'link_email' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=send2friend&cat=%d&id=%d&artlang=%s', $sids, $currentCategory, $record_id, $lang), 'link_pdf' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'pdf.php?cat=%d&id=%d&artlang=%s', $currentCategory, $record_id, $lang), 'writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'translationForm' => $translationForm, 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $record_id, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $printVoting, 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'id' => $record_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()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('writecomment')), 'writeComments' => $comment->getComments($record_id, PMF_Comment::COMMENT_TYPE_FAQ)));
$tpl->includeTemplate('writeContent', 'index');
示例7: define
//
// Define the named constant used as a check by any included PHP file
//
define('IS_VALID_PHPMYFAQ', null);
//
// Bootstrapping
//
require PMF_ROOT_DIR . '/inc/Bootstrap.php';
/**
* Initialize attachment factory
*/
PMF_Attachment_Factory::init($faqConfig->get('records.attachmentsStorageType'), $faqConfig->get('records.defaultAttachmentEncKey'), $faqConfig->get('records.enableAttachmentEncryption'));
$currentSave = PMF_Filter::filterInput(INPUT_POST, 'save', FILTER_SANITIZE_STRING);
$currentAction = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$currentToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
$Language = new PMF_Language($faqConfig);
$LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
require_once PMF_ROOT_DIR . '/lang/language_en.php';
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) {
require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php';
} else {
$LANGCODE = 'en';
}
$auth = false;
$user = PMF_User_CurrentUser::getFromSession($faqConfig);
if ($user) {
$auth = true;
} else {
$error = $PMF_LANG['ad_auth_sess'];
$user = null;
unset($user);
示例8: array
$thema = PMF_Filter::filterInput(INPUT_POST, 'thema', FILTER_SANITIZE_STRIPPED);
$content = PMF_Filter::filterInput(INPUT_POST, 'content', FILTER_SANITIZE_STRIPPED);
$tr_content = PMF_Filter::filterInput(INPUT_POST, 'translated_content', FILTER_SANITIZE_STRING);
$contentlink = PMF_Filter::filterInput(INPUT_POST, 'contentlink', FILTER_VALIDATE_URL);
$keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRIPPED);
$code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING);
$categories = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY)));
// If e-mail address is set to optional
if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($usermail)) {
$usermail = PMF_Configuration::getInstance()->get('main.administrationMail');
}
// Check on translation
if (is_null($content) && !is_null($tr_content)) {
$content = $tr_content;
}
if (!is_null($username) && !is_null($usermail) && !is_null($thema) && !is_null($content) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($thema)) && checkBannedWord(PMF_String::htmlspecialchars($content)) && $captcha->checkCaptchaCode($code) && (is_null($faqid) && !is_null($categories) || !is_null($faqid) && !is_null($faqlanguage) && PMF_Language::isASupportedLanguage($faqlanguage))) {
$isNew = true;
if (!is_null($faqid)) {
$isNew = false;
$faqsession->userTracking('save_new_translation_entry', 0);
} else {
$faqsession->userTracking('save_new_entry', 0);
}
$isTranslation = false;
if (!is_null($faqlanguage)) {
$isTranslation = true;
$newLanguage = $faqlanguage;
}
if (PMF_String::substr($contentlink, 7) != "") {
$content = $content . "<br />" . $PMF_LANG["msgInfo"] . "<a href=\"http://" . PMF_String::substr($contentlink, 7) . "\" target=\"_blank\">" . $contentlink . "</a>";
}
示例9: define
*/
define('PMF_ROOT_DIR', dirname(dirname(__DIR__)));
define('IS_VALID_PHPMYFAQ', null);
//
// Bootstrapping
//
require PMF_ROOT_DIR . '/inc/Bootstrap.php';
//
// get language (default: english)
//
$Language = new PMF_Language($faqConfig);
$LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
// Preload English strings
require_once PMF_ROOT_DIR . '/lang/language_en.php';
$faqConfig->setLanguage($Language);
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) {
// Overwrite English strings with the ones we have in the current language
require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php';
} else {
$LANGCODE = 'en';
}
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
$faq = new PMF_Faq($faqConfig);
$rssData = $faq->getAllOpenQuestions(false);
$num = count($rssData);
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
示例10: renderLanguages
/**
* Create all languagess which can be used for translation as <option>
*
* @param integer $categoryId Category id
* @param string $selectedLanguage Selected language
* @return string
*/
public function renderLanguages($categoryId, $selectedLanguage)
{
$existingLanguages = PMF_Utils::languageAvailable($categoryId, 'faqcategories');
$options = '';
foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) {
if (!in_array(strtolower($lang), $existingLanguages)) {
$options .= sprintf("\t<option value=\"%s\"%s>%s</option>\n", strtolower($lang), $lang == $selectedLanguage ? ' selected="selected"' : '', $langname);
}
}
return $options;
}
示例11: getCategoryLanguagesToTranslate
/**
* Create all languagess which can be used for translation as <option>
*
* @param integer $category_id Category id
* @param string $selected_lang Selected language
*
* @return string
*/
public function getCategoryLanguagesToTranslate($category_id, $selected_lang)
{
$output = '';
$existcatlang = $this->_config->getLanguage()->languageAvailable($category_id, 'faqcategories');
foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) {
if (!in_array(strtolower($lang), $existcatlang)) {
$output .= "\t<option value=\"" . strtolower($lang) . "\"";
if ($lang == $selected_lang) {
$output .= " selected=\"selected\"";
}
$output .= ">" . $langname . "</option>\n";
}
}
return $output;
}
示例12: unset
}
if (isset($_SESSION['trans'])) {
unset($_SESSION['trans']);
}
printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_translations']);
?>
<form id="newTranslationForm">
<table class="list" style="width: 100%">
<tr>
<td><?php
print $PMF_LANG['msgLanguage'];
?>
</td>
<td><select name="translang" id="translang">
<?php
$avaliableLanguages = array_keys(PMF_Language::getAvailableLanguages());
foreach ($languageCodes as $langCode => $langName) {
if (!in_array(strtolower($langCode), $avaliableLanguages)) {
?>
<option value="<?php
print $langCode;
?>
"><?php
print $langName;
?>
</option>
<?php
}
}
?>
</select></td>
示例13: define
* @since 2007-03-27
*/
use Symfony\Component\HttpFoundation\Response;
define('IS_VALID_PHPMYFAQ', null);
//
// Prepend and start the PHP session
//
require 'inc/Bootstrap.php';
$searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
$ajaxLanguage = PMF_Filter::filterInput(INPUT_POST, 'ajaxlanguage', FILTER_SANITIZE_STRING, 'en');
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'searchcategory', FILTER_VALIDATE_INT, '%');
$language = new PMF_Language($faqConfig);
$languageCode = $language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
$faqConfig->setLanguage($language);
require_once 'lang/language_en.php';
if (PMF_Language::isASupportedLanguage($ajaxLanguage)) {
$languageCode = trim($ajaxLanguage);
require_once 'lang/language_' . $languageCode . '.php';
} else {
$languageCode = 'en';
require_once 'lang/language_en.php';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($languageCode);
//
// Get current user and group id - default: -1
//
示例14: array
echo $faqData['content'];
?>
</textarea>
</div>
</div>
</fieldset>
<fieldset class="form-horizontal">
<!-- Meta data -->
<div class="control-group">
<label class="control-label" for="lang"><?php
echo $PMF_LANG["ad_entry_locale"];
?>
:</label>
<div class="controls">
<?php
echo PMF_Language::selectLanguages($faqData['lang'], false, array(), 'lang');
?>
</div>
</div>
</fieldset>
<fieldset class="form-horizontal">
<!-- Attachments -->
<?php
if ($permission['addattachment']) {
?>
<div class="control-group">
<label class="control-label"><?php
echo $PMF_LANG['ad_menu_attachments'];
?>
:</label>
<div class="controls">
示例15: unset
$newsHeader[$key]['date'] = $date->format($newsItem['date']);
}
$twig->loadTemplate('news/list.twig')->display(array('PMF_LANG' => $PMF_LANG, 'newsHeader' => $newsHeader));
unset($date, $newsHeader, $key, $newsItem);
} elseif ('editnews' == $action && $user->perm->checkRight($user->getUserId(), 'editnews')) {
$id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$newsData = $news->getNewsEntry($id, true);
$dateStart = $newsData['dateStart'] != '00000000000000' ? PMF_Date::createIsoDate($newsData['dateStart'], 'Y-m-d') : '';
$dateEnd = $newsData['dateEnd'] != '99991231235959' ? PMF_Date::createIsoDate($newsData['dateEnd'], 'Y-m-d') : '';
$newsId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$oComment = new PMF_Comment($faqConfig);
$comments = $oComment->getCommentsData($newsId, PMF_Comment::COMMENT_TYPE_NEWS);
foreach ($comments as $item) {
$item['date'] = PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false);
}
$twig->loadTemplate('news/edit.twig')->display(array('PMF_LANG' => $PMF_LANG, 'comments' => $comments, 'commentType' => PMF_Comment::COMMENT_TYPE_NEWS, 'dateEnd' => $dateEnd, 'dateStart' => $dateStart, 'languageSelector' => PMF_Language::selectLanguages($newsData['lang'], false, array(), 'langTo'), 'newsData' => $newsData));
} elseif ('savenews' == $action && $user->perm->checkRight($user->getUserId(), "addnews")) {
$dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
$dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
$header = PMF_Filter::filterInput(INPUT_POST, 'newsheader', FILTER_SANITIZE_STRIPPED);
$content = PMF_Filter::filterInput(INPUT_POST, 'news', FILTER_SANITIZE_SPECIAL_CHARS);
$author = PMF_Filter::filterInput(INPUT_POST, 'authorName', FILTER_SANITIZE_STRIPPED);
$email = PMF_Filter::filterInput(INPUT_POST, 'authorEmail', FILTER_VALIDATE_EMAIL);
$active = PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING);
$comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING);
$link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL);
$linktitle = PMF_Filter::filterInput(INPUT_POST, 'linkTitle', FILTER_SANITIZE_STRIPPED);
$newslang = PMF_Filter::filterInput(INPUT_POST, 'langTo', FILTER_SANITIZE_STRING);
$target = PMF_Filter::filterInput(INPUT_POST, 'target', FILTER_SANITIZE_STRIPPED);
$newsData = array('lang' => $newslang, 'header' => $header, 'content' => html_entity_decode($content), 'authorName' => $author, 'authorEmail' => $email, 'active' => is_null($active) ? 'n' : 'y', 'comment' => is_null($comment) ? 'n' : 'y', 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'link' => $link, 'linkTitle' => $linktitle, 'date' => date('YmdHis'), 'target' => is_null($target) ? '' : $target);
$success = $news->addNewsEntry($newsData);