本文整理汇总了PHP中common::IndexToTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP common::IndexToTitle方法的具体用法?PHP common::IndexToTitle怎么用?PHP common::IndexToTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::IndexToTitle方法的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: AdminProtect
function AdminProtect()
{
global $gp_menu;
$this->PageProtect();
echo '<h2>';
echo common::Link('Admin_Protect', 'Protected Pages');
echo '</h2>';
$cmd = common::GetCommand();
switch ($cmd) {
case 'savecontent':
$this->SaveContent();
case 'editcontent':
$this->EditContent();
return;
}
echo '<p>';
echo '<b>' . common::Link('Admin_Protect', 'Protected Content', 'cmd=editcontent') . '</b> ';
echo 'Edit the content users will see if they navigate to a protected page and aren\'t logged in.';
echo '</p>';
if (!count($this->config['pages'])) {
echo '<p>There aren\'t any protected pages.</p>';
return;
}
echo '<table class="bordered">';
echo '<tr><th>Pages</th><th>Child Pages</th></tr>';
foreach ($this->config['pages'] as $page_index => $bool) {
$title = common::IndexToTitle($page_index);
//may be deleted
if (!$title) {
continue;
}
echo '<tr>';
echo '<td>';
echo common::Link_Page($title);
echo '</td>';
echo '<td>';
$affected = common::Descendants($page_index, $gp_menu);
$titles = array();
foreach ($affected as $temp_index) {
$title = common::IndexToTitle($temp_index);
$titles[] = common::Link_Page($title);
}
echo implode(', ', $titles);
echo '</td>';
echo '</tr>';
}
echo '</table>';
}
示例3: xml
function xml()
{
global $gp_menu;
header('Content-Type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($gp_menu as $key => $info) {
$title = common::IndexToTitle($key);
if (isset($info['level'])) {
echo "\n";
echo '<url>';
echo '<loc>';
echo isset($info['url']) ? $info['url'] : 'http://' . $_SERVER['SERVER_NAME'] . common::GetUrl($title);
echo '</loc>';
echo '</url>';
}
}
echo '</urlset>';
die;
}
示例4: Show
function Show($indexofparent)
{
global $addonRelativeCode;
if ($this->nav_style == 0) {
$next = gpOutput::SelectText('Next');
$back = gpOutput::SelectText('Previous');
} elseif ($this->nav_style == 1) {
$back = '<img src="' . $addonRelativeCode . '/img/arrow1-back.png' . '" />';
$next = '<img src="' . $addonRelativeCode . '/img/arrow1-next.png ' . '" />';
} elseif ($this->nav_style == 2) {
$back = '<img src="' . $addonRelativeCode . '/img/arrow2-back.png' . '" />';
$next = '<img src="' . $addonRelativeCode . '/img/arrow2-next.png ' . '" />';
} elseif ($this->nav_style == 3) {
$back = '<img src="' . $addonRelativeCode . '/img/arrow3-back.png' . '" />';
$next = '<img src="' . $addonRelativeCode . '/img/arrow3-next.png ' . '" />';
}
if ($this->nav_buttons == 1) {
$nav_style = "sides";
} else {
$nav_style = "";
}
echo '<p class="EC_nav_links' . $nav_style . '">';
if ($this->nav_parent) {
$pl = common::GetLabelIndex($indexofparent);
$pt = common::IndexToTitle($indexofparent);
echo '<a class="EC_home" href="' . common::GetUrl($pt) . '">' . $pl . '</a>';
echo ' ';
}
if ($this->PrevUrl) {
echo '<a class="EC_newer" href="' . $this->PrevUrl . '">' . $back . '</a>';
echo ' ';
}
if ($this->NextUrl) {
echo '<a class="EC_older" href="' . $this->NextUrl . '">' . $next . '</a>';
}
echo '</p>';
}
示例5: HomepageSave
/**
* Save the posted page as the homepage
*
*/
function HomepageSave()
{
global $langmessage, $config, $gp_index, $gp_titles, $page;
$homepage = $_POST['homepage'];
$homepage_key = false;
if (isset($gp_index[$homepage])) {
$homepage_key = $gp_index[$homepage];
} else {
foreach ($gp_titles as $index => $title) {
if ($title['label'] === $homepage) {
$homepage_key = $index;
break;
}
}
if (!$homepage_key) {
message($langmessage['OOPS']);
return;
}
}
$config['homepath_key'] = $homepage_key;
$config['homepath'] = common::IndexToTitle($config['homepath_key']);
if (!admin_tools::SaveConfig()) {
message($langmessage['OOPS']);
return;
}
//update the display
ob_start();
$this->HomepageDisplay();
$content = ob_get_clean();
$page->ajaxReplace[] = array('inner', '.homepage_setting', $content);
}
示例6: 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']);
}
示例7: IncludeContent
/**
* Include the content of a page or gadget as specified in $data
* @param array $data
* @param string The included content
*/
static function IncludeContent($data)
{
global $langmessage, $gp_index;
if (isset($data['index'])) {
$requested = common::IndexToTitle($data['index']);
} else {
$requested = $data['content'];
}
if (empty($requested)) {
return '<p>' . $langmessage['File Include'] . '</p>';
}
if (self::$title == $requested) {
if (common::LoggedIn()) {
msg('Infinite loop detected: ' . htmlspecialchars($requested));
}
return;
}
if (isset($data['include_type'])) {
$type = $data['include_type'];
} else {
$type = common::SpecialOrAdmin($requested);
}
switch ($type) {
case 'gadget':
return self::IncludeGadget($requested);
case 'special':
return self::IncludeSpecial($requested);
default:
return self::IncludePage($requested);
}
}
示例8: AllTitles
/**
* View all pages of the requested language
*
*/
public function AllTitles()
{
global $langmessage;
echo '<h2>' . $langmessage['Pages'] . '</h2>';
$lang_lists = array();
foreach ($this->lists as $list_index => $list) {
foreach ($list as $lang => $index) {
$lang_lists[$lang][] = $index;
}
}
foreach ($lang_lists as $lang => $indexes) {
echo '<div class="ml_stats"><div>';
echo '<table class="bordered striped">';
echo '<thead><tr><th>' . $this->avail_langs[$lang] . '</th><th>' . $langmessage['options'] . '</th></tr>';
echo '<tbody>';
foreach ($indexes as $index) {
echo '<tr><td>';
$title = common::IndexToTitle($index);
echo common::Link_Page($title);
echo '</td><td>';
echo common::Link('Admin_MultiLang', $langmessage['options'], 'cmd=TitleSettings&index=' . $index, ' name="gpabox"');
echo '</td></tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div></div>';
}
}
示例9: Confirm_Uninstall
function Confirm_Uninstall()
{
global $config, $langmessage, $dataDir, $gp_titles, $gp_menu, $gp_index;
$addon =& $_POST['addon'];
if (!isset($config['addons'][$addon])) {
message($langmessage['OOPS']);
return;
}
$order = false;
if (isset($config['addons'][$addon]['order'])) {
$order = $config['addons'][$addon]['order'];
}
//tracking
$history = array();
$history['name'] = $config['addons'][$addon]['name'];
$history['action'] = 'uninstalled';
if (isset($config['addons'][$addon]['id'])) {
$history['id'] = $config['addons'][$addon]['id'];
}
unset($config['addons'][$addon]);
//remove links
$installedGadgets = $this->GetInstalledComponents($config['gadgets'], $addon);
$this->RemoveFromHandlers($installedGadgets);
//remove from gp_index, gp_menu
$installedLinks = $this->GetInstalledComponents($gp_titles, $addon);
foreach ($installedLinks as $index) {
if (isset($gp_menu[$index])) {
unset($gp_menu[$index]);
}
$title = common::IndexToTitle($index);
if ($title) {
unset($gp_index[$title]);
}
}
$this->RemoveFromConfig($config['gadgets'], $addon);
$this->RemoveFromConfig($config['admin_links'], $addon);
$this->RemoveFromConfig($gp_titles, $addon);
$this->CleanHooks($addon);
if (!admin_tools::SaveAllConfig()) {
message($langmessage['OOPS']);
$this->Uninstall();
return false;
}
/*
* Delete the data folders
*/
$installFolder = $dataDir . '/data/_addoncode/' . $addon;
if (file_exists($installFolder)) {
gpFiles::RmAll($installFolder);
}
$data_folder_name = gpPlugin::GetDataFolder($addon);
$dataFolder = $dataDir . '/data/_addondata/' . $data_folder_name;
if (file_exists($dataFolder)) {
gpFiles::RmAll($dataFolder);
}
/*
* Record the history
*/
$history['time'] = time();
$this->addonHistory[] = $history;
$this->SaveAddonData();
if ($order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
message($langmessage['SAVED']);
}
示例10: SelectLayout
/**
* Display current layout, list of available layouts and list of titles affected by the layout setting for $title
*
*/
function SelectLayout($url, $query_string)
{
global $gp_titles, $gpLayouts, $langmessage, $config, $gp_index;
$index = $_REQUEST['index'];
$title = common::IndexToTitle($index);
if (!$title) {
echo $langmessage['OOPS'];
return;
}
$this->title = $title;
$Inherit_Info = admin_menu_tools::Inheritance_Info();
$curr_layout = admin_menu_tools::CurrentLayout($index);
$curr_info = $gpLayouts[$curr_layout];
echo '<div class="inline_box">';
echo '<h3>';
echo $langmessage['current_layout'] . ': ';
echo '<span class="layout_color_id" style="background-color:' . $curr_info['color'] . ';" title="' . $curr_info['color'] . '"></span> ';
echo str_replace('_', ' ', $curr_info['label']);
echo '</h3>';
if (!empty($gp_titles[$index]['gpLayout'])) {
echo '<p>';
if (isset($Inherit_Info[$index]['parent_layout'])) {
$parent_layout = $Inherit_Info[$index]['parent_layout'];
} else {
$parent_layout = $config['gpLayout'];
}
$parent_info = $gpLayouts[$parent_layout];
echo $langmessage['restore'] . ': ';
$span = '<span class="layout_color_id" style="background-color:' . $parent_info['color'] . ';" title="' . $parent_info['color'] . '"></span> ';
echo common::Link($url, $span . $parent_info['label'], $query_string . 'cmd=restorelayout&index=' . urlencode($index), ' title="' . $langmessage['restore'] . '" name="postlink" ', 'restore');
echo '</p>';
}
echo '<table class="bordered full_width">';
echo '<tr>';
echo '<th>';
echo $langmessage['available_layouts'];
echo '</th>';
echo '<th>';
echo $langmessage['theme'];
echo '</th>';
echo '</tr>';
if (count($gpLayouts) < 2) {
echo '<tr><td colspan="2">';
echo $langmessage['Empty'];
echo '</td></tr>';
echo '</table>';
echo common::Link('Admin_Theme_Content', $langmessage['new_layout']);
echo '</div>';
return;
}
foreach ($gpLayouts as $layout => $info) {
if ($layout == $curr_layout) {
continue;
}
echo '<tr>';
echo '<td>';
echo '<span class="layout_color_id" style="background-color:' . $info['color'] . ';" title="' . $info['color'] . '">';
echo '</span> ';
if ($layout != $curr_layout) {
echo common::Link($url, $info['label'], $query_string . 'cmd=uselayout&index=' . urlencode($index) . '&layout=' . urlencode($layout), 'name="postlink"', 'use_' . $layout);
}
echo '</td>';
echo '<td>';
echo $info['theme'];
echo '</td>';
echo '</tr>';
}
echo '</table>';
//show affected pages
$affected = page_layout::GetAffectedFiles($index);
echo '<br/>';
echo '<table class="bordered full_width">';
echo '<tr><th>' . $langmessage['affected_files'] . '</th></tr></table>';
echo '<p class="sm">' . $langmessage['about_layout_change'] . '</p>';
echo '<p class="admin_note" style="width:35em">';
$label = common::GetLabelIndex($index, false);
echo common::LabelSpecialChars($label);
$i = 0;
foreach ($affected as $affected_label) {
$i++;
echo ', ' . $affected_label;
}
echo '</p>';
echo '<p>';
echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
echo '</p>';
echo '<p class="admin_note">';
echo '<b>' . $langmessage['see_also'] . '</b> ';
echo common::Link('Admin_Theme_Content', $langmessage['layouts']);
echo '</p>';
echo '</div>';
}
示例11: GetScriptInfo
/**
*
* @static
*/
function GetScriptInfo(&$requested)
{
global $dataDir, $gp_index, $gp_titles;
$scripts['special_site_map']['script'] = '/include/special/special_map.php';
$scripts['special_site_map']['class'] = 'special_map';
$scripts['special_galleries']['script'] = '/include/special/special_galleries.php';
$scripts['special_galleries']['class'] = 'special_galleries';
$scripts['special_contact']['script'] = '/include/special/special_contact.php';
$scripts['special_contact']['class'] = 'special_contact';
$scripts['special_missing']['script'] = '/include/special/special_missing.php';
$scripts['special_missing']['class'] = 'special_missing';
if (isset($gp_index[$requested])) {
$index = $gp_index[$requested];
if (isset($scripts[$index])) {
return $scripts[$index];
}
if (isset($gp_titles[$index])) {
return $gp_titles[$index];
}
}
//resolve if the requested path matches a data index
$title = common::IndexToTitle(strtolower($requested));
if ($title) {
$title = common::GetUrl($title, '', false);
common::Redirect($title);
}
return false;
}
示例12: ListSettings
/**
* Give users the option of removing the settings for a page
*
*/
function ListSettings($page_index)
{
global $langmessage, $ml_languages;
$list = $this->GetList($page_index);
echo '<div>';
echo '<form method="post" action="' . common::GetUrl('Admin_MultiLang') . '">';
echo '<input type="hidden" name="cmd" value="title_settings_add" />';
echo '<input type="hidden" name="index" value="' . $page_index . '" />';
echo '<h3>Settings</h3>';
echo '<p>This page has been associated with the following list of pages.</p>';
echo '<table class="bordered"><tr><th>Language</th><th>Title</th><th>Options</th></tr>';
//current settings
foreach ($ml_languages 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=rmtitle&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->LanguageSelect('ml_lang', false, $this->lang);
echo '</td><td>';
$this->TitleSelect(false, $list);
echo '</td><td>';
echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpabox gpbutton" /> ';
echo '</td></tr>';
echo '</table>';
echo '</form>';
$this->SmLinks();
echo '</div>';
}
示例13: GetConfig
/**
* Set the $config array from /data/_site/config.php
*
*/
function GetConfig()
{
global $config, $gp_index, $dataDir, $gp_menu;
require $dataDir . '/data/_site/config.php';
if (!is_array($config)) {
common::stop();
}
$GLOBALS['fileModTimes']['config.php'] = $fileModTime;
common::GetPagesPHP();
if (!is_array($gp_menu)) {
common::stop();
}
//remove old values
if (isset($config['linkto'])) {
unset($config['linkto']);
}
if (isset($config['menu_levels'])) {
unset($config['menu_levels']);
}
//2.3.2
if (isset($config['hidegplink'])) {
//2.4RC2
if ($config['hidegplink'] === 'hide') {
$config['showgplink'] = false;
}
unset($config['hidegplink']);
}
//set values
$config += common::ConfigDefaults();
if (isset($GLOBALS['dirPrefix'])) {
$config['dirPrefix'] = $GLOBALS['dirPrefix'];
// deprecated 2.4b4 $config['dirPrefix'], $GLOBALS['dirPrefix'] won't always be set (example: cron jobs)
}
$config['homepath_key'] = key($gp_menu);
$config['homepath'] = common::IndexToTitle($config['homepath_key']);
if (!isset($config['gadgets']['Contact'])) {
$config['gadgets']['Contact'] = array('script' => '/include/special/special_contact.php', 'class' => 'special_contact_gadget');
}
gp_defined('gp_session_cookie', common::SessionCookie($config['gpuniq']));
//get language file
common::GetLangFile();
//upgrade?
if (version_compare($config['gpversion'], '2.3.4', '<')) {
includeFile('tool/upgrade.php');
new gpupgrade();
}
}
示例14: Gadget
/**
* Gadget Function
* Show related titles
*
*/
function Gadget()
{
global $page, $ml_languages, $config, $addonRelativeCode;
if ($page->pagetype == 'display') {
$page->admin_links[] = common::Link('Admin_MultiLang', 'Multi Language', 'cmd=title_settings&index=' . $page->gp_index, ' name="gpabox"');
}
$page->head_js[] = $addonRelativeCode . '/script.js';
//needed for admin pages as well
$page->css_admin[] = $addonRelativeCode . '/admin.css';
$list = $this->GetList($page->gp_index);
//admin and special pages cannot be translated
if ($page->pagetype != 'display') {
return;
}
if (!$list && !common::loggedIn()) {
return;
}
//show the list
echo '<div class="multi_lang_select"><div>';
echo '<b>Languages</b>';
echo '<ul>';
foreach ($ml_languages as $lang_code => $lang_label) {
if (!isset($list[$lang_code])) {
continue;
}
$index = $list[$lang_code];
if ($index == $page->gp_index) {
continue;
}
$title = common::IndexToTitle($index);
echo '<li>';
echo common::Link($title, $lang_label);
echo '</li>';
}
if (common::loggedIn()) {
echo '<li>';
echo common::Link('Admin_MultiLang', 'Add Language', 'cmd=title_settings&index=' . $page->gp_index, ' name="gpabox"');
echo '</li>';
}
echo '</ul>';
echo '</div></div>';
}
示例15: Gadget
public function Gadget()
{
global $page;
$this->AddResources();
//admin and special pages cannot be translated
if ($page->pagetype != 'display') {
return;
}
$list = $this->GetList($page->gp_index);
if (!$list && !common::loggedIn()) {
return;
}
$current_page_lang = array_search($page->gp_index, $list);
//show the list
echo '<div class="multi_lang_select"><div>';
echo '<b>Languages</b>';
$links = array();
foreach ($this->avail_langs as $lang_code => $lang_label) {
if (!isset($list[$lang_code])) {
continue;
}
if ($lang_code == $current_page_lang) {
continue;
}
$index = $list[$lang_code];
$title = common::IndexToTitle($index);
$links[] = common::Link($title, $lang_label);
}
if ($links) {
echo '<ul><li>';
echo implode('</li><li>', $links);
echo '</li></ul>';
}
if (common::loggedIn()) {
echo '<p>Admin: ';
echo common::Link('Admin_MultiLang', 'Add Translation', 'cmd=TitleSettings&index=' . $page->gp_index, ' name="gpabox"');
echo '</p>';
}
echo '</div></div>';
}