本文整理汇总了PHP中common::GetUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP common::GetUrl方法的具体用法?PHP common::GetUrl怎么用?PHP common::GetUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::GetUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WhichPage
/**
* Determine a user's language preference and redirect them to the appropriate homepage if necessary
* How do we differentiate between a user requesting the home page (to get the default language content) and a request that should be redirected?
* ... don't create any empty links (set $config['homepath'] to false)
* ... redirect all empty paths?
*
*/
function WhichPage($path)
{
global $config;
$home_title = $config['homepath'];
$config['homepath_key'] = false;
$config['homepath'] = false;
//only if homepage
if (!empty($path)) {
return $path;
}
//only if the homepage is translated
$list = $this->GetList($config['homepath_key']);
if (!$list) {
common::Redirect(common::GetUrl($home_title));
//dies
}
//only if user has language settings
if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
common::Redirect(common::GetUrl($home_title));
//dies
}
//check for appropriate translation
$langs = $this->RequestLangs();
foreach ($langs as $lang => $importance) {
if (isset($list[$lang])) {
$title = common::IndexToTitle($list[$lang]);
common::Redirect(common::GetUrl($title));
//dies
}
}
common::Redirect(common::GetUrl($home_title));
}
示例2: ShowForm
function ShowForm()
{
global $langmessage;
if (count($_POST)) {
$values = $_POST;
} else {
$values = $this->config;
}
echo '<h2>Syntax Highlighter Settings</h2>';
echo '<form method="post" action="' . common::GetUrl('Admin_HighlighterSettings') . '">';
echo '<table class="bordered">';
echo '<tr><th>' . $langmessage['options'] . '</th><th> </th></tr>';
echo '<tr><td>Color Theme</td><td>';
echo '<select name="theme" id="syntaxhighlighter-theme">';
foreach ($this->themes as $theme => $name) {
$selected = '';
if ($values['theme'] == $theme) {
$selected = 'selected="selected"';
}
echo '<option value="' . htmlspecialchars($theme) . '" ' . $selected . '>' . htmlspecialchars($name) . " </option>\n";
}
echo '</select>';
echo '</td></tr>';
echo '<tr><td>';
echo '</td><td>';
echo '<input type="hidden" name="cmd" value="save" />';
echo '<input type="submit" name="" value="' . $langmessage['save'] . '" class="gpsubmit" />';
echo '</td></tr>';
echo '</table>';
echo '</form>';
}
示例3: __construct
function __construct()
{
$this->admin_link = common::GetUrl('Admin_Classes');
$cmd = common::GetCommand();
switch ($cmd) {
case 'SaveClasses':
$this->SaveClasses();
break;
}
$this->ClassesForm();
}
示例4: GenFeed
/**
* Regenerate the atom.feed file
*
*/
static function GenFeed()
{
global $config, $addonFolderName, $dirPrefix;
ob_start();
$atomFormat = 'Y-m-d\\TH:i:s\\Z';
$show_posts = SimpleBlogCommon::WhichPosts(0, SimpleBlogCommon::$data['feed_entries']);
if (isset($_SERVER['HTTP_HOST'])) {
$server = 'http://' . $_SERVER['HTTP_HOST'];
} else {
$server = 'http://' . $_SERVER['SERVER_NAME'];
}
$serverWithDir = $server . $dirPrefix;
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<feed xmlns="http://www.w3.org/2005/Atom">' . "\n";
echo '<title>' . $config['title'] . '</title>' . "\n";
echo '<link href="' . $serverWithDir . '/data/_addondata/' . str_replace(' ', '%20', $addonFolderName) . '/feed.atom" rel="self" />' . "\n";
echo '<link href="' . $server . common::GetUrl('Special_Blog') . '" />' . "\n";
echo '<id>urn:uuid:' . self::uuid($serverWithDir) . '</id>' . "\n";
echo '<updated>' . date($atomFormat, time()) . '</updated>' . "\n";
echo '<author><name>' . $config['title'] . '</name></author>' . "\n";
foreach ($show_posts as $post_index) {
$post = SimpleBlogCommon::GetPostContent($post_index);
if (!$post) {
continue;
}
echo '<entry>' . "\n";
echo '<title>' . SimpleBlogCommon::Underscores($post['title']) . '</title>' . "\n";
echo '<link href="' . $server . SimpleBlogCommon::PostUrl($post_index) . '"></link>' . "\n";
echo '<id>urn:uuid:' . self::uuid($post_index) . '</id>' . "\n";
echo '<updated>' . date($atomFormat, $post['time']) . '</updated>' . "\n";
$content =& $post['content'];
if (SimpleBlogCommon::$data['feed_abbrev'] > 0 && mb_strlen($content) > SimpleBlogCommon::$data['feed_abbrev']) {
$content = mb_substr($content, 0, SimpleBlogCommon::$data['feed_abbrev']) . ' ... ';
$label = gpOutput::SelectText('Read More');
$content .= '<a href="' . $server . SimpleBlogCommon::PostUrl($post_index, $label) . '">' . $label . '</a>';
}
//old images
$replacement = $server . '/';
$content = str_replace('src="/', 'src="' . $replacement, $content);
//new images
$content = str_replace('src="../', 'src="' . $serverWithDir, $content);
//images without /index.php/
$content = str_replace('src="./', 'src="' . $serverWithDir, $content);
//href
SimpleBlogCommon::FixLinks($content, $server, 0);
echo '<summary type="html"><![CDATA[' . $content . ']]></summary>' . "\n";
echo '</entry>' . "\n";
}
echo '</feed>' . "\n";
$feed = ob_get_clean();
$feedFile = SimpleBlogCommon::$data_dir . '/feed.atom';
gpFiles::Save($feedFile, $feed);
}
示例5: elFinderPrep
function elFinderPrep()
{
global $page, $gpAdmin, $GP_INLINE_VARS;
$el_opts['url'] = common::GetUrl('Admin_Finder');
$el_opts['lang'] = 'en';
$el_opts['getFileCallback'] = true;
$page->head_script .= "\n" . 'var elfinder_opts = ' . json_encode($el_opts) . ';';
$page->head .= '<style type="text/css">';
$page->head .= 'html,body{padding:0;margin:0;background-color:#ededed !important;background-image:none !important;border:0 none !important;}';
$page->head .= '#gp_admin_html{padding:5px 0 !important;}';
$page->head .= '</style>';
}
示例6: EditContent
function EditContent()
{
global $langmessage;
$content = $this->config['content'];
if (!empty($_POST['content'])) {
$content = $_POST['content'];
}
echo '<form method="post" action="' . common::GetUrl('Admin_Protect') . '">';
echo '<input type="hidden" name="cmd" value="savecontent"/>';
common::UseCK($content, 'content');
echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpsubmit" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="gpcancel" />';
echo '</form>';
}
示例7: WhichPage
public function WhichPage($path)
{
global $config;
$home_title = $config['homepath'];
$home_key = $config['homepath_key'];
$config['homepath_key'] = false;
$config['homepath'] = false;
//only if homepage
if (!empty($path) && $path !== $home_title) {
return $path;
}
$translated_key = $this->WhichTranslation($home_key);
if (!is_null($translated_key)) {
$home_title = common::IndexToTitle($translated_key);
}
//redirect if needed
if ($home_title != $path) {
common::Redirect(common::GetUrl($home_title));
}
}
示例8: showSettings
private function showSettings()
{
global $langmessage;
echo '<h2>Settings</h2>';
echo '<form action="' . common::GetUrl('Admin_EasyMark') . '" method="post">';
$this->putField('checkbox', 'wysiwygEnabled', 'WYSIWYG feature enabled', 'true', $this->settings['wysiwygEnabled']);
$this->putField('text', 'wysiwygDelay', 'WYSIWYG feature refresh delay in seconds', isset($this->settings['wysiwygDelay']) ? $this->settings['wysiwygDelay'] : $this->defaults['wysiwygDelay']);
$this->putField('checkbox', 'markupEscaped', 'Parsedown: markup escaped', 'true', $this->settings['markupEscaped']);
$this->putField('checkbox', 'breaksEnabled', 'Parsedown: breaks enabled', 'true', $this->settings['breaksEnabled']);
$this->putField('checkbox', 'urlsLinked', 'Parsedown: URLs linked', 'true', $this->settings['urlsLinked']);
echo '<input type="hidden" name="cmd" value="saveSettings" />';
echo '<input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" />';
echo '<input type="submit" name="" value="' . $langmessage['save'] . '" />';
echo '</form>';
echo '<div><h2>Acknowledgements</h2><p>Heartful thanks for making this small thing posssible:<ul>';
echo '<li><strong><a href="https://github.com/oyejorge">Josh Schmidt</a></strong>: for GpEasy/Typesetter, and fixing my first issue</li>';
echo '<li><strong><a href="https://github.com/erusev">Emanuil Rusev</a></strong>: for ParseDown and ParseDown Extra</li>';
echo '<li><strong><a href="https://github.com/juek">Jürgen Krausz</a></strong>: for spotting and fixing incompatibility with PHP 5.3</li>';
echo '</ul></p></div>';
}
示例9: 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;
}
示例10: PostCommands
/**
* Run commands
*
*/
public function PostCommands()
{
global $page;
$cmd = common::GetCommand();
if (empty($cmd)) {
//redirect to correct url if needed
SimpleBlogCommon::UrlQuery($this->post_id, $expected_url, $query);
$expected_url = str_replace('&', '&', $expected_url);
//because of htmlspecialchars($cattitle)
if ($page->requested != $expected_url) {
$expected_url = common::GetUrl($expected_url, $query, false);
common::Redirect($expected_url);
}
return;
}
switch ($cmd) {
case 'Add Comment':
$this->AddComment();
break;
}
}
示例11: FindForm
function FindForm()
{
global $langmessage;
$_GET += array('q' => '');
echo '<div class="gp_find_form">';
echo '<form action="' . common::GetUrl($this->browser_path) . '" method="get">';
echo '<input type="hidden" name="cmd" value="remote" />';
echo '<input type="text" name="q" value="' . htmlspecialchars($_GET['q']) . '" size="15" class="gpinput" /> ';
echo '<input type="submit" name="" value="' . $langmessage['Search'] . '" class="gpbutton" />';
echo '</form>';
echo '</div>';
}
示例12: CheckStatus
static function CheckStatus()
{
switch (self::$update_status) {
case 'embedcheck':
$img_path = common::GetUrl('Admin', 'cmd=embededcheck');
common::IdReq($img_path);
break;
case 'checkincompat':
$img_path = common::IdUrl('ci');
//check in
common::IdReq($img_path);
break;
}
}
示例13: 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>';
}
示例14: Form_Entry
function Form_Entry()
{
global $langmessage;
//echo '<h3>'.$langmessage['configuration'].'</h3>';
//echo '<h3>'.$langmessage['User Details'].'</h3>';
echo '<form action="' . common::GetUrl('') . '" method="post">';
echo '<table class="styledtable">';
Install_Tools::Form_UserDetails();
Install_Tools::Form_Configuration();
echo '</table>';
echo '<p>';
echo '<input type="hidden" name="cmd" value="Install" />';
echo '<input type="submit" class="submit install_button" name="aaa" value="' . $langmessage['Install'] . '" />';
echo '</p>';
echo '</form>';
}
示例15: DeleteTheme
function DeleteTheme()
{
global $langmessage, $dataDir;
echo '<div class="inline_box">';
echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">';
$can_delete = true;
$theme_folder_name =& $_GET['folder'];
$theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name) || empty($_GET['label'])) {
echo $langmessage['OOPS'];
$can_delete = false;
}
if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
echo $message;
$can_delete = false;
}
if ($can_delete) {
$label = htmlspecialchars($_GET['label']);
echo '<input type="hidden" name="cmd" value="delete_theme_confirmed" />';
echo '<input type="hidden" name="folder" value="' . htmlspecialchars($theme_folder_name) . '" />';
echo sprintf($langmessage['generic_delete_confirm'], '<i>' . $label . '</i>');
}
echo '<p>';
echo ' <input type="submit" name="" value="' . $langmessage['continue'] . '" />';
echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close" />';
echo '</p>';
echo '</form>';
echo '</div>';
}