本文整理汇总了PHP中common::LabelSpecialChars方法的典型用法代码示例。如果您正苦于以下问题:PHP common::LabelSpecialChars方法的具体用法?PHP common::LabelSpecialChars怎么用?PHP common::LabelSpecialChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::LabelSpecialChars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowTitles
/**
* Display a list of all the titles using the current layout
*
*/
function ShowTitles()
{
global $langmessage;
//affected titles
$titles_count = $this->TitlesCount($this->curr_layout);
echo '<h2>' . $langmessage['titles_using_layout'];
echo ': ' . $titles_count;
echo '</h2>';
if ($titles_count > 0) {
echo '<ul class="titles_using">';
foreach ($this->LayoutArray as $index => $layout_comparison) {
if ($this->curr_layout == $layout_comparison) {
$title = common::IndexToTitle($index);
if (empty($title)) {
continue;
//may be external link
}
echo "\n<li>";
$label = common::GetLabel($title);
$label = common::LabelSpecialChars($label);
echo common::Link($title, $label);
echo '</li>';
}
}
echo '</ul>';
echo '<div class="clear"></div>';
}
}
示例2: LabelHtml
/**
* Fix the html for page labels
*
*/
static function LabelHtml($string)
{
//prepend with space for preg_split(), space will be trimmed at the end
$string = ' ' . $string;
//change non html entity uses of & to & (not exact but should be sufficient)
$pieces = preg_split('#(&(?:\\#[0-9]{2,4}|[a-zA-Z0-9]{2,8});)#', $string, 0, PREG_SPLIT_DELIM_CAPTURE);
$string = '';
for ($i = 0; $i < count($pieces); $i++) {
if ($i % 2) {
$string .= $pieces[$i];
} else {
$string .= str_replace('&', '&', $pieces[$i]);
}
}
//change non html tag < and > into < and >
$pieces = preg_split('#(<(?:/?)[a-zA-Z0-9][^<>]*>)#', $string, 0, PREG_SPLIT_DELIM_CAPTURE);
$string = '';
for ($i = 0; $i < count($pieces); $i++) {
if ($i % 2) {
$string .= $pieces[$i];
} else {
$string .= common::LabelSpecialChars($pieces[$i]);
}
}
//only allow tags that are legal to be inside <a> except for <script>.Per http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_a.content
$string = strip_tags($string, '<abbr><acronym><b><big><bdo><br><button><cite><code><del><dfn><em><kbd><i><img><input><ins><label><map><object><q><samp><select><small><span><sub><sup><strong><textarea><tt><var>');
return trim($string);
}
示例3: TitleSettings
/**
* Language selection popup
*
*/
public function TitleSettings($args = array())
{
global $gp_titles, $langmessage, $langmessage, $gp_index;
$args += array('to_lang' => '', 'to_slug' => '');
$page_index = $_REQUEST['index'];
if (!isset($gp_titles[$page_index])) {
echo $langmessage['OOPS'] . ' (Invalid Title - 3)';
return;
}
$list = $this->GetList($page_index);
echo '<div>';
echo '<form method="post" action="' . common::GetUrl('Admin_MultiLang') . '">';
echo '<input type="hidden" name="cmd" value="TitleSettingsSave" />';
echo '<input type="hidden" name="index" value="' . $page_index . '" />';
echo '<h3>Page Settings</h3>';
echo '<table class="bordered"><tr><th>Language</th><th>Title</th><th>Options</th></tr>';
//not set yet
if (!$list) {
$in_menu = $this->InMenu($page_index);
echo '<tr><td>';
if ($in_menu) {
echo $this->language;
} else {
$this->Select('from_lang', '#lang_data');
}
echo '</td><td>';
$title = common::IndexToTitle($page_index);
echo common::Link_Page($title);
echo '</td><td>';
echo '</td></tr>';
}
//current settings
foreach ($this->avail_langs as $lang => $language) {
if (!isset($list[$lang])) {
continue;
}
$index = $list[$lang];
echo '<tr><td>';
echo $language . ' (' . $lang . ')';
echo '</td><td>';
$title = common::IndexToTitle($index);
echo common::Link_Page($title);
echo '</td><td>';
echo common::Link('Admin_MultiLang', 'Remove', 'cmd=RemoveTitle&index=' . $page_index . '&rmindex=' . $index, 'name="gpabox" class="gpconfirm" title="Remove this entry?"');
echo '</td></tr>';
}
//option to add another title
echo '<tr><td>';
$this->Select('to_lang', '#lang_data', $args['to_lang']);
echo '</td><td>';
$this->Select('to_slug', '#lang_titles', $args['to_slug']);
echo '</td><td>';
echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpabox gpbutton" /> ';
echo '</td></tr>';
echo '</table>';
echo '</form>';
$this->SmLinks();
//add languages as json
$data = array();
foreach ($this->langs as $code => $label) {
$data[] = array($label, $code);
}
echo "\n";
echo '<span id="lang_data" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT) . '\'></span>';
//add titles as json
$data = array();
foreach ($gp_index as $slug => $index) {
$label = common::GetLabelIndex($index);
$data[] = array($slug, common::LabelSpecialChars($label));
}
echo "\n";
echo '<span id="lang_titles" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT, 'UTF-8', false) . '\'></span>';
echo '</div>';
}
示例4: CopyForm
/**
* Display a form for copying a page
*
*/
function CopyForm()
{
global $langmessage, $gp_index, $page;
$from_title = $_REQUEST['title'];
if (!isset($gp_index[$from_title])) {
message($langmessage['OOPS_TITLE']);
return false;
}
$from_label = common::GetLabel($from_title);
$from_label = common::LabelSpecialChars($from_label);
echo '<div class="inline_box">';
echo '<form method="post" action="' . common::GetUrl('Admin_Menu') . '">';
if (isset($_REQUEST['redir'])) {
echo '<input type="hidden" name="redir" value="redir"/> ';
}
echo '<input type="hidden" name="from_title" value="' . htmlspecialchars($from_title) . '"/> ';
echo '<table class="bordered full_width" id="gp_rename_table">';
echo '<thead><tr><th colspan="2">';
echo $langmessage['Copy'];
echo '</th></tr></thead>';
echo '<tr class="line_row"><td>';
echo $langmessage['from'];
echo '</td><td>';
echo $from_label;
echo '</td></tr>';
echo '<tr><td>';
echo $langmessage['to'];
echo '</td><td>';
echo '<input type="text" name="title" maxlength="100" size="50" value="' . $from_label . '" class="gpinput" />';
echo '</td></tr>';
echo '</table>';
echo '<p>';
echo '<input type="hidden" name="cmd" value="copyit"/> ';
echo '<input type="submit" name="" value="' . $langmessage['continue'] . '" class="gppost gpsubmit"/>';
echo '<input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />';
echo '</p>';
echo '</form>';
echo '</div>';
}
示例5: InheritingLayout
function InheritingLayout($searchLevel, &$menu, &$result)
{
global $gp_titles;
$children = true;
do {
$menu_key = key($menu);
$info = current($menu);
if (!isset($info['level'])) {
break;
}
$level = $info['level'];
if ($level < $searchLevel) {
return;
}
if ($level > $searchLevel) {
if ($children) {
page_layout::InheritingLayout($level, $menu, $result);
} else {
unset($menu[$menu_key]);
}
continue;
}
unset($menu[$menu_key]);
if (!empty($gp_titles[$menu_key]['gpLayout'])) {
$children = false;
continue;
}
$children = true;
//exclude external links
if ($menu_key[0] == '_') {
continue;
}
$label = common::GetLabelIndex($menu_key, false);
$result[] = common::LabelSpecialChars($label);
} while (count($menu) > 0);
}
示例6: ShowDetails
//.........这里部分代码省略.........
echo $langmessage['default'];
}
echo '</td></tr>';
echo '</table>';
// gadgets
echo '<br/>';
echo '<table class="bordered full_width">';
$gadget_info = gpOutput::WhichGadgets($this->curr_layout);
echo '<tr><th style="width:40%">';
echo $langmessage['gadgets'];
echo '</th><th> </th></tr>';
if (!isset($config['gadgets']) || count($config['gadgets']) == 0) {
echo '<tr><td colspan="2">';
echo $langmessage['Empty'];
echo '</td></tr>';
} else {
foreach ($config['gadgets'] as $gadget => $temp) {
echo '<tr><td>';
echo str_replace('_', ' ', $gadget);
echo '</td><td>';
if (isset($gadget_info[$gadget])) {
if (!isset($_GET['show'])) {
echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget), ' name="creq" ');
} else {
echo common::Link('Admin_Theme_Content', $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget) . '&layout=' . rawurlencode($layout), ' name="creq" ');
}
} else {
echo $langmessage['disabled'];
}
echo '</td></tr>';
}
}
echo '</table>';
//CSS options
echo '<br/>';
if (!isset($_GET['show'])) {
echo '<form action="' . common::GetUrl('Admin_Theme_Content/' . rawurlencode($layout)) . '" method="post">';
} else {
echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">';
echo '<input type="hidden" name="layout" value="' . $layout . '" />';
}
echo '<input type="hidden" name="cmd" value="css_preferences" />';
echo '<table class="bordered full_width">';
echo '<tr><th style="width:40%">CSS</th><th> </th></tr>';
echo '<tr><td>';
echo 'Name Based Menu Classes';
echo '</td><td>';
$checked = '';
if (!isset($layout_info['menu_css_ordered'])) {
$checked = 'checked="checked"';
}
echo '<input type="checkbox" name="menu_css_ordered" value="on" ' . $checked . ' />';
echo '</td></tr>';
echo '<tr><td>';
echo 'Ordered Menu Classes';
echo '</td><td>';
$checked = '';
if (!isset($layout_info['menu_css_indexed'])) {
$checked = 'checked="checked"';
}
echo '<input type="checkbox" name="menu_css_indexed" value="on" ' . $checked . ' />';
echo '</td></tr>';
echo '<tr><td>';
echo ' ';
echo '</td><td>';
echo ' <input type="submit" name="" value="' . htmlspecialchars($langmessage['save']) . '" class="gpbutton" />';
echo '</td></tr>';
echo '</table>';
echo '</form>';
//affected titles
$titles_count = $this->TitlesCount($layout);
echo '<br/>';
echo '<table class="bordered full_width">';
echo '<tr><th colspan="2">';
echo $langmessage['titles_using_layout'];
echo ': ' . $titles_count;
echo '</th></tr>';
echo '<tr><td colspan="2">';
if ($titles_count > 0) {
echo '<ul class="titles_using">';
foreach ($this->LayoutArray as $index => $layout_comparison) {
if ($layout == $layout_comparison) {
$title = common::IndexToTitle($index);
if (empty($title)) {
continue;
//may be external link
}
echo "\n<li>";
$label = common::GetLabel($title);
$label = common::LabelSpecialChars($label);
echo common::Link($title, $label);
echo '</li>';
}
}
echo '</ul>';
echo '<div class="clear"></div>';
}
echo '</td></tr>';
echo '</table>';
}
示例7: RenameForm
static function RenameForm($index, $action)
{
global $langmessage, $page, $gp_index, $gp_titles;
$label = common::GetLabelIndex($index);
$title = common::IndexToTitle($index);
$title_info = $gp_titles[$index];
if (empty($_REQUEST['new_title'])) {
$new_title = common::LabelSpecialChars($label);
} else {
$new_title = htmlspecialchars($_REQUEST['new_title']);
}
$new_title = str_replace('_', ' ', $new_title);
//show more options?
$hidden_rows = false;
ob_start();
echo '<div class="inline_box">';
echo '<form action="' . $action . '" method="post" id="gp_rename_form">';
echo '<input type="hidden" name="old_title" value="' . htmlspecialchars(str_replace('_', ' ', $title)) . '" />';
echo '<h2>' . $langmessage['rename/details'] . '</h2>';
echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" />';
echo '<table class="bordered full_width" id="gp_rename_table">';
echo '<thead>';
echo '<tr>';
echo '<th colspan="2">';
echo $langmessage['options'];
echo '</th>';
echo '</tr>';
echo '</thead>';
//label
echo '<tbody>';
echo '<tr><td class="formlabel">' . $langmessage['label'] . '</td>';
echo '<td><input type="text" class="title_label gpinput" name="new_label" maxlength="100" size="50" value="' . $new_title . '" />';
echo '</td></tr>';
//slug
$attr = '';
$class = 'new_title';
$editable = true;
if ($title == admin_tools::LabelToSlug($label)) {
$attr = 'disabled="disabled" ';
$class .= ' sync_label';
}
echo '<tr><td class="formlabel">' . $langmessage['Slug/URL'] . '</td>';
echo '<td><input type="text" class="' . $class . ' gpinput" name="new_title" maxlength="100" size="50" value="' . htmlspecialchars($title) . '" ' . $attr . '/>';
if ($editable) {
echo ' <div class="label_synchronize">';
if (empty($attr)) {
echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>';
echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>';
} else {
echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>';
echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>';
}
echo '</div>';
}
echo '</td>';
echo '</tr>';
//browser title defaults to label
$attr = '';
$class = 'browser_title';
if (isset($title_info['browser_title'])) {
echo '<tr>';
$browser_title = $title_info['browser_title'];
} else {
echo '<tr class="nodisplay">';
$hidden_rows = true;
$browser_title = $label;
$attr = 'disabled="disabled" ';
$class .= ' sync_label';
}
echo '<td class="formlabel">';
echo $langmessage['browser_title'];
echo '</td>';
echo '<td>';
echo '<input type="text" class="' . $class . ' gpinput" size="50" name="browser_title" value="' . $browser_title . '" ' . $attr . '/>';
echo ' <div class="label_synchronize">';
if (empty($attr)) {
echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>';
echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>';
} else {
echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>';
echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>';
}
echo '</div>';
echo '</td>';
echo '</tr>';
//meta keywords
$keywords = '';
if (isset($title_info['keywords'])) {
echo '<tr>';
$keywords = $title_info['keywords'];
} else {
echo '<tr class="nodisplay">';
$hidden_rows = true;
}
echo '<td class="formlabel">';
echo $langmessage['keywords'];
echo '</td>';
echo '<td>';
echo '<input type="text" class="gpinput" size="50" name="keywords" value="' . $keywords . '" />';
echo '</td>';
//.........这里部分代码省略.........
示例8: TitleSelect
function TitleSelect($default_index, $exclude = array())
{
global $gp_index, $gp_titles, $langmessage;
$exclude = (array) $exclude;
echo '<div>';
$data = array();
foreach ($gp_index as $url => $index) {
if (in_array($index, $exclude)) {
continue;
}
$label = common::GetLabelIndex($index);
$data[] = array(common::LabelSpecialChars($label), $url);
}
//$data = array_slice($data,107,1);
echo '<span class="data" style="display:none">';
$data = json_encode($data);
echo htmlspecialchars($data, ENT_NOQUOTES);
echo '</span>';
$default_url = '';
if ($default_index) {
$default_url = common::IndexToTitle($default_index);
}
echo '<span class="gpinput combobox">';
echo '<input type="text" name="title" value="' . htmlspecialchars($default_url) . '" class="combobox"/>';
echo '</span>';
echo '</div>';
}