Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
home/lmsyaran/public_html/libraries/fof/hal/links.php000064400000006163151155776010016765
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage hal
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* Implementation of the Hypertext Application Language links in PHP. This
is
* actually a collection of links.
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFHalLinks
{
/**
* The collection of links, sorted by relation
*
* @var array
*/
private $_links = array();
/**
* Add a single link to the links collection
*
* @param string $rel The relation of the link to the
document. See RFC 5988
*
http://tools.ietf.org/html/rfc5988#section-6.2.2 A document
* MUST always have a "self"
link.
* @param FOFHalLink $link The actual link object
* @param boolean $overwrite When false and a link of $rel relation
exists, an array of
* links is created. Otherwise the
existing link is overwriten
* with the new one
*
* @return boolean True if the link was added to the collection
*/
public function addLink($rel, FOFHalLink $link, $overwrite = true)
{
if (!$link->check())
{
return false;
}
if (!array_key_exists($rel, $this->_links) || $overwrite)
{
$this->_links[$rel] = $link;
}
elseif (array_key_exists($rel, $this->_links) && !$overwrite)
{
if (!is_array($this->_links[$rel]))
{
$this->_links[$rel] = array($this->_links[$rel]);
}
$this->_links[$rel][] = $link;
}
else
{
return false;
}
}
/**
* Add multiple links to the links collection
*
* @param string $rel The relation of the links to the
document. See RFC 5988.
* @param array $links An array of FOFHalLink objects
* @param boolean $overwrite When false and a link of $rel relation
exists, an array
* of links is created. Otherwise the
existing link is
* overwriten with the new one
*
* @return boolean True if the link was added to the collection
*/
public function addLinks($rel, array $links, $overwrite = true)
{
if (empty($links))
{
return false;
}
$localOverwrite = $overwrite;
foreach ($links as $link)
{
if ($link instanceof FOFHalLink)
{
$this->addLink($rel, $link, $localOverwrite);
}
// After the first time we call this with overwrite on we have to
// turn it off so that the other links are added to the set instead
// of overwriting the first item that's already added.
if ($localOverwrite)
{
$localOverwrite = false;
}
}
}
/**
* Returns the collection of links
*
* @param string $rel Optional; the relation to return the links for
*
* @return array|FOFHalLink
*/
public function getLinks($rel = null)
{
if (empty($rel))
{
return $this->_links;
}
elseif (isset($this->_links[$rel]))
{
return $this->_links[$rel];
}
else
{
return array();
}
}
}
home/lmsyaran/public_html/libraries/joomla/mediawiki/links.php000064400000017370151156600730020671
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage MediaWiki
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* MediaWiki API Links class for the Joomla Platform.
*
* @since 3.1.4
*/
class JMediawikiLinks extends JMediawikiObject
{
/**
* Method to return all links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param array $plnamespace Namespaces to get links.
* @param string $pllimit Number of links to return.
* @param string $plcontinue Continue when more results are
available.
* @param array $pltitles List links to these titles.
* @param string $pldir Direction of listing.
*
* @return object
*
* @since 3.1.4
*/
public function getLinks(array $titles, array $plnamespace = null,
$pllimit = null, $plcontinue = null, array $pltitles = null, $pldir = null)
{
// Build the request.
$path = '?action=query&prop=links';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($plnamespace))
{
$path .= '&plnamespace=' .
$this->buildParameter($plnamespace);
}
if (isset($pllimit))
{
$path .= '&pllimit=' . $pllimit;
}
if (isset($plcontinue))
{
$path .= '&plcontinue=' . $plcontinue;
}
if (isset($pltitles))
{
$path .= '&pltitles=' .
$this->buildParameter($pltitles);
}
if (isset($pldir))
{
$path .= '&pldir=' . $pldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return info about the link pages.
*
* @param array $titles Page titles to retrieve links.
*
* @return object
*
* @since 3.1.4
*/
public function getLinksUsed(array $titles)
{
// Build the request.
$path = '?action=query&generator=links&prop=info';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interwiki links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param boolean $iwurl Whether to get the full url.
* @param integer $iwlimit Number of interwiki links to return.
* @param boolean $iwcontinue When more results are available, use
this to continue.
* @param string $iwprefix Prefix for the interwiki.
* @param string $iwtitle Interwiki link to search for.
* @param string $iwdir The direction in which to list.
*
* @return object
*
* @since 3.1.4
*/
public function getIWLinks(array $titles, $iwurl = false, $iwlimit = null,
$iwcontinue = false, $iwprefix = null, $iwtitle = null, $iwdir = null)
{
// Build the request.
$path = '?action=query&prop=links';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if ($iwurl)
{
$path .= '&iwurl=';
}
if (isset($iwlimit))
{
$path .= '&iwlimit=' . $iwlimit;
}
if ($iwcontinue)
{
$path .= '&iwcontinue=';
}
if (isset($iwprefix))
{
$path .= '&iwprefix=' . $iwprefix;
}
if (isset($iwtitle))
{
$path .= '&iwtitle=' . $iwtitle;
}
if (isset($iwdir))
{
$path .= '&iwdir=' . $iwdir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interlanguage links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $lllimit Number of language links to return.
* @param boolean $llcontinue When more results are available, use
this to continue.
* @param string $llurl Whether to get the full URL.
* @param string $lllang Language code.
* @param string $lltitle Link to search for.
* @param string $lldir The direction in which to list.
*
* @return object
*
* @since 3.1.4
*/
public function getLangLinks(array $titles, $lllimit = null, $llcontinue =
false, $llurl = null, $lllang = null, $lltitle = null, $lldir = null)
{
// Build the request.
$path = '?action=query&prop=langlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($lllimit))
{
$path .= '&lllimit=' . $lllimit;
}
if ($llcontinue)
{
$path .= '&llcontinue=';
}
if (isset($llurl))
{
$path .= '&llurl=' . $llurl;
}
if (isset($lllang))
{
$path .= '&lllang=' . $lllang;
}
if (isset($lltitle))
{
$path .= '&lltitle=' . $lltitle;
}
if (isset($lldir))
{
$path .= '&lldir=' . $lldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all external urls from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $ellimit Number of links to return.
* @param string $eloffset When more results are available, use
this to continue.
* @param string $elprotocol Protocol of the url.
* @param string $elquery Search string without protocol.
*
* @return object
*
* @since 3.1.4
*/
public function getExtLinks(array $titles, $ellimit = null, $eloffset =
null, $elprotocol = null, $elquery = null)
{
// Build the request.
$path = '?action=query&prop=extlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($ellimit))
{
$path .= '&ellimit=' . $ellimit;
}
if (isset($eloffset))
{
$path .= '&eloffset=' . $eloffset;
}
if (isset($elprotocol))
{
$path .= '&elprotocol=' . $elprotocol;
}
if (isset($elquery))
{
$path .= '&elquery=' . $elquery;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to enumerate all links that point to a given namespace.
*
* @param boolean $alcontinue When more results are available, use
this to continue.
* @param string $alfrom Start listing at this title. The title
need not exist.
* @param string $alto The page title to stop enumerating at.
* @param string $alprefix Search for all page titles that begin
with this value.
* @param string $alunique Only show unique links.
* @param array $alprop What pieces of information to include.
* @param string $alnamespace The namespace to enumerate.
* @param integer $allimit Number of links to return.
*
* @return object
*
* @since 3.1.4
*/
public function enumerateLinks($alcontinue = false, $alfrom = null, $alto
= null, $alprefix = null, $alunique = null, array $alprop = null,
$alnamespace = null, $allimit = null)
{
// Build the request.
$path = '?action=query&meta=siteinfo';
if ($alcontinue)
{
$path .= '&alcontinue=';
}
if (isset($alfrom))
{
$path .= '&alfrom=' . $alfrom;
}
if (isset($alto))
{
$path .= '&alto=' . $alto;
}
if (isset($alprefix))
{
$path .= '&alprefix=' . $alprefix;
}
if (isset($alunique))
{
$path .= '&alunique=' . $alunique;
}
if (isset($alprop))
{
$path .= '&alprop=' . $this->buildParameter($alprop);
}
if (isset($alnamespace))
{
$path .= '&alnamespace=' . $alnamespace;
}
if (isset($allimit))
{
$path .= '&allimit=' . $allimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
home/lmsyaran/public_html/j3/libraries/cms/html/links.php000064400000005013151156723010017473
0ustar00<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for icons.
*
* @since 3.2
*/
abstract class JHtmlLinks
{
/**
* Method to generate html code for groups of lists of links
*
* @param array $groupsOfLinks Array of links
*
* @return string
*
* @since 3.2
*/
public static function linksgroups($groupsOfLinks)
{
$html = array();
if (count($groupsOfLinks) > 0)
{
$layout = new JLayoutFile('joomla.links.groupsopen');
$html[] = $layout->render('');
foreach ($groupsOfLinks as $title => $links)
{
if (isset($links[0]['separategroup']))
{
$layout = new JLayoutFile('joomla.links.groupseparator');
$html[] = $layout->render($title);
}
$layout = new JLayoutFile('joomla.links.groupopen');
$htmlHeader = $layout->render($title);
$htmlLinks = JHtml::_('links.links', $links);
if ($htmlLinks != '')
{
$html[] = $htmlHeader;
$html[] = $htmlLinks;
$layout = new JLayoutFile('joomla.links.groupclose');
$html[] = $layout->render('');
}
}
$layout = new JLayoutFile('joomla.links.groupsclose');
$html[] = $layout->render('');
}
return implode($html);
}
/**
* Method to generate html code for a list of links
*
* @param array $links Array of links
*
* @return string
*
* @since 3.2
*/
public static function links($links)
{
$html = array();
foreach ($links as $link)
{
$html[] = JHtml::_('links.link', $link);
}
return implode($html);
}
/**
* Method to generate html code for a single link
*
* @param array $link link properties
*
* @return string
*
* @since 3.2
*/
public static function link($link)
{
if (isset($link['access']))
{
if (is_bool($link['access']))
{
if ($link['access'] == false)
{
return '';
}
}
else
{
// Get the user object to verify permissions
$user = JFactory::getUser();
// Take each pair of permission, context values.
for ($i = 0, $n = count($link['access']); $i < $n; $i +=
2)
{
if (!$user->authorise($link['access'][$i],
$link['access'][$i + 1]))
{
return '';
}
}
}
}
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.links.link');
return $layout->render($link);
}
}
home/lmsyaran/public_html/j3/htaccess.back/joomla/mediawiki/links.php000064400000017370151157447720021736
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage MediaWiki
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* MediaWiki API Links class for the Joomla Platform.
*
* @since 3.1.4
*/
class JMediawikiLinks extends JMediawikiObject
{
/**
* Method to return all links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param array $plnamespace Namespaces to get links.
* @param string $pllimit Number of links to return.
* @param string $plcontinue Continue when more results are
available.
* @param array $pltitles List links to these titles.
* @param string $pldir Direction of listing.
*
* @return object
*
* @since 3.1.4
*/
public function getLinks(array $titles, array $plnamespace = null,
$pllimit = null, $plcontinue = null, array $pltitles = null, $pldir = null)
{
// Build the request.
$path = '?action=query&prop=links';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($plnamespace))
{
$path .= '&plnamespace=' .
$this->buildParameter($plnamespace);
}
if (isset($pllimit))
{
$path .= '&pllimit=' . $pllimit;
}
if (isset($plcontinue))
{
$path .= '&plcontinue=' . $plcontinue;
}
if (isset($pltitles))
{
$path .= '&pltitles=' .
$this->buildParameter($pltitles);
}
if (isset($pldir))
{
$path .= '&pldir=' . $pldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return info about the link pages.
*
* @param array $titles Page titles to retrieve links.
*
* @return object
*
* @since 3.1.4
*/
public function getLinksUsed(array $titles)
{
// Build the request.
$path = '?action=query&generator=links&prop=info';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interwiki links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param boolean $iwurl Whether to get the full url.
* @param integer $iwlimit Number of interwiki links to return.
* @param boolean $iwcontinue When more results are available, use
this to continue.
* @param string $iwprefix Prefix for the interwiki.
* @param string $iwtitle Interwiki link to search for.
* @param string $iwdir The direction in which to list.
*
* @return object
*
* @since 3.1.4
*/
public function getIWLinks(array $titles, $iwurl = false, $iwlimit = null,
$iwcontinue = false, $iwprefix = null, $iwtitle = null, $iwdir = null)
{
// Build the request.
$path = '?action=query&prop=links';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if ($iwurl)
{
$path .= '&iwurl=';
}
if (isset($iwlimit))
{
$path .= '&iwlimit=' . $iwlimit;
}
if ($iwcontinue)
{
$path .= '&iwcontinue=';
}
if (isset($iwprefix))
{
$path .= '&iwprefix=' . $iwprefix;
}
if (isset($iwtitle))
{
$path .= '&iwtitle=' . $iwtitle;
}
if (isset($iwdir))
{
$path .= '&iwdir=' . $iwdir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all interlanguage links from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $lllimit Number of language links to return.
* @param boolean $llcontinue When more results are available, use
this to continue.
* @param string $llurl Whether to get the full URL.
* @param string $lllang Language code.
* @param string $lltitle Link to search for.
* @param string $lldir The direction in which to list.
*
* @return object
*
* @since 3.1.4
*/
public function getLangLinks(array $titles, $lllimit = null, $llcontinue =
false, $llurl = null, $lllang = null, $lltitle = null, $lldir = null)
{
// Build the request.
$path = '?action=query&prop=langlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($lllimit))
{
$path .= '&lllimit=' . $lllimit;
}
if ($llcontinue)
{
$path .= '&llcontinue=';
}
if (isset($llurl))
{
$path .= '&llurl=' . $llurl;
}
if (isset($lllang))
{
$path .= '&lllang=' . $lllang;
}
if (isset($lltitle))
{
$path .= '&lltitle=' . $lltitle;
}
if (isset($lldir))
{
$path .= '&lldir=' . $lldir;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to return all external urls from the given page(s).
*
* @param array $titles Page titles to retrieve links.
* @param integer $ellimit Number of links to return.
* @param string $eloffset When more results are available, use
this to continue.
* @param string $elprotocol Protocol of the url.
* @param string $elquery Search string without protocol.
*
* @return object
*
* @since 3.1.4
*/
public function getExtLinks(array $titles, $ellimit = null, $eloffset =
null, $elprotocol = null, $elquery = null)
{
// Build the request.
$path = '?action=query&prop=extlinks';
// Append titles to the request.
$path .= '&titles=' . $this->buildParameter($titles);
if (isset($ellimit))
{
$path .= '&ellimit=' . $ellimit;
}
if (isset($eloffset))
{
$path .= '&eloffset=' . $eloffset;
}
if (isset($elprotocol))
{
$path .= '&elprotocol=' . $elprotocol;
}
if (isset($elquery))
{
$path .= '&elquery=' . $elquery;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
/**
* Method to enumerate all links that point to a given namespace.
*
* @param boolean $alcontinue When more results are available, use
this to continue.
* @param string $alfrom Start listing at this title. The title
need not exist.
* @param string $alto The page title to stop enumerating at.
* @param string $alprefix Search for all page titles that begin
with this value.
* @param string $alunique Only show unique links.
* @param array $alprop What pieces of information to include.
* @param string $alnamespace The namespace to enumerate.
* @param integer $allimit Number of links to return.
*
* @return object
*
* @since 3.1.4
*/
public function enumerateLinks($alcontinue = false, $alfrom = null, $alto
= null, $alprefix = null, $alunique = null, array $alprop = null,
$alnamespace = null, $allimit = null)
{
// Build the request.
$path = '?action=query&meta=siteinfo';
if ($alcontinue)
{
$path .= '&alcontinue=';
}
if (isset($alfrom))
{
$path .= '&alfrom=' . $alfrom;
}
if (isset($alto))
{
$path .= '&alto=' . $alto;
}
if (isset($alprefix))
{
$path .= '&alprefix=' . $alprefix;
}
if (isset($alunique))
{
$path .= '&alunique=' . $alunique;
}
if (isset($alprop))
{
$path .= '&alprop=' . $this->buildParameter($alprop);
}
if (isset($alnamespace))
{
$path .= '&alnamespace=' . $alnamespace;
}
if (isset($allimit))
{
$path .= '&allimit=' . $allimit;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
return $this->validateResponse($response);
}
}
home/lmsyaran/public_html/j3/htaccess.back/cms/html/links.php000064400000005013151157555470020231
0ustar00<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for icons.
*
* @since 3.2
*/
abstract class JHtmlLinks
{
/**
* Method to generate html code for groups of lists of links
*
* @param array $groupsOfLinks Array of links
*
* @return string
*
* @since 3.2
*/
public static function linksgroups($groupsOfLinks)
{
$html = array();
if (count($groupsOfLinks) > 0)
{
$layout = new JLayoutFile('joomla.links.groupsopen');
$html[] = $layout->render('');
foreach ($groupsOfLinks as $title => $links)
{
if (isset($links[0]['separategroup']))
{
$layout = new JLayoutFile('joomla.links.groupseparator');
$html[] = $layout->render($title);
}
$layout = new JLayoutFile('joomla.links.groupopen');
$htmlHeader = $layout->render($title);
$htmlLinks = JHtml::_('links.links', $links);
if ($htmlLinks != '')
{
$html[] = $htmlHeader;
$html[] = $htmlLinks;
$layout = new JLayoutFile('joomla.links.groupclose');
$html[] = $layout->render('');
}
}
$layout = new JLayoutFile('joomla.links.groupsclose');
$html[] = $layout->render('');
}
return implode($html);
}
/**
* Method to generate html code for a list of links
*
* @param array $links Array of links
*
* @return string
*
* @since 3.2
*/
public static function links($links)
{
$html = array();
foreach ($links as $link)
{
$html[] = JHtml::_('links.link', $link);
}
return implode($html);
}
/**
* Method to generate html code for a single link
*
* @param array $link link properties
*
* @return string
*
* @since 3.2
*/
public static function link($link)
{
if (isset($link['access']))
{
if (is_bool($link['access']))
{
if ($link['access'] == false)
{
return '';
}
}
else
{
// Get the user object to verify permissions
$user = JFactory::getUser();
// Take each pair of permission, context values.
for ($i = 0, $n = count($link['access']); $i < $n; $i +=
2)
{
if (!$user->authorise($link['access'][$i],
$link['access'][$i + 1]))
{
return '';
}
}
}
}
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.links.link');
return $layout->render($link);
}
}
home/lmsyaran/public_html/j3/htaccess.back/fof/hal/links.php000064400000006163151161227000020004
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage hal
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* Implementation of the Hypertext Application Language links in PHP. This
is
* actually a collection of links.
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFHalLinks
{
/**
* The collection of links, sorted by relation
*
* @var array
*/
private $_links = array();
/**
* Add a single link to the links collection
*
* @param string $rel The relation of the link to the
document. See RFC 5988
*
http://tools.ietf.org/html/rfc5988#section-6.2.2 A document
* MUST always have a "self"
link.
* @param FOFHalLink $link The actual link object
* @param boolean $overwrite When false and a link of $rel relation
exists, an array of
* links is created. Otherwise the
existing link is overwriten
* with the new one
*
* @return boolean True if the link was added to the collection
*/
public function addLink($rel, FOFHalLink $link, $overwrite = true)
{
if (!$link->check())
{
return false;
}
if (!array_key_exists($rel, $this->_links) || $overwrite)
{
$this->_links[$rel] = $link;
}
elseif (array_key_exists($rel, $this->_links) && !$overwrite)
{
if (!is_array($this->_links[$rel]))
{
$this->_links[$rel] = array($this->_links[$rel]);
}
$this->_links[$rel][] = $link;
}
else
{
return false;
}
}
/**
* Add multiple links to the links collection
*
* @param string $rel The relation of the links to the
document. See RFC 5988.
* @param array $links An array of FOFHalLink objects
* @param boolean $overwrite When false and a link of $rel relation
exists, an array
* of links is created. Otherwise the
existing link is
* overwriten with the new one
*
* @return boolean True if the link was added to the collection
*/
public function addLinks($rel, array $links, $overwrite = true)
{
if (empty($links))
{
return false;
}
$localOverwrite = $overwrite;
foreach ($links as $link)
{
if ($link instanceof FOFHalLink)
{
$this->addLink($rel, $link, $localOverwrite);
}
// After the first time we call this with overwrite on we have to
// turn it off so that the other links are added to the set instead
// of overwriting the first item that's already added.
if ($localOverwrite)
{
$localOverwrite = false;
}
}
}
/**
* Returns the collection of links
*
* @param string $rel Optional; the relation to return the links for
*
* @return array|FOFHalLink
*/
public function getLinks($rel = null)
{
if (empty($rel))
{
return $this->_links;
}
elseif (isset($this->_links[$rel]))
{
return $this->_links[$rel];
}
else
{
return array();
}
}
}