Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+32 -7
View File
@@ -11,7 +11,7 @@
namespace IPS\Http\Url;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -34,7 +34,7 @@ class _Internal extends \IPS\Http\Url
*/
protected static function createInternalFromComponents( $base, $protocol, $path, $query = NULL, $fragment = NULL )
{
$baseUrlData = parse_url( static::baseUrl( is_numeric( $protocol ) ? $protocol : NULL ) );
$baseUrlData = parse_url( static::baseUrl( \is_numeric( $protocol ) ? $protocol : NULL ) );
$pathToUse = '';
if ( isset( $baseUrlData['path'] ) and $baseUrlData['path'] )
@@ -52,7 +52,7 @@ class _Internal extends \IPS\Http\Url
$return = static::createFromComponents(
$baseUrlData['host'],
( is_string( $protocol ) and !is_numeric( $protocol ) ) ? $protocol : ( ( isset( $baseUrlData['scheme'] ) AND $protocol !== NULL ) ? $baseUrlData['scheme'] : NULL ),
( \is_string( $protocol ) and !\is_numeric( $protocol ) ) ? $protocol : ( ( isset( $baseUrlData['scheme'] ) AND $protocol !== NULL ) ? $baseUrlData['scheme'] : NULL ),
$pathToUse ? "/{$pathToUse}" : '',
$query,
isset( $baseUrlData['port'] ) ? $baseUrlData['port'] : NULL,
@@ -65,6 +65,11 @@ class _Internal extends \IPS\Http\Url
return $return;
}
/**
* @brief Does this URL have the SEO pagination (page/n/)?
*/
public $seoPagination = NULL;
/**
* @brief Base
*/
@@ -100,7 +105,7 @@ class _Internal extends \IPS\Http\Url
}
/* If this definition requires a parameter, see if we have it. If not, skip to next definition to check. */
if( count( array_diff( $params, array_keys( $this->queryString ) ) ) )
if( \count( array_diff( $params, array_keys( $this->queryString ) ) ) )
{
continue;
}
@@ -158,7 +163,8 @@ class _Internal extends \IPS\Http\Url
/**
* Get the correct URL using a "verify" property from the FURL definition
*
* @return
* @param object $verify Class containing `preCorrectUrlFromVerifyClass()` method to check URL against
* @return NULL|\IPS\Http\Url
* @throws \OutOfRangeException
*/
protected function correctUrlFromVerifyClass( $verify )
@@ -198,7 +204,7 @@ class _Internal extends \IPS\Http\Url
$paramsToSet[ $k ] = $v;
}
}
if ( count( $paramsToSet ) )
if ( \count( $paramsToSet ) )
{
$correctUrl = $correctUrl->setQueryString( $paramsToSet );
}
@@ -217,6 +223,26 @@ class _Internal extends \IPS\Http\Url
return $this->setQueryString( 'csrfKey', \IPS\Session::i()->csrfKey );
}
/**
* Adds the page parameter to the URL
*
* @param string $param The page key, default is 'page'
* @param int|NULL $number The page number to use
* @return \IPS\Http\Url
*/
public function setPage( $param='page', $number=1 )
{
/* Remove any existing page param */
$url = $this->stripQueryString( $param );
if ( \intval( $number ) > 1 )
{
$url = $this->setQueryString( $param, $number );
}
return $url;
}
/**
* Get ACP query string without adsess
*
@@ -225,7 +251,6 @@ class _Internal extends \IPS\Http\Url
public function acpQueryString()
{
$queryString = $this->queryString;
unset( $queryString['adsess'] );
unset( $queryString['csrf'] );
return static::convertQueryAsArrayToString( $queryString );
}