本文整理汇总了PHP中cms_htmlentities函数的典型用法代码示例。如果您正苦于以下问题:PHP cms_htmlentities函数的具体用法?PHP cms_htmlentities怎么用?PHP cms_htmlentities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cms_htmlentities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_input_dropdown
public static final function create_input_dropdown($id, $name, $items, $selectedindex, $selectedvalue, $addttext = '', $required = false)
{
$id = cms_htmlentities($id);
$name = cms_htmlentities($name);
$selectedindex = cms_htmlentities($selectedindex);
$selectedvalue = cms_htmlentities($selectedvalue);
$text = '<select class="cms_dropdown" name="' . $id . $name . '" id="' . $name . '"';
if (!empty($addttext)) {
$text .= ' ' . $addttext;
}
if ($required) {
$text .= ' required="required"';
}
$text .= '>';
$count = 0;
if (is_array($items) && count($items) > 0) {
foreach ($items as $key => $value) {
$text .= '<option value="' . $value . '"';
if ($selectedindex == $count || $selectedvalue == $value) {
$text .= ' ' . 'selected="selected"';
}
$text .= '>';
$text .= $key;
$text .= '</option>';
$count++;
}
}
$text .= '</select>' . "\n";
return $text;
}
示例2: EditAsArray
function EditAsArray($adding = false, $tab = 0, $showadmin = false)
{
global $gCms;
$config = $gCms->config;
$contentops =& $gCms->GetContentOperations();
$templateops =& $gCms->GetTemplateOperations();
$ret = array();
switch ($tab) {
case 0:
array_push($ret, array(lang('title') . ':', '<input type="text" name="title" value="' . $this->mName . '">'));
array_push($ret, array(lang('menutext') . ':', '<input type="text" name="menutext" value="' . $this->mMenuText . '">'));
array_push($ret, array(lang('parent') . ':', $contentops->CreateHierarchyDropdown($this->mId, $this->mParentId)));
array_push($ret, array(lang('template') . ':', $templateops->TemplateDropdown('template_id', $this->mTemplateId)));
array_push($ret, array($this->Lang('multiplealbumtemplate') . ':', $this->TemplateDropdown('album_template', $this->GetPropertyValue('album_template'))));
array_push($ret, array($this->Lang('Albums') . ':', $this->AlbumsSelect('albums', $this->GetPropertyValue('albums'))));
break;
case 1:
array_push($ret, array(lang('pagealias') . ':', '<input type="text" name="alias" value="' . $this->mAlias . '">'));
array_push($ret, array(lang('active') . ':', '<input type="checkbox" name="active"' . ($this->mActive ? ' checked="true"' : '') . '>'));
array_push($ret, array(lang('showinmenu') . ':', '<input type="checkbox" name="showinmenu"' . ($this->mShowInMenu ? ' checked="true"' : '') . '>'));
array_push($ret, array(lang('metadata') . ':', create_textarea(false, $this->Metadata(), 'metadata', 'pagesmalltextarea', 'metadata', '', '', '80', '6')));
array_push($ret, array(lang('titleattribute') . ':', '<input type="text" name="titleattribute" maxlength="255" value="' . cms_htmlentities($this->mTitleAttribute) . '" />'));
array_push($ret, array(lang('tabindex') . ':', '<input type="text" name="tabindex" maxlength="10" value="' . cms_htmlentities($this->mTabIndex) . '" />'));
array_push($ret, array(lang('accesskey') . ':', '<input type="text" name="accesskey" maxlength="5" value="' . cms_htmlentities($this->mAccessKey) . '" />'));
if (!$adding && $showadmin) {
global $gCms;
$userops =& $gCms->GetUserOperations();
$ret[] = array(lang('owner') . ':', $userops->GenerateDropdown($this->Owner()));
}
}
return $ret;
}
示例3: smarty_cms_function_title
function smarty_cms_function_title($params, &$smarty)
{
global $gCms;
$pageinfo =& $gCms->variables['pageinfo'];
$config =& $gCms->GetConfig();
$result = '';
if (isset($pageinfo) && $pageinfo->content_id == -1) {
#We've a custom error message... set a current timestamp
$result = "404 Error";
} else {
$result = cms_htmlentities($pageinfo->content_title);
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
if (version_compare(phpversion(), "5.3.0", "<")) {
$result = ereg_replace("\\{\\/?php\\}", "", $result);
} else {
$result = preg_replace("/\\{\\/?php\\}/", "", $result);
}
}
}
if (isset($params['assign'])) {
$smarty =& $gCms->GetSmarty();
$smarty->assign($params['assign'], $result);
return;
}
return $result;
}
示例4: smarty_cms_function_startExpandCollapse
function smarty_cms_function_startExpandCollapse($params, &$smarty)
{
static $firstExpandCollapse = true;
//only gets set one time per page
global $gCms;
$config =& $gCms->GetConfig();
if (!empty($params['id']) && !empty($params['title'])) {
$id = $params['id'];
$title = $params['title'];
} else {
echo 'Error: The expand/collapse plugin requires that both parameters (id,title) are used.';
return;
}
if ($firstExpandCollapse) {
echo '<script type="text/javascript" language="javascript" src="' . $config['root_url'] . '/lib/helparea.js"></script>';
$firstExpandCollapse = false;
}
$url = cms_htmlentities($_SERVER['REQUEST_URI']);
$url = str_replace('&', '***', $url);
$url = str_replace('&', '&', $url);
$url = str_replace('***', '&', $url);
//$url = str_replace('&', '&', $_SERVER['REQUEST_URI']);
echo '<a href="' . $url . '#' . $id . '" onclick="expandcontent(\'' . $id . '\')" style="cursor:hand; cursor:pointer">' . $title . '</a><br />
<div id="' . $id . '" class="expand">';
}
示例5: WYSIWYGTextarea
/**
* Module API wrapper function
*
* @since 1.0
* @return string
*/
public static function WYSIWYGTextarea($name = 'textarea', $columns = '80', $rows = '15', $encoding = '', $content = '', $stylesheet = '', $addtext = '')
{
$mod = cms_utils::get_module('MicroTiny');
// Check if we are in object instance
if (!is_object($mod)) {
return false;
}
// TODO: some error message?
// Force WYSIWYG on
$mod->wysiwygactive = true;
// Stikki: calling this before TODO cause whole thing failing, check this Silmarillion.
if ($stylesheet != '') {
$_SESSION["microtiny_live_templateid"] = substr($stylesheet, strpos($stylesheet, "=") + 1);
} else {
$tplops = cmsms()->GetTemplateOperations();
$templateid = $tplops->LoadDefaultTemplate();
$mod->templateid = $templateid->id;
}
self::add_textarea($name);
$output = '<textarea id="' . $name . '" name="' . $name . '" cols="' . $columns . '" rows="' . ($rows + 5) . '" ' . $addtext . '>' . cms_htmlentities($content, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
global $CMS_ADMIN_PAGE;
if ($CMS_ADMIN_PAGE && $mod->CheckPermission('MicroTiny View HTML Source')) {
$output .= '<span style="display:block; margin-top:10px;"><input type="checkbox" id="toggle_' . $name . '" onclick="toggleMicroTiny(\'' . $name . '\');"/><label for="toggle_' . $name . '">' . $mod->Lang('view_html') . '</label></span>';
}
return $output;
}
示例6: smarty_function_anchor
function smarty_function_anchor($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
#Added by Russ for class, tabindex and title for anchor 2006/07/19
$class = "";
$title = "";
$tabindex = "";
$accesskey = "";
if (isset($params['class'])) {
$class = ' class="' . $params['class'] . '"';
}
if (isset($params['title'])) {
$title = ' title="' . $params['title'] . '"';
}
if (isset($params['tabindex'])) {
$tabindex = ' tabindex="' . $params['tabindex'] . '"';
}
if (isset($params['accesskey'])) {
$accesskey = ' accesskey="' . $params['accesskey'] . '"';
}
#End of first part added by Russ 2006/07/19
$pageURL = 'http';
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
$pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
$str = $_SERVER['REQUEST_URI'];
$pos = strpos($str, '?');
if ($pos !== FALSE) {
$str = substr($str, 0, $pos);
}
$pageURL .= $_SERVER["SERVER_NAME"] . $str;
}
if (isset($pageURL)) {
$url = cms_htmlentities($_SERVER['REQUEST_URI']) . '#' . $params['anchor'];
$url = str_replace('&', '***', $url);
$url = str_replace('&', '&', $url);
$url = str_replace('***', '&', $url);
if (isset($params['onlyhref']) && ($params['onlyhref'] == '1' || $params['onlyhref'] == 'true')) {
#Note if you set 'onlyheref' that is what you get - no class or title or tabindex or text
$tmp = $url;
} else {
#Line replaced by Russ
# echo '<a href="'.$url.'">'.$params['text'].'</a>';
#Line replaced with - by Russ to reflect class and title for anchor 2006/07/19
$tmp = '<a href="' . $url . '"' . $class . $title . $tabindex . $accesskey . '>' . $params['text'] . '</a>';
}
#End of second part added by Russ 2006/07/19
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $tmp);
return;
}
echo $tmp;
}
示例7: smarty_cms_function_current_date
function smarty_cms_function_current_date($params, &$smarty)
{
if (empty($params['format'])) {
$format = "%b %e, %Y";
} else {
$format = $params['format'];
}
$string = strftime($format, time());
if ($params['ucwords']) {
$string = ucwords($string);
}
return cms_htmlentities($string);
}
示例8: smarty_cms_function_current_date
function smarty_cms_function_current_date($params, &$smarty)
{
$format = '%b %c, %Y';
if (isset($params['format']) && !empty($params['format'])) {
$format = trim($params['format']);
}
$string = strftime($format, time());
if (isset($params['ucwords']) && $params['ucwords'] != '') {
$string = ucwords($string);
}
$out = cms_htmlentities($string);
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $out);
return;
}
return $out;
}
示例9: smarty_cms_function_get_template_vars
function smarty_cms_function_get_template_vars($params, &$smarty)
{
global $gCms;
$tpl_vars = $gCms->smarty->get_template_vars();
$str = '<pre>';
foreach ($tpl_vars as $key => $value) {
if (is_object($value)) {
$str .= "{$key} = Object<br/>";
} else {
if (is_array($value)) {
$str .= "{$key} = Array (" . count($value) . ")<br/>";
} else {
$str .= "{$key} = " . cms_htmlentities(trim($value)) . "<br/>";
}
}
}
return $str . '</pre>';
}
示例10: smarty_cms_function_modified_date
function smarty_cms_function_modified_date($params, &$smarty)
{
$gCms = cmsms();
$content_obj = $gCms->variables['content_obj'];
if (empty($params['format'])) {
$format = "%x %X";
} else {
$format = $params['format'];
}
if (is_object($content_obj) && $content_obj->GetModifiedDate() && $content_obj->GetModifiedDate() > -1) {
$time = $content_obj->GetModifiedDate();
$str = cms_htmlentities(strftime($format, $time));
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $str);
return;
}
return $str;
}
}
示例11: smarty_function_created_date
function smarty_function_created_date($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
$content_obj = $gCms->variables['content_obj'];
if (empty($params['format'])) {
$format = "%x %X";
} else {
$format = $params['format'];
}
if (is_object($content_obj) && $content_obj->GetCreationDate() > -1) {
$time = $content_obj->GetCreationDate();
$str = cms_htmlentities(strftime($format, $time));
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $str);
return;
}
return $str;
}
}
示例12: smarty_cms_function_get_template_vars
function smarty_cms_function_get_template_vars($params, &$smarty)
{
$tpl_vars = $smarty->get_template_vars();
$str = '<pre>';
foreach ($tpl_vars as $key => $value) {
if (is_object($value)) {
$str .= "{$key} = Object<br/>";
} else {
if (is_array($value)) {
$str .= "{$key} = Array (" . count($value) . ")<br/>";
} else {
$str .= "{$key} = " . cms_htmlentities(trim($value)) . "<br/>";
}
}
}
$str . '</pre>';
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $str);
return;
}
return $str;
}
示例13: smarty_function_title
function smarty_function_title($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
$contentobj = $gCms->variables['content_obj'];
$config = $gCms->GetConfig();
$result = '';
if (!is_object($contentobj)) {
#We've a custom error message... set a current timestamp
$result = "404 Error";
} else {
$result = cms_htmlentities($contentobj->Name());
if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
$result = preg_replace("/\\{\\/?php\\}/", "", $result);
}
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $result);
return;
}
return $result;
}
示例14: smarty_function_last_modified_by
function smarty_function_last_modified_by($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
$content_obj = $gCms->variables['content_obj'];
$id = "";
if (isset($content_obj) && $content_obj->LastModifiedBy() > -1) {
$id = $content_obj->LastModifiedBy();
} else {
return "";
}
if (empty($params['format'])) {
$format = "id";
} else {
$format = $params['format'];
$userops =& $gCms->GetUserOperations();
$thisuser =& $userops->LoadUserByID($id);
}
$output = '';
if ($format === "id") {
$output = $id;
} else {
if ($format === "username") {
$output = cms_htmlentities($thisuser->username);
} else {
if ($format === "fullname") {
$output = cms_htmlentities($thisuser->firstname . " " . $thisuser->lastname);
}
}
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $output);
return;
}
return $output;
}
示例15: smarty_cms_function_last_modified_by
function smarty_cms_function_last_modified_by($params, &$smarty)
{
global $gCms;
$pageinfo = $gCms->variables['pageinfo'];
$id = "";
if (isset($pageinfo) && $pageinfo->content_last_modified_by_id > -1) {
$id = $pageinfo->content_last_modified_by_id;
} else {
return "";
}
if (empty($params['format'])) {
$format = "id";
} else {
$format = $params['format'];
$userops =& $gCms->GetUserOperations();
$thisuser =& $userops->LoadUserByID($id);
}
$output = '';
if ($format === "id") {
$output = $id;
} else {
if ($format === "username") {
$output = cms_htmlentities($thisuser->username);
} else {
if ($format === "fullname") {
$output = cms_htmlentities($thisuser->firstname . " " . $thisuser->lastname);
}
}
}
if (isset($params['assign'])) {
$smarty = $gCms->GetSmarty();
$smarty->assign($params['assign'], $output);
return;
}
return $output;
}