本文整理汇总了PHP中specialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP specialchars函数的具体用法?PHP specialchars怎么用?PHP specialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了specialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the controller and parse the login template
*
* @return Response
*/
public function run()
{
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_login');
// Show a cookie warning
if (\Input::get('referer', true) != '' && empty($_COOKIE)) {
$objTemplate->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
}
$strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], \Config::get('websiteTitle'));
$objTemplate->theme = \Backend::getTheme();
$objTemplate->messages = \Message::generate();
$objTemplate->base = \Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->languages = \System::getLanguages(true);
$objTemplate->title = specialchars($strHeadline);
$objTemplate->charset = \Config::get('characterSet');
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
$objTemplate->headline = $strHeadline;
$objTemplate->curLanguage = \Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
$objTemplate->curUsername = \Input::post('username') ?: '';
$objTemplate->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
$objTemplate->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
$objTemplate->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
$objTemplate->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
$objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
$objTemplate->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
$objTemplate->disableCron = \Config::get('disableCron');
$objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
return $objTemplate->getResponse();
}
示例2: generate
/**
* Generate the widget and return it as string
*
* @return string
*/
public function generate()
{
$arrObjects = array('u' => 'cuser', 'g' => 'cgroup', 'w' => 'cworld');
$return = ' <table id="ctrl_defaultChmod" class="tl_chmod">
<tr>
<th></th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['editpage'] . '</th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['editnavigation'] . '</th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['deletepage'] . '</th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['editarticles'] . '</th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['movearticles'] . '</th>
<th scope="col">' . $GLOBALS['TL_LANG']['CHMOD']['deletearticles'] . '</th>
</tr>';
// Build rows for user, group and world
foreach ($arrObjects as $k => $v) {
$return .= '
<tr>
<th scope="row">' . $GLOBALS['TL_LANG']['CHMOD'][$v] . '</th>';
// Add checkboxes
for ($j = 1; $j <= 6; $j++) {
$return .= '
<td><input type="checkbox" name="' . $this->strName . '[]" value="' . specialchars($k . $j) . '"' . static::optionChecked($k . $j, $this->varValue) . ' onfocus="Backend.getScrollOffset()"></td>';
}
$return .= '
</tr>';
}
return $return . '
</table>';
}
示例3: run
/**
* Run the controller and parse the template
*/
public function run()
{
$this->Template = new BackendTemplate('be_picker');
$this->Template->main = '';
// Ajax request
if ($_POST && Environment::get('isAjaxRequest')) {
$this->objAjax = new Ajax(Input::post('action'));
$this->objAjax->executePreActions();
}
$strTable = Input::get('table');
$strField = Input::get('field');
$this->loadDataContainer($strTable);
$objDca = new DC_Table($strTable);
// AJAX request
if ($_POST && Environment::get('isAjaxRequest')) {
$this->objAjax->executePostActions($objDca);
}
$objFileTree = new $GLOBALS['BE_FFL']['fileSelector'](array('strId' => $strField, 'strTable' => $strTable, 'strField' => $strField, 'strName' => $strField, 'varValue' => explode(',', Input::get('value'))), $objDca);
$this->Template->main = $objFileTree->generate();
$this->Template->theme = $this->getTheme();
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
$this->Template->headline = $GLOBALS['TL_LANG']['MSC']['ppHeadline'];
$this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
$this->Template->options = $this->createPageList();
$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
$this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
$this->Template->action = ampersand(Environment::get('request'));
$this->Template->value = $this->Session->get('file_selector_search');
$GLOBALS['TL_CONFIG']['debugMode'] = false;
$this->Template->output();
}
示例4: compile
/**
* Generate the module
*/
protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
// Set the trail and level
if ($this->defineRoot && $this->rootPage > 0) {
$trail = array($this->rootPage);
$level = 0;
} else {
$trail = $objPage->trail;
$level = $this->levelOffset > 0 ? $this->levelOffset : 0;
}
$lang = null;
$host = null;
// Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
if ($this->defineRoot && $this->rootPage > 0) {
$objRootPage = \PageModel::findWithDetails($this->rootPage);
// Set the language
if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
$lang = $objRootPage->rootLanguage;
}
// Set the domain
if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
$host = $objRootPage->domain;
}
}
$this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
$this->Template->skipId = 'skipNavigation' . $this->id;
$this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
$this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
}
示例5: run
/**
* Run the controller and parse the login template
*/
public function run()
{
$this->Template = new BackendTemplate('be_login');
// Show a cookie warning
if (Input::get('referer', true) != '' && empty($_COOKIE)) {
$this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
}
$strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
$this->Template->theme = Backend::getTheme();
$this->Template->messages = Message::generate();
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->languages = System::getLanguages(true);
$this->Template->title = specialchars($strHeadline);
$this->Template->charset = Config::get('characterSet');
$this->Template->action = ampersand(Environment::get('request'));
$this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
$this->Template->headline = $strHeadline;
$this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
$this->Template->curUsername = Input::post('username') ?: '';
$this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
$this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
$this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
$this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
$this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
$this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
$this->Template->frontendFile = Environment::get('base');
$this->Template->disableCron = Config::get('disableCron');
$this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
$this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
$this->Template->output();
}
示例6: addButton
/**
* @param GetEditModeButtonsEvent $objEvent
*/
public function addButton(GetEditModeButtonsEvent $objEvent)
{
if (!$this->isRightContext($objEvent->getEnvironment())) {
return;
}
// Check the file cache.
$strInitFilePath = '/system/config/initconfig.php';
if (file_exists(TL_ROOT . $strInitFilePath)) {
$strFile = new \File($strInitFilePath);
$arrFileContent = $strFile->getContentAsArray();
foreach ($arrFileContent as $strContent) {
if (!preg_match("/(\\/\\*|\\*|\\*\\/|\\/\\/)/", $strContent)) {
//system/tmp.
if (preg_match("/system\\/tmp/", $strContent)) {
// Set data.
\Message::addInfo($GLOBALS['TL_LANG']['MSC']['disabled_cache']);
}
}
}
}
// Update a field with last sync information
$objSyncTime = \Database::getInstance()->prepare("SELECT cl.syncFrom_tstamp as syncFrom_tstamp, user.name as syncFrom_user, user.username as syncFrom_alias\n FROM tl_synccto_clients as cl\n INNER JOIN tl_user as user\n ON cl.syncTo_user = user.id\n WHERE cl.id = ?")->limit(1)->execute(\Input::get("id"));
if ($objSyncTime->syncFrom_tstamp != 0 && strlen($objSyncTime->syncFrom_user) != 0 && strlen($objSyncTime->syncFrom_alias) != 0) {
$strLastSync = vsprintf($GLOBALS['TL_LANG']['MSC']['last_sync'], array(date($GLOBALS['TL_CONFIG']['timeFormat'], $objSyncTime->syncFrom_tstamp), date($GLOBALS['TL_CONFIG']['dateFormat'], $objSyncTime->syncFrom_tstamp), $objSyncTime->syncFrom_user, $objSyncTime->syncFrom_alias));
// Set data
\Message::addInfo($strLastSync);
}
// Set buttons.
$objEvent->setButtons(array('start_sync' => '<input type="submit" name="start_sync" id="start_sync" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['sync']) . '" />', 'start_sync_all' => '<input type="submit" name="start_sync_all" id="start_sync_all" class="tl_submit" accesskey="o" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['syncAll']) . '" />'));
}
示例7: compile
/**
* Generate the module
*/
protected function compile()
{
\System::loadLanguageFile('tl_autoload');
// Process the request
if (\Input::post('FORM_SUBMIT') == 'tl_autoload') {
$this->createAutoloadFiles();
$this->reload();
}
$arrModules = array();
// List all modules
foreach (scan(TL_ROOT . '/system/modules') as $strFile) {
if (strncmp($strFile, '.', 1) === 0 || !is_dir(TL_ROOT . '/system/modules/' . $strFile)) {
continue;
}
$arrModules[] = $strFile;
}
$this->Template->modules = $arrModules;
$this->Template->messages = \Message::generate();
$this->Template->href = $this->getReferer(true);
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
$this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
$this->Template->headline = $GLOBALS['TL_LANG']['tl_autoload']['headline'];
$this->Template->action = ampersand(\Environment::get('request'));
$this->Template->available = $GLOBALS['TL_LANG']['tl_autoload']['available'];
$this->Template->xplAvailable = $GLOBALS['TL_LANG']['tl_autoload']['xplAvailable'];
$this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
$this->Template->override = $GLOBALS['TL_LANG']['tl_autoload']['override'];
$this->Template->xplOverride = $GLOBALS['TL_LANG']['tl_autoload']['xplOverride'];
$this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
$this->Template->autoload = $GLOBALS['TL_LANG']['tl_autoload']['autoload'];
$this->Template->ideCompat = $GLOBALS['TL_LANG']['tl_autoload']['ideCompat'];
}
示例8: cb_parseTemplate
public function cb_parseTemplate(\Template &$objTemplate)
{
global $objPage;
if (strpos($objTemplate->getName(), 'news_') === 0) {
if ($objTemplate->source == 'singlefile') {
$modelFile = \FilesModel::findByUuid($objTemplate->singlefileSRC);
try {
if ($modelFile === null) {
throw new \Exception("no file");
}
$allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
if (!in_array($modelFile->extension, $allowedDownload)) {
throw new Exception("download not allowed by extension");
}
$objFile = new \File($modelFile->path, true);
$strHref = \System::urlEncode($objFile->value);
} catch (\Exception $e) {
$strHref = "";
}
$target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
$objTemplate->more = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $GLOBALS['TL_LANG']['MSC']['more']);
$objTemplate->linkHeadline = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $objTemplate->headline);
}
}
}
示例9: compile
/**
* Generate the module
*/
protected function compile()
{
$objVotings = $this->Database->execute("\n SELECT *,\n (SELECT COUNT(*) FROM tl_voting_enquiry WHERE pid=tl_voting.id) AS total_enquiries\n FROM tl_voting\n " . (!BE_USER_LOGGED_IN ? " WHERE published=1" : "") . "\n ORDER BY start DESC\n ");
if (!$objVotings->numRows) {
return;
}
$strUrl = '';
// Get the jumpTo page
if ($this->jumpTo > 0) {
$objJump = $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($this->jumpTo);
if ($objJump->numRows) {
$strUrl = ampersand($this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s'));
}
}
$limit = $objVotings->numRows;
$count = 0;
$arrVotings = array();
// Generate votings
while ($objVotings->next()) {
$arrVotings[$objVotings->id] = $objVotings->row();
$arrVotings[$objVotings->id]['class'] = (++$count == 1 ? ' first' : '') . ($count == $limit ? ' last' : '') . ($count % 2 == 0 ? ' odd' : ' even') . ($this->isActive($objVotings) ? ' active' : '') . ($objVotings->start > time() ? ' upcoming' : '');
$arrVotings[$objVotings->id]['href'] = sprintf($strUrl, $objVotings->alias);
$arrVotings[$objVotings->id]['linkTitle'] = specialchars($objVotings->name);
$arrVotings[$objVotings->id]['period'] = $this->getPeriod($objVotings);
}
$this->Template->votings = $arrVotings;
}
示例10: generateSqlForm
/**
* Generate a HTML form with update commands and return it as string
* @return string
*/
private function generateSqlForm()
{
$count = 0;
$return = '';
$sql_command = $this->compileCommands();
if (!count($sql_command)) {
return '';
}
$arrOperations = array('CREATE' => 'Create new tables', 'ALTER_ADD' => 'Add new columns', 'ALTER_CHANGE' => 'Change existing columns', 'ALTER_DROP' => 'Drop existing columns', 'DROP' => 'Drop existing tables');
foreach ($arrOperations as $command => $label) {
if (is_array($sql_command[$command])) {
// Headline
$return .= '
<tr>
<td colspan="2" class="tl_col_0"><h3><label>' . $label . '</label></h3></td>
</tr>';
// Fields
foreach ($sql_command[$command] as $vv) {
$return .= '
<tr>
<td class="tl_col_1"><input type="checkbox" name="sql[]" id="sql_' . $count . '" class="tl_checkbox" value="' . specialchars($vv) . '"' . (stristr($command, 'DROP') === false ? ' checked="checked"' : '') . ' /></td>
<td class="tl_col_2"><pre><label for="sql_' . $count++ . '">' . $vv . '</label></pre></td>
</tr>';
}
}
}
return '
<table cellspacing="0" cellpadding="0" id="sql_table" style="margin-top:9px;" summary="Necessary database modifications">' . $return . '
</table>' . "\n";
}
示例11: generate
public function generate($row, $href, $label, $title, $icon, $attributes)
{
$href .= '&id=' . $row['id'];
if ($row['type'] == 'module') {
return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label) . '</a> ';
}
}
示例12: run
/**
* Run the controller and parse the login template
*/
public function run()
{
$this->Template = new BackendTemplate('be_files');
$this->Template->main = '';
// Ajax request
if (Environment::get('isAjaxRequest')) {
$this->objAjax = new Ajax(Input::post('action'));
$this->objAjax->executePreActions();
}
$this->Template->main .= $this->getBackendModule('files');
// Default headline
if ($this->Template->headline == '') {
$this->Template->headline = $GLOBALS['TL_CONFIG']['websiteTitle'];
}
$this->Template->theme = $this->getTheme();
$this->Template->base = Environment::get('base');
$this->Template->language = $GLOBALS['TL_LANGUAGE'];
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filetree']);
$this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
$this->Template->pageOffset = Input::cookie('BE_PAGE_OFFSET');
$this->Template->error = Input::get('act') == 'error' ? $GLOBALS['TL_LANG']['ERR']['general'] : '';
$this->Template->skipNavigation = $GLOBALS['TL_LANG']['MSC']['skipNavigation'];
$this->Template->request = ampersand(Environment::get('request'));
$this->Template->top = $GLOBALS['TL_LANG']['MSC']['backToTop'];
$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
$this->Template->loadFonts = $GLOBALS['TL_CONFIG']['loadGoogleFonts'];
$GLOBALS['TL_CONFIG']['debugMode'] = false;
$this->Template->output();
}
示例13: editArticles
public function editArticles($row, $href, $label, $title, $icon)
{
if (!$this->User->hasAccess('article', 'modules')) {
return '';
}
return $row['type'] == 'regular' || $row['type'] == 'login' || $row['type'] == 'error_403' || $row['type'] == 'error_404' ? '<a href="' . $this->addToUrl($href . '&pn=' . $row['id']) . '" title="' . specialchars($title) . '">' . Image::getHtml($icon, $label) . '</a> ' : Image::getHtml(preg_replace('/\\.gif$/i', '_.gif', $icon)) . ' ';
}
示例14: doCreateImageList
/**
* Recursively get all allowed images and return them as string
* @param integer
* @param integer
* @return string
*/
public function doCreateImageList($strFolder = null, $level = -1)
{
$arrPages = scan(TL_ROOT . '/' . $strFolder);
// Empty folder
if (empty($arrPages)) {
return '';
}
// Protected folder
if (array_search('.htaccess', $arrPages) !== false) {
return '';
}
++$level;
$strFolders = '';
$strFiles = '';
// Recursively list all images
foreach ($arrPages as $strFile) {
if (substr($strFile, 0, 1) == '.') {
continue;
}
// Folders
if (is_dir(TL_ROOT . '/' . $strFolder . '/' . $strFile)) {
$strFolders .= $this->doCreateImageList($strFolder . '/' . $strFile, $level);
} elseif (preg_match('/\\.gif$|\\.jpg$|\\.jpeg$|\\.png$/i', $strFile)) {
$strFiles .= sprintf('["%s", "%s"]', specialchars($strFolder . '/' . $strFile), $strFolder . '/' . $strFile) . ",\n";
}
}
return $strFiles . $strFolders;
}
示例15: editJavaScript
public function editJavaScript($row, $href, $label, $title, $icon, $attributes)
{
if ($this->User->isAdmin || $this->User->hasAccess('theme_plus_javascript', 'themes')) {
return '<a href="' . $this->addToUrl($href . '&id=' . $row['id']) . '" title="' . specialchars($title) . '"' . $attributes . '>' . $this->generateImage($icon, $label) . '</a> ';
}
return $this->generateImage(preg_replace('/\\.png$/i', '_.png', $icon)) . ' ';
}