本文整理汇总了PHP中common::GetLabelIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP common::GetLabelIndex方法的具体用法?PHP common::GetLabelIndex怎么用?PHP common::GetLabelIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::GetLabelIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CommentRow
function CommentRow($page_index, $comment)
{
global $gp_index, $gp_titles, $langmessage;
$key =& $comment['key'];
echo '<tr class="easy_comment_' . $page_index . '_' . $key . '">';
echo '<td>';
$title = common::IndexToTitle($page_index);
$label = common::GetLabelIndex($page_index);
echo common::Link($title, $label);
echo '</td>';
echo '<td>';
echo date('D, j M Y H:i', $comment['time']);
echo '</td>';
echo '<td>';
if (!empty($comment['website'])) {
echo '<b><a href="' . $comment['website'] . '">' . $comment['name'] . '</a></b>';
} else {
echo 'no website';
echo $comment['name'];
}
echo '</td>';
echo '<td>';
echo $comment['abbr'];
echo '</td>';
echo '<td>';
echo common::Link('Admin_Easy_Comments', $langmessage['delete'], 'cmd=easy_admin_rm&pg=' . $page_index . '&i=' . $key, ' name="gpajax"');
echo '</td>';
echo '</tr>';
}
示例2: BlogSearch
function BlogSearch($args)
{
global $addonPathData;
$this->Init();
$search_obj = $args[0];
$label = common::GetLabelIndex('special_blog');
$full_path = $addonPathData . '/index.php';
// config of installed addon to get to know how many post files are
if (!file_exists($full_path)) {
return;
}
require $full_path;
$fileIndexMax = floor($blogData['post_index'] / 20);
// '20' I found in SimpleBlogCommon.php function GetPostFile (line 62)
for ($fileIndex = 0; $fileIndex <= $fileIndexMax; $fileIndex++) {
$postFile = $addonPathData . '/posts_' . $fileIndex . '.php';
if (!file_exists($postFile)) {
continue;
}
require $postFile;
foreach ($posts as $id => $post) {
$title = $label . ': ' . str_replace('_', ' ', $post['title']);
$content = str_replace('_', ' ', $post['title']) . ' ' . $post['content'];
SimpleBlogCommon::UrlQuery($id, $url, $query);
$search_obj->FindString($content, $title, $url, $query);
}
$posts = array();
}
}
示例3: __construct
function __construct($args)
{
SimpleBlogCommon::Init();
$search_obj = $args[0];
$blog_label = common::GetLabelIndex('special_blog');
$post_ids = SimpleBlogCommon::AStrToArray('str_index');
foreach ($post_ids as $id) {
$post = SimpleBlogCommon::GetPostContent($id);
if (!$post) {
continue;
}
$title = $blog_label . ': ' . str_replace('_', ' ', $post['title']);
$content = str_replace('_', ' ', $post['title']) . ' ' . $post['content'];
SimpleBlogCommon::UrlQuery($id, $url, $query);
$search_obj->FindString($content, $title, $url, $query);
}
}
示例4: 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>';
}
示例5: FilePermissions
/**
* Display the permission options for a file
*
*/
function FilePermissions()
{
global $gp_titles, $langmessage;
$indexes = $this->RequestedIndexes();
if (!$indexes) {
return;
}
$count = count($indexes);
$first_index = $indexes[0];
echo '<div class="inline_box">';
echo '<form action="' . common::GetUrl('Admin_Users') . '" method="post">';
echo '<input type="hidden" name="cmd" value="save_file_permissions">';
echo '<input type="hidden" name="index" value="' . htmlspecialchars($_REQUEST['index']) . '">';
//heading
echo '<h2>' . common::Link('Admin_Users', $langmessage['user_permissions']) . ' » <i>';
if ($count > 1) {
echo sprintf($langmessage['%s Pages'], $count);
} else {
echo strip_tags(common::GetLabelIndex($indexes[0]));
}
echo '</i></h2>';
//list of files
if ($count > 1) {
$labels = array();
foreach ($indexes as $index) {
$labels[] = strip_tags(common::GetLabelIndex($index));
}
echo '<p>';
echo implode(', ', $labels);
echo '</p>';
}
//list of users
echo '<div class="all_checkboxes">';
foreach ($this->users as $username => $userinfo) {
$attr = '';
if ($userinfo['editing'] == 'all') {
$attr = ' checked="checked" disabled="disabled"';
} elseif (strpos($userinfo['editing'], ',' . $first_index . ',') !== false) {
$attr = ' checked="checked"';
}
echo '<label class="all_checkbox">';
echo '<input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/>';
echo $username;
echo '</label> ';
}
echo '</div>';
echo '<p>';
echo '<input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpabox gpsubmit" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</p>';
echo '</form>';
echo '</div>';
}
示例6: GetSearchList
/**
* Get a list of titles matching the search criteria
*
*/
function GetSearchList()
{
global $gp_index;
$key =& $_REQUEST['q'];
if (empty($key)) {
return array();
}
$key = strtolower($key);
$show_list = array();
foreach ($gp_index as $title => $index) {
if (strpos(strtolower($title), $key) !== false) {
$show_list[$index] = $title;
continue;
}
$label = common::GetLabelIndex($index);
if (strpos(strtolower($label), $key) !== false) {
$show_list[$index] = $title;
continue;
}
}
return $show_list;
}
示例7: 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);
}
示例8: HomepageDisplay
function HomepageDisplay()
{
global $langmessage, $config;
$label = common::GetLabelIndex($config['homepath_key']);
echo '<span class="gpicon_home"></span>';
echo $langmessage['Homepage'] . ': ';
echo common::Link('Admin_Menu', $label, 'cmd=homepage_select', 'data-cmd="gpabox"');
}
示例9: GetPagesPHP
/**
* Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php
*
*/
static function GetPagesPHP()
{
global $gp_index, $gp_titles, $gp_menu, $gpLayouts, $config;
$gp_index = array();
$pages = gpFiles::Get('_site/pages');
//update for < 2.0a3
if (array_key_exists('gpmenu', $pages) && array_key_exists('gptitles', $pages) && !array_key_exists('gp_titles', $pages) && !array_key_exists('gp_menu', $pages)) {
foreach ($pages['gptitles'] as $title => $info) {
$index = common::NewFileIndex();
$gp_index[$title] = $index;
$gp_titles[$index] = $info;
}
foreach ($pages['gpmenu'] as $title => $level) {
$index = $gp_index[$title];
$gp_menu[$index] = array('level' => $level);
}
return;
}
$gpLayouts = $pages['gpLayouts'];
$gp_index = $pages['gp_index'];
$gp_titles = $pages['gp_titles'];
$gp_menu = $pages['gp_menu'];
if (!is_array($gp_menu)) {
common::stop();
}
//update for 3.5,
if (!isset($gp_titles['special_gpsearch'])) {
$gp_titles['special_gpsearch'] = array();
$gp_titles['special_gpsearch']['label'] = 'Search';
$gp_titles['special_gpsearch']['type'] = 'special';
$gp_index['Search'] = 'special_gpsearch';
//may overwrite special_search settings
}
//fix the gpmenu
if (version_compare(gpFiles::$last_version, '3.0b1', '<')) {
$gp_menu = gpOutput::FixMenu($gp_menu);
// fix gp_titles for gpEasy 3.0+
// just make sure any ampersands in the label are escaped
foreach ($gp_titles as $key => $value) {
if (isset($gp_titles[$key]['label'])) {
$gp_titles[$key]['label'] = common::GetLabelIndex($key, true);
}
}
}
//title related configuration settings
if (empty($config['homepath_key'])) {
$config['homepath_key'] = key($gp_menu);
}
$config['homepath'] = common::IndexToTitle($config['homepath_key']);
}
示例10: FilePermissions
/**
* Display the permission options for a file
*
*/
function FilePermissions()
{
global $gp_titles, $langmessage;
$index = $_REQUEST['index'];
if (!isset($gp_titles[$index])) {
message($langmessage['OOPS'] . ' (Invalid Title)');
return;
}
echo '<div class="inline_box">';
echo '<form action="' . common::GetUrl('Admin_Users') . '" method="post">';
echo '<input type="hidden" name="cmd" value="save_file_permissions">';
echo '<input type="hidden" name="index" value="' . $index . '">';
$label = strip_tags(common::GetLabelIndex($index));
//echo '<h3>'.sprintf($langmessage['Permissions_for'],$label).'</h3>';
echo '<h2>' . common::Link('Admin_Users', $langmessage['user_permissions']) . ' » <i>' . $label . '</i></h2>';
echo '<div class="all_checkboxes">';
foreach ($this->users as $username => $userinfo) {
$attr = '';
if ($userinfo['editing'] == 'all') {
$attr = ' checked="checked" disabled="disabled"';
} elseif (strpos($userinfo['editing'], ',' . $index . ',') !== false) {
$attr = ' checked="checked"';
}
echo '<label class="all_checkbox"><input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/> ' . $username . '</label> ';
}
echo '</div>';
echo '<p>';
echo '<input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpabox gpsubmit" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
echo '</p>';
echo '</form>';
echo '</div>';
}
示例11: 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>';
//.........这里部分代码省略.........
示例12: foreach
if (!array_key_exists('datafilter', $config)) {
$config['datafilter'] = "";
}
if ($config['wap']) {
$page->head_js[] = $addonRelativeCode . '/js/catalog_wap.js';
} else {
$page->head_js[] = $addonRelativeCode . '/js/catalog.js';
}
if (common::LoggedIn()) {
$page->head .= "\n" . '<script type="text/javascript">gpFinder_url = "' . common::GetUrl('Admin_Browser') . '";</script>' . "\n";
$page->head_js[] = $addonRelativeCode . '/js/catalog_menu.js';
$pageIndexJS = 'var gpE_availablelabels = [';
$i = 0;
foreach ($gp_index as $key => $value) {
$i++;
$pageIndexJS .= '"' . common::GetLabelIndex($value) . '"' . ($i == count($gp_index) ? '' : ', ');
}
$pageIndexJS .= '];';
$page->head_script .= "\n" . $pageIndexJS . "\n";
if (array_key_exists("menus", $GLOBALS['config']) and $GLOBALS['config']['menus'] != "") {
$menus = 'var gpE_menus = {';
$i = 0;
foreach ($GLOBALS['config']['menus'] as $key => $value) {
$i++;
$menus .= '"' . $key . '":"' . $value . '"' . ($i == count($GLOBALS['config']['menus']) ? '' : ', ');
}
$menus .= '};';
$page->head_script .= "\n" . $menus . "\n";
} else {
$menus = 'var gpE_menus = {';
$menus .= '};';
示例13: 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>';
}
示例14: GetPagesPHP
/**
* Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php
*
*/
function GetPagesPHP()
{
global $gp_index, $gp_titles, $gp_menu, $dataDir, $gpLayouts;
$gp_index = array();
$pages = array();
require $dataDir . '/data/_site/pages.php';
$GLOBALS['fileModTimes']['pages.php'] = $fileModTime;
$gpLayouts = $pages['gpLayouts'];
//update for < 2.0a3
if (isset($pages['gpmenu']) && isset($pages['gptitles'])) {
//1.7b2
if (!isset($pages['gptitles']['Special_Missing'])) {
$pages['gptitles']['Special_Missing']['type'] = 'special';
$pages['gptitles']['Special_Missing']['label'] = 'Missing';
}
foreach ($pages['gptitles'] as $title => $info) {
$index = common::NewFileIndex();
$gp_index[$title] = $index;
$gp_titles[$index] = $info;
}
foreach ($pages['gpmenu'] as $title => $level) {
$index = $gp_index[$title];
$gp_menu[$index] = array('level' => $level);
}
return;
}
$gp_index = $pages['gp_index'];
$gp_titles = $pages['gp_titles'];
$gp_menu = $pages['gp_menu'];
//fix the gpmenu
if (version_compare($fileVersion, '3.0b1', '<')) {
$gp_menu = gpOutput::FixMenu($gp_menu);
// fix gp_titles for gpEasy 3.0+
// just make sure any ampersands in the label are escaped
foreach ($gp_titles as $key => $value) {
if (isset($gp_titles[$key]['label'])) {
$gp_titles[$key]['label'] = common::GetLabelIndex($key, true);
}
}
}
}
示例15: CheckifNav
function CheckifNav($indexofparent)
{
global $gp_titles;
$page_label = common::GetLabelIndex($indexofparent);
if (isset($this->catpages) and $this->catpages != "") {
foreach ($this->catpages as $catpage) {
if (mb_strtolower($page_label) == mb_strtolower($catpage['label'])) {
if ($catpage['navi'] and $catpage['source'] == 0) {
return true;
}
}
if (mb_strtolower($page_label) == mb_strtolower($catpage['sourcepages'])) {
if ($catpage['navi'] and $catpage['source'] == 1) {
return true;
}
}
if (mb_strtolower($page_label) == mb_strtolower($catpage['sourcepages'])) {
if ($catpage['navi'] and $catpage['source'] == 2) {
$this->another_parent = $indexofparent;
$index = Catalog_Easy::array_find_deep($gp_titles, $catpage['label']);
$page_index = $index[0];
$this->page_cat = $page_index;
return true;
}
}
}
}
return false;
}