Fix PHPDoc comments project-wide
This commit is contained in:
parent
6077aa5847
commit
3282ce5389
113 changed files with 1703 additions and 795 deletions
|
@ -42,7 +42,7 @@ class Crypto
|
|||
|
||||
/**
|
||||
* @param string $Der der formatted string
|
||||
* @param string $Private key type optional, default false
|
||||
* @param bool $Private key type optional, default false
|
||||
* @return string
|
||||
*/
|
||||
private static function DerToPem($Der, $Private = false)
|
||||
|
@ -149,6 +149,7 @@ class Crypto
|
|||
* @param string $m modulo reference
|
||||
* @param object $e exponent reference
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function pubRsaToMe($key, &$m, &$e)
|
||||
{
|
||||
|
@ -166,6 +167,7 @@ class Crypto
|
|||
/**
|
||||
* @param string $key key
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function rsaToPem($key)
|
||||
{
|
||||
|
@ -176,6 +178,7 @@ class Crypto
|
|||
/**
|
||||
* @param string $key key
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function pemToRsa($key)
|
||||
{
|
||||
|
@ -188,6 +191,7 @@ class Crypto
|
|||
* @param string $m modulo reference
|
||||
* @param string $e exponent reference
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function pemToMe($key, &$m, &$e)
|
||||
{
|
||||
|
@ -217,6 +221,7 @@ class Crypto
|
|||
/**
|
||||
* @param integer $bits number of bits
|
||||
* @return mixed
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function newKeypair($bits)
|
||||
{
|
||||
|
@ -318,14 +323,15 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $pubkey The public key.
|
||||
* @param string $alg The algorithm used for encryption.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function encapsulate($data, $pubkey, $alg = 'aes256cbc')
|
||||
{
|
||||
|
@ -336,14 +342,15 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
* @param type $data
|
||||
* @param type $pubkey The public key.
|
||||
* @param type $alg The algorithm used for encryption.
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $pubkey The public key.
|
||||
* @param string $alg The algorithm used for encryption.
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function encapsulateOther($data, $pubkey, $alg)
|
||||
{
|
||||
|
@ -378,13 +385,14 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $pubkey
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function encapsulateAes($data, $pubkey)
|
||||
{
|
||||
|
@ -412,13 +420,14 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
*
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
*
|
||||
* @return string|boolean The decrypted string or false on failure.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function unencapsulate($data, $prvkey)
|
||||
{
|
||||
|
@ -434,14 +443,15 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
* @param string $alg
|
||||
*
|
||||
*
|
||||
* @return string|boolean The decrypted string or false on failure.
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function unencapsulateOther($data, $prvkey, $alg)
|
||||
{
|
||||
|
@ -461,13 +471,14 @@ class Crypto
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
|
||||
*
|
||||
*
|
||||
* @param array $data
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
*
|
||||
* @param string $prvkey The private key used for decryption.
|
||||
*
|
||||
* @return string|boolean The decrypted string or false on failure.
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function unencapsulateAes($data, $prvkey)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ class DateTimeFormat
|
|||
* @param string $time A date/time string
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function utc($time, $format = self::MYSQL)
|
||||
{
|
||||
|
@ -38,6 +39,7 @@ class DateTimeFormat
|
|||
* @param string $time A date/time string
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function local($time, $format = self::MYSQL)
|
||||
{
|
||||
|
@ -47,8 +49,10 @@ class DateTimeFormat
|
|||
/**
|
||||
* convert() shorthand for timezoned now.
|
||||
*
|
||||
* @param $timezone
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function timezoneNow($timezone, $format = self::MYSQL)
|
||||
{
|
||||
|
@ -60,6 +64,7 @@ class DateTimeFormat
|
|||
*
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function localNow($format = self::MYSQL)
|
||||
{
|
||||
|
@ -71,6 +76,7 @@ class DateTimeFormat
|
|||
*
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function utcNow($format = self::MYSQL)
|
||||
{
|
||||
|
@ -84,9 +90,10 @@ class DateTimeFormat
|
|||
* @param string $tz_to Destination timezone
|
||||
* @param string $tz_from Source timezone
|
||||
* @param string $format Output format recognised from php's DateTime class
|
||||
* http://www.php.net/manual/en/datetime.format.php
|
||||
* http://www.php.net/manual/en/datetime.format.php
|
||||
*
|
||||
* @return string Formatted date according to given format
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function convert($s = 'now', $tz_to = 'UTC', $tz_from = 'UTC', $format = self::MYSQL)
|
||||
{
|
||||
|
|
|
@ -19,17 +19,18 @@ class Emailer
|
|||
* Send a multipart/alternative message with Text and HTML versions
|
||||
*
|
||||
* @param array $params parameters
|
||||
* fromName name of the sender
|
||||
* fromEmail email fo the sender
|
||||
* replyTo replyTo address to direct responses
|
||||
* toEmail destination email address
|
||||
* messageSubject subject of the message
|
||||
* htmlVersion html version of the message
|
||||
* textVersion text only version of the message
|
||||
* additionalMailHeader additions to the smtp mail header
|
||||
* fromName name of the sender
|
||||
* fromEmail email of the sender
|
||||
* replyTo address to direct responses
|
||||
* toEmail destination email address
|
||||
* messageSubject subject of the message
|
||||
* htmlVersion html version of the message
|
||||
* textVersion text only version of the message
|
||||
* additionalMailHeader additions to the SMTP mail header
|
||||
* optional uid user id of the destination user
|
||||
*
|
||||
* @return object
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function send($params)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,6 @@ class ExAuth
|
|||
/**
|
||||
* @brief Create the class
|
||||
*
|
||||
* @param boolean $bDebug Debug mode
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -63,6 +62,7 @@ class ExAuth
|
|||
* parameters
|
||||
*
|
||||
* @return null
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function readStdin()
|
||||
{
|
||||
|
@ -119,6 +119,7 @@ class ExAuth
|
|||
* @brief Check if the given username exists
|
||||
*
|
||||
* @param array $aCommand The command array
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function isUser(array $aCommand)
|
||||
{
|
||||
|
@ -165,11 +166,12 @@ class ExAuth
|
|||
/**
|
||||
* @brief Check remote user existance via HTTP(S)
|
||||
*
|
||||
* @param string $host The hostname
|
||||
* @param string $user Username
|
||||
* @param boolean $ssl Should the check be done via SSL?
|
||||
* @param string $host The hostname
|
||||
* @param string $user Username
|
||||
* @param boolean $ssl Should the check be done via SSL?
|
||||
*
|
||||
* @return boolean Was the user found?
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function checkUser($host, $user, $ssl)
|
||||
{
|
||||
|
@ -199,6 +201,7 @@ class ExAuth
|
|||
* @brief Authenticate the given user and password
|
||||
*
|
||||
* @param array $aCommand The command array
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function auth(array $aCommand)
|
||||
{
|
||||
|
@ -294,6 +297,7 @@ class ExAuth
|
|||
* @brief Set the hostname for this process
|
||||
*
|
||||
* @param string $host The hostname
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private function setHost($host)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ class HTTPSignature
|
|||
* @param $key
|
||||
*
|
||||
* @return array with verification data
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function verifyMagic($key)
|
||||
{
|
||||
|
@ -188,6 +189,7 @@ class HTTPSignature
|
|||
* - \e string \b algorithm
|
||||
* - \e array \b headers
|
||||
* - \e string \b signature
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function parseSigheader($header)
|
||||
{
|
||||
|
@ -235,6 +237,7 @@ class HTTPSignature
|
|||
* - \e string \b key
|
||||
* - \e string \b alg
|
||||
* - \e string \b data
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function decryptSigheader($header, $prvkey = null)
|
||||
{
|
||||
|
@ -276,11 +279,12 @@ class HTTPSignature
|
|||
/**
|
||||
* @brief Transmit given data to a target for a user
|
||||
*
|
||||
* @param array $data Data that is about to be send
|
||||
* @param string $target The URL of the inbox
|
||||
* @param integer $uid User id of the sender
|
||||
* @param array $data Data that is about to be send
|
||||
* @param string $target The URL of the inbox
|
||||
* @param integer $uid User id of the sender
|
||||
*
|
||||
* @return boolean Was the transmission successful?
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function transmit($data, $target, $uid)
|
||||
{
|
||||
|
@ -320,10 +324,11 @@ class HTTPSignature
|
|||
/**
|
||||
* @brief Fetches JSON data for a user
|
||||
*
|
||||
* @param string $request request url
|
||||
* @param integer $uid User id of the requester
|
||||
* @param string $request request url
|
||||
* @param integer $uid User id of the requester
|
||||
*
|
||||
* @return array JSON array
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function fetch($request, $uid)
|
||||
{
|
||||
|
@ -372,7 +377,8 @@ class HTTPSignature
|
|||
* @param $content
|
||||
* @param $http_headers
|
||||
*
|
||||
* @return signer string
|
||||
* @return string Signer
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getSigner($content, $http_headers)
|
||||
{
|
||||
|
@ -493,6 +499,7 @@ class HTTPSignature
|
|||
* @param $actor
|
||||
*
|
||||
* @return array with actor url and public key
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function fetchKey($id, $actor)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,8 @@ class JsonLD
|
|||
*
|
||||
* @param $url
|
||||
*
|
||||
* @return the loaded data
|
||||
* @return mixed the loaded data
|
||||
* @throws \JsonLdException
|
||||
*/
|
||||
public static function documentLoader($url)
|
||||
{
|
||||
|
@ -53,7 +54,8 @@ class JsonLD
|
|||
*
|
||||
* @param array $json
|
||||
*
|
||||
* @return normalized JSON string
|
||||
* @return mixed|bool normalized JSON string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function normalize($json)
|
||||
{
|
||||
|
@ -77,7 +79,8 @@ class JsonLD
|
|||
*
|
||||
* @param array $json
|
||||
*
|
||||
* @return comacted JSON array
|
||||
* @return array Compacted JSON array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function compact($json)
|
||||
{
|
||||
|
@ -131,7 +134,7 @@ class JsonLD
|
|||
* @param $element
|
||||
* @param $key
|
||||
*
|
||||
* @return fetched element array
|
||||
* @return array fetched element
|
||||
*/
|
||||
public static function fetchElementArray($array, $element, $key = '@id')
|
||||
{
|
||||
|
@ -172,7 +175,7 @@ class JsonLD
|
|||
* @param $type
|
||||
* @param $type_value
|
||||
*
|
||||
* @return fetched element
|
||||
* @return string fetched element
|
||||
*/
|
||||
public static function fetchElement($array, $element, $key = '@id', $type = null, $type_value = null)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ class Network
|
|||
* @param string $cookiejar Path to cookie jar file
|
||||
*
|
||||
* @return string The fetched content
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
|
||||
{
|
||||
|
@ -55,6 +56,7 @@ class Network
|
|||
* @param string $cookiejar Path to cookie jar file
|
||||
*
|
||||
* @return CurlResult With all relevant information, 'body' contains the actual fetched content.
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
|
||||
{
|
||||
|
@ -86,6 +88,7 @@ class Network
|
|||
* 'header' => header array
|
||||
*
|
||||
* @return CurlResult
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
|
||||
{
|
||||
|
@ -245,6 +248,7 @@ class Network
|
|||
* @param integer $timeout The timeout in seconds, default system config value or 60 seconds
|
||||
*
|
||||
* @return CurlResult The content
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function post($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
|
||||
{
|
||||
|
@ -347,6 +351,7 @@ class Network
|
|||
*
|
||||
* @param string $url The URL to be validated
|
||||
* @return string|boolean The actual working URL, false else
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function isUrlValid($url)
|
||||
{
|
||||
|
@ -378,6 +383,7 @@ class Network
|
|||
*
|
||||
* @param string $addr The email address
|
||||
* @return boolean True if it's a valid email address, false if it's not
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function isEmailDomainValid($addr)
|
||||
{
|
||||
|
@ -409,6 +415,7 @@ class Network
|
|||
*
|
||||
* @param string $url URL which get tested
|
||||
* @return boolean True if url is allowed otherwise return false
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function isUrlAllowed($url)
|
||||
{
|
||||
|
@ -454,6 +461,7 @@ class Network
|
|||
* @param string $url The url to check the domain from
|
||||
*
|
||||
* @return boolean
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function isUrlBlocked($url)
|
||||
{
|
||||
|
@ -483,7 +491,8 @@ class Network
|
|||
*
|
||||
* @param string $email email address
|
||||
* @return boolean False if not allowed, true if allowed
|
||||
* or if allowed list is not configured
|
||||
* or if allowed list is not configured
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function isEmailDomainAllowed($email)
|
||||
{
|
||||
|
@ -597,14 +606,15 @@ class Network
|
|||
* This function strips tracking query params and follows redirections, either
|
||||
* through HTTP code or meta refresh tags. Stops after 10 redirections.
|
||||
*
|
||||
* @todo Remove the $fetchbody parameter that generates an extraneous HEAD request
|
||||
* @todo Remove the $fetchbody parameter that generates an extraneous HEAD request
|
||||
*
|
||||
* @see ParseUrl::getSiteinfo
|
||||
* @see ParseUrl::getSiteinfo
|
||||
*
|
||||
* @param string $url A user-submitted URL
|
||||
* @param int $depth The current redirection recursion level (internal)
|
||||
* @param bool $fetchbody Wether to fetch the body or not after the HEAD requests
|
||||
* @return string A canonical URL
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function finalUrl($url, $depth = 1, $fetchbody = false)
|
||||
{
|
||||
|
|
|
@ -22,10 +22,10 @@ class ParseUrl
|
|||
* @brief Search for chached embeddable data of an url otherwise fetch it
|
||||
*
|
||||
* @param string $url The url of the page which should be scraped
|
||||
* @param bool $no_guessing If true the parse doens't search for
|
||||
* preview pictures
|
||||
* @param bool $do_oembed The false option is used by the function fetch_oembed()
|
||||
* to avoid endless loops
|
||||
* @param bool $no_guessing If true the parse doens't search for
|
||||
* preview pictures
|
||||
* @param bool $do_oembed The false option is used by the function fetch_oembed()
|
||||
* to avoid endless loops
|
||||
*
|
||||
* @return array which contains needed data for embedding
|
||||
* string 'url' => The url of the parsed page
|
||||
|
@ -37,7 +37,8 @@ class ParseUrl
|
|||
* array'images' = Array of preview pictures
|
||||
* string 'keywords' => The tags which belong to the content
|
||||
*
|
||||
* @see ParseUrl::getSiteinfo() for more information about scraping
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @see ParseUrl::getSiteinfo() for more information about scraping
|
||||
* embeddable content
|
||||
*/
|
||||
public static function getSiteinfoCached($url, $no_guessing = false, $do_oembed = true)
|
||||
|
@ -68,6 +69,7 @@ class ParseUrl
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parse a page for embeddable content information
|
||||
*
|
||||
|
@ -79,11 +81,11 @@ class ParseUrl
|
|||
* \<meta name="description" content="An awesome description"\>
|
||||
*
|
||||
* @param string $url The url of the page which should be scraped
|
||||
* @param bool $no_guessing If true the parse doens't search for
|
||||
* preview pictures
|
||||
* @param bool $do_oembed The false option is used by the function fetch_oembed()
|
||||
* to avoid endless loops
|
||||
* @param int $count Internal counter to avoid endless loops
|
||||
* @param bool $no_guessing If true the parse doens't search for
|
||||
* preview pictures
|
||||
* @param bool $do_oembed The false option is used by the function fetch_oembed()
|
||||
* to avoid endless loops
|
||||
* @param int $count Internal counter to avoid endless loops
|
||||
*
|
||||
* @return array which contains needed data for embedding
|
||||
* string 'url' => The url of the parsed page
|
||||
|
@ -95,7 +97,8 @@ class ParseUrl
|
|||
* array'images' = Array of preview pictures
|
||||
* string 'keywords' => The tags which belong to the content
|
||||
*
|
||||
* @todo https://developers.google.com/+/plugins/snippet/
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @todo https://developers.google.com/+/plugins/snippet/
|
||||
* @verbatim
|
||||
* <meta itemprop="name" content="Awesome title">
|
||||
* <meta itemprop="description" content="An awesome description">
|
||||
|
|
|
@ -60,6 +60,7 @@ class Proxy
|
|||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
||||
*
|
||||
* @return string The proxyfied URL or relative path
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function proxifyUrl($url, $writemode = false, $size = '')
|
||||
{
|
||||
|
@ -138,6 +139,7 @@ class Proxy
|
|||
* @param string $html Un-proxified HTML code
|
||||
*
|
||||
* @return string Proxified HTML code
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function proxifyHtml($html)
|
||||
{
|
||||
|
@ -151,6 +153,7 @@ class Proxy
|
|||
*
|
||||
* @param string $url
|
||||
* @return boolean
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function isLocalImage($url)
|
||||
{
|
||||
|
@ -190,6 +193,7 @@ class Proxy
|
|||
*
|
||||
* @param array $matches Matches from preg_replace_callback()
|
||||
* @return string Proxified HTML image tag
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function replaceUrl(array $matches)
|
||||
{
|
||||
|
|
|
@ -13,12 +13,13 @@ use Friendica\Core\Logger;
|
|||
*/
|
||||
class Strings
|
||||
{
|
||||
/**
|
||||
* @brief Generates a pseudo-random string of hexadecimal characters
|
||||
*
|
||||
* @param int $size
|
||||
* @return string
|
||||
*/
|
||||
/**
|
||||
* @brief Generates a pseudo-random string of hexadecimal characters
|
||||
*
|
||||
* @param int $size
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getRandomHex($size = 64)
|
||||
{
|
||||
$byte_size = ceil($size / 2);
|
||||
|
@ -139,14 +140,15 @@ class Strings
|
|||
return $word;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Translate and format the network name of a contact
|
||||
*
|
||||
* @param string $network Network name of the contact (e.g. dfrn, rss and so on)
|
||||
* @param string $url The contact url
|
||||
*
|
||||
* @return string Formatted network name
|
||||
*/
|
||||
/**
|
||||
* Translate and format the network name of a contact
|
||||
*
|
||||
* @param string $network Network name of the contact (e.g. dfrn, rss and so on)
|
||||
* @param string $url The contact url
|
||||
*
|
||||
* @return string Formatted network name
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function formatNetworkName($network, $url = '')
|
||||
{
|
||||
if ($network != '') {
|
||||
|
@ -240,12 +242,13 @@ class Strings
|
|||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode Base64 Encoded URL and translate -_ to +/
|
||||
* @param string $s URL to decode
|
||||
*
|
||||
* @return string Decoded URL
|
||||
*/
|
||||
/**
|
||||
* @brief Decode Base64 Encoded URL and translate -_ to +/
|
||||
* @param string $s URL to decode
|
||||
*
|
||||
* @return string Decoded URL
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function base64UrlDecode($s)
|
||||
{
|
||||
if (is_array($s)) {
|
||||
|
|
|
@ -99,12 +99,13 @@ class Temporal
|
|||
* arguments follow convention as other field_* template array:
|
||||
* 'name', 'label', $value, 'help'
|
||||
*
|
||||
* @param string $name Name of the selector
|
||||
* @param string $label Label for the selector
|
||||
* @param string $name Name of the selector
|
||||
* @param string $label Label for the selector
|
||||
* @param string $current Timezone
|
||||
* @param string $help Help text
|
||||
* @param string $help Help text
|
||||
*
|
||||
* @return string Parsed HTML
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getTimezoneField($name = 'timezone', $label = '', $current = 'America/Los_Angeles', $help = '')
|
||||
{
|
||||
|
@ -123,6 +124,7 @@ class Temporal
|
|||
*
|
||||
* @param string $dob Date of Birth
|
||||
* @return string Formatted HTML
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getDateofBirthField($dob)
|
||||
{
|
||||
|
@ -163,6 +165,7 @@ class Temporal
|
|||
* @param string $id ID and name of datetimepicker (defaults to "datetimepicker")
|
||||
*
|
||||
* @return string Parsed HTML output.
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getDateField($min, $max, $default, $id = 'datepicker')
|
||||
{
|
||||
|
@ -177,6 +180,7 @@ class Temporal
|
|||
* @param string $id ID and name of datetimepicker (defaults to "timepicker")
|
||||
*
|
||||
* @return string Parsed HTML output.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getTimeField($h, $m, $id = 'timepicker')
|
||||
{
|
||||
|
@ -189,6 +193,7 @@ class Temporal
|
|||
* @param DateTime $minDate Minimum date
|
||||
* @param DateTime $maxDate Maximum date
|
||||
* @param DateTime $defaultDate Default date
|
||||
* @param $label
|
||||
* @param string $id Id and name of datetimepicker (defaults to "datetimepicker")
|
||||
* @param bool $pickdate true to show date picker (default)
|
||||
* @param bool $picktime true to show time picker (default)
|
||||
|
@ -198,7 +203,8 @@ class Temporal
|
|||
*
|
||||
* @return string Parsed HTML output.
|
||||
*
|
||||
* @todo Once browser support is better this could probably be replaced with
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @todo Once browser support is better this could probably be replaced with
|
||||
* native HTML5 date picker.
|
||||
*/
|
||||
public static function getDateTimeField(
|
||||
|
@ -348,11 +354,12 @@ class Temporal
|
|||
* and become a year older. If you wish me happy birthday on January 1
|
||||
* (San Bruno time), you'll be a day late.
|
||||
*
|
||||
* @param string $dob Date of Birth
|
||||
* @param string $owner_tz (optional) Timezone of the person of interest
|
||||
* @param string $dob Date of Birth
|
||||
* @param string $owner_tz (optional) Timezone of the person of interest
|
||||
* @param string $viewer_tz (optional) Timezone of the person viewing
|
||||
*
|
||||
* @return int Age in years
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getAgeByTimezone($dob, $owner_tz = '', $viewer_tz = '')
|
||||
{
|
||||
|
@ -404,6 +411,7 @@ class Temporal
|
|||
* @param int $m Month (1=January, 12=December)
|
||||
*
|
||||
* @return string day 0 = Sunday through 6 = Saturday
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function getFirstDayInMonth($y, $m)
|
||||
{
|
||||
|
@ -420,14 +428,15 @@ class Temporal
|
|||
* altering td class.
|
||||
* Months count from 1.
|
||||
*
|
||||
* @param int $y Year
|
||||
* @param int $m Month
|
||||
* @param int $y Year
|
||||
* @param int $m Month
|
||||
* @param array $links (default null)
|
||||
* @param string $class
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @todo Provide (prev, next) links, define class variations for different size calendars
|
||||
* @throws \Exception
|
||||
* @todo Provide (prev, next) links, define class variations for different size calendars
|
||||
*/
|
||||
public static function getCalendarTable($y = 0, $m = 0, $links = null, $class = '')
|
||||
{
|
||||
|
|
|
@ -230,17 +230,18 @@ class XML
|
|||
* (namespaces, lowercase tags, get_attribute default changed, more...)
|
||||
*
|
||||
* Examples: $array = Xml::toArray(file_get_contents('feed.xml'));
|
||||
* $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute'));
|
||||
* $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute'));
|
||||
*
|
||||
* @param object $contents The XML text
|
||||
* @param boolean $namespaces True or false include namespace information
|
||||
* in the returned array as array elements.
|
||||
* @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values -
|
||||
* this results in a different array structure in the return value.
|
||||
* @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting
|
||||
* array sturcture. For 'tag', the tags are given more importance.
|
||||
* @param object $contents The XML text
|
||||
* @param boolean $namespaces True or false include namespace information
|
||||
* in the returned array as array elements.
|
||||
* @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values -
|
||||
* this results in a different array structure in the return value.
|
||||
* @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting
|
||||
* array sturcture. For 'tag', the tags are given more importance.
|
||||
*
|
||||
* @return array The parsed XML in an array form. Use print_r() to see the resulting array structure.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function toArray($contents, $namespaces = true, $get_attributes = 1, $priority = 'attribute')
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue