Difference between revisions of "API:EPrints/URL"

From EPrints Documentation
Jump to: navigation, search
 
Line 8: Line 8:
 
'''EPrints::URL''' - URL utility methods
 
'''EPrints::URL''' - URL utility methods
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
 
This module contains utility methods for generating and getting URLs, relative paths etc.
 
This module contains utility methods for generating and getting URLs, relative paths etc.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_synopsis -->
 
<!-- Pod2Wiki=head_synopsis -->
 
==SYNOPSIS==
 
==SYNOPSIS==
  use EPrints;
+
<source lang="perl">use EPrints;
 
+
 
  my $base_url = $session-&gt;get_url-&gt;get(
+
my $base_url = $session->get_url->get(
    scheme =&gt; "auto",
+
scheme => "auto",
    host =&gt; 1,
+
host => 1,
    path =&gt; "cgi",
+
path => "cgi",
    query =&gt; 0,
+
query => 0,
  );
+
);</source>
 
+
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_methods -->
 
<!-- Pod2Wiki=head_methods -->
 
==METHODS==
 
==METHODS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<!-- Pod2Wiki=head_get -->
<span style='display:none'>User Comments</span>
+
===get===
<!-- Edit below this comment -->
+
  
 +
<source lang="perl">$url = $url->get( %opts [, $page ] )
  
<!-- Pod2Wiki= -->
+
</source>
</div>
+
<!-- Pod2Wiki=item_get -->
+
===get===
+
 
+
$url = $url-&gt;get( %opts [, $page ] )
+
 
Constructs a $url based on the current configuration and %opts. If $page is specified will return a URL to that page.
 
Constructs a $url based on the current configuration and %opts. If $page is specified will return a URL to that page.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* scheme =&gt; "auto"
<span style='display:none'>User Comments</span>
+
: Link to same protocol as is active now (N/A to shell scripts).
<!-- Edit below this comment -->
+
  
 +
* scheme =&gt; "http"
 +
: Link to the non-secure location.
  
<!-- Pod2Wiki= -->
+
* scheme =&gt; "https"
</div>
+
: Link to the secure location (or http if <code>securehost</code> isn't defined).
<!-- Pod2Wiki=item_scheme_auto -->
+
===scheme_auto===
+
  
scheme =&gt; "auto"
+
* host =&gt; 1
Link to same protocol as is active now (N/A to shell scripts).
+
: Create an absolute link (including host and port).
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* path =&gt; "auto"
<span style='display:none'>User Comments</span>
+
: Use the current path (N/A to shell scripts).
<!-- Edit below this comment -->
+
  
 +
* path =&gt; "static", path =&gt; "cgi", path =&gt; "images"
 +
: Link to the root of the static, cgi and images respectively.
  
<!-- Pod2Wiki= -->
+
* query =&gt; 1
</div>
+
: Create a self-referential link (i.e. include all parameters in the query part).
<!-- Pod2Wiki=item_scheme_http -->
+
===scheme_http===
+
 
+
scheme =&gt; "http"
+
Link to the non-secure location.
+
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_copyright -->
<!-- Pod2Wiki=item_scheme_https -->
+
==COPYRIGHT==
===scheme_https===
+
Copyright 2000-2011 University of Southampton.
  
scheme =&gt; "https"
+
This file is part of EPrints http://www.eprints.org/.
Link to the secure location.
+
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
<span style='display:none'>User Comments</span>
+
<!-- Edit below this comment -->
+
  
 +
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  
<!-- Pod2Wiki= -->
+
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.
</div>
+
<!-- Pod2Wiki=item_host_1 -->
+
===host_1===
+
 
+
  host =&gt; 1
+
Create an absolute link (including host and port).
+
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=item_path_auto -->
+
===path_auto===
+
 
+
path =&gt; "auto"
+
Use the current path (N/A to shell scripts).
+
 
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_path_static_path_cgi_path_images -->
 
===path_static_path_cgi_path_images===
 
 
path =&gt; "static", path =&gt; "cgi", path =&gt; "images"
 
Link to the root of the static, cgi and images respectively.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_query_1 -->
 
===query_1===
 
 
query =&gt; 1
 
Create a self-referential link (i.e. include all parameters in the query part).
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
 

Latest revision as of 09:56, 22 January 2013

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::URL - URL utility methods


DESCRIPTION

This module contains utility methods for generating and getting URLs, relative paths etc.


SYNOPSIS

use EPrints;
 
my $base_url = $session->get_url->get(
	scheme => "auto",
	host => 1,
	path => "cgi",
	query => 0,
);


METHODS

get

$url = $url->get( %opts [, $page ] )

Constructs a $url based on the current configuration and %opts. If $page is specified will return a URL to that page.

  • scheme => "auto"
Link to same protocol as is active now (N/A to shell scripts).
  • scheme => "http"
Link to the non-secure location.
  • scheme => "https"
Link to the secure location (or http if securehost isn't defined).
  • host => 1
Create an absolute link (including host and port).
  • path => "auto"
Use the current path (N/A to shell scripts).
  • path => "static", path => "cgi", path => "images"
Link to the root of the static, cgi and images respectively.
  • query => 1
Create a self-referential link (i.e. include all parameters in the query part).


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.