Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
+118
-9
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Output Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS;
|
||||
@@ -228,7 +227,6 @@ class _Output
|
||||
|
||||
if ( $location === 'interface' AND mb_substr( $file, -3 ) === '.js' )
|
||||
{
|
||||
/* @see http://community.invisionpower.com/4bugtrack/some-js-files-get-loaded-with-a-double-in-the-url-r3558/ */
|
||||
return array( rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' ) . "/applications/{$app}/interface/{$file}?v=" . ( defined( \IPS\CACHEBUST_KEY ) ? \IPS\CACHEBUST_KEY : time() ) );
|
||||
}
|
||||
elseif ( \IPS\IN_DEV )
|
||||
@@ -408,7 +406,6 @@ class _Output
|
||||
* @param string $filename Filename
|
||||
* @return string
|
||||
* @see <a href='http://code.google.com/p/browsersec/wiki/Part2#Downloads_and_Content-Disposition'>Browser content-disposition handling</a>
|
||||
* @see <a href='http://community.invisionpower.com/resources/bugs.html/_/4-0-0/downloads-special-characters-in-filenames-r46080'>Chrome does not need name encoded anymore</a>
|
||||
*/
|
||||
public static function getContentDisposition( $disposition='attachment', $filename=NULL )
|
||||
{
|
||||
@@ -424,7 +421,7 @@ class _Output
|
||||
\IPS\Session\Front::i();
|
||||
}
|
||||
|
||||
switch( \IPS\Session::i()->userAgent->useragentKey )
|
||||
switch( \IPS\Session::i()->userAgent->browser )
|
||||
{
|
||||
case 'firefox':
|
||||
case 'opera':
|
||||
@@ -518,7 +515,13 @@ class _Output
|
||||
/* If we just logged out, we don't want to show a "no permission" error */
|
||||
if ( isset( \IPS\Request::i()->_fromLogout ) )
|
||||
{
|
||||
$this->redirect( \IPS\Settings::i()->base_url );
|
||||
$this->redirect( \IPS\Http\Url::internal('')->stripQueryString()->setQueryString( '_fromLogout', 1 ) );
|
||||
}
|
||||
|
||||
/* If we just logged in and we need to do MFA, do that */
|
||||
if ( isset( \IPS\Request::i()->_mfaLogin ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=login", 'front', 'login', NULL, \IPS\Settings::i()->logins_over_https )->setQueryString( '_mfaLogin', 1 ) );
|
||||
}
|
||||
|
||||
/* If we're in an external script, just show a simple message */
|
||||
@@ -982,6 +985,11 @@ class _Output
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief JSON-LD structured data
|
||||
*/
|
||||
public $jsonLd = array();
|
||||
|
||||
/**
|
||||
* Fetch meta tags for the current page. Must be called before sendOutput() in order to reset title.
|
||||
*
|
||||
@@ -1093,6 +1101,107 @@ class _Output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Automatically generate JSON-LD markup */
|
||||
$jsonLd = array(
|
||||
'website' => array(
|
||||
'@context' => "http://www.schema.org",
|
||||
'@type' => "WebSite",
|
||||
'name' => \IPS\Settings::i()->board_name,
|
||||
'url' => \IPS\Settings::i()->base_url,
|
||||
'potentialAction' => array(
|
||||
'type' => "SearchAction",
|
||||
'query-input' => "required name=query",
|
||||
'target' => urldecode( (string) \IPS\Http\Url::internal( "app=core&module=search&controller=search", "front", "search" )->setQueryString( "q", "{query}" ) ),
|
||||
),
|
||||
'inLanguage' => array()
|
||||
),
|
||||
'organization' => array(
|
||||
'@context' => "http://www.schema.org",
|
||||
'@type' => "Organization",
|
||||
'name' => \IPS\Settings::i()->board_name,
|
||||
'url' => \IPS\Settings::i()->base_url,
|
||||
)
|
||||
);
|
||||
|
||||
if( \IPS\Theme::i()->logo_front )
|
||||
{
|
||||
$jsonLd['organization']['logo'] = (string) \IPS\Theme::i()->logo_front;
|
||||
}
|
||||
|
||||
if( \IPS\Settings::i()->site_social_profiles AND $links = json_decode( \IPS\Settings::i()->site_social_profiles, TRUE ) AND count( $links ) )
|
||||
{
|
||||
if( !isset( $jsonLd['organization']['sameAs'] ) )
|
||||
{
|
||||
$jsonLd['organization']['sameAs'] = array();
|
||||
}
|
||||
|
||||
foreach( $links as $link )
|
||||
{
|
||||
$jsonLd['organization']['sameAs'][] = $link['key'];
|
||||
}
|
||||
}
|
||||
|
||||
if( \IPS\Settings::i()->site_address AND $address = \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->site_address ) )
|
||||
{
|
||||
$jsonLd['organization']['address'] = array(
|
||||
'@type' => 'PostalAddress',
|
||||
'streetAddress' => implode( ', ', $address->addressLines ),
|
||||
'addressLocality' => $address->city,
|
||||
'addressRegion' => $address->region,
|
||||
'postalCode' => $address->postalCode,
|
||||
'addressCountry' => $address->country,
|
||||
);
|
||||
}
|
||||
|
||||
foreach( \IPS\Lang::getEnabledLanguages() as $language )
|
||||
{
|
||||
$jsonLd['website']['inLanguage'][] = array(
|
||||
'@type' => "Language",
|
||||
'name' => $language->title,
|
||||
'alternateName' => $language->bcp47()
|
||||
);
|
||||
}
|
||||
|
||||
/* Add breadcrumbs */
|
||||
if( count( $this->breadcrumb ) )
|
||||
{
|
||||
$jsonLd['breadcrumbs'] = array(
|
||||
'@context' => "http://schema.org",
|
||||
'@type' => "BreadcrumbList",
|
||||
'itemListElement' => array(),
|
||||
);
|
||||
|
||||
$position = 1;
|
||||
|
||||
foreach( $this->breadcrumb as $breadcrumb )
|
||||
{
|
||||
if( $breadcrumb[0] )
|
||||
{
|
||||
$jsonLd['breadcrumbs']['itemListElement'][] = array(
|
||||
'@type' => "ListItem",
|
||||
'position' => $position,
|
||||
'item' => array(
|
||||
'@id' => (string) $breadcrumb[0],
|
||||
'name' => htmlspecialchars( $breadcrumb[1], ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
)
|
||||
);
|
||||
|
||||
$position++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( \IPS\Member::loggedIn()->canUseContactUs() )
|
||||
{
|
||||
$jsonLd['contact'] = array(
|
||||
'@context' => "http://schema.org",
|
||||
'@type' => "ContactPage",
|
||||
'url' => urldecode( (string) \IPS\Http\Url::internal( "app=core&module=contact&controller=contact", "front", "contact" ) ),
|
||||
);
|
||||
}
|
||||
|
||||
$this->jsonLd = array_merge( $this->jsonLd, $jsonLd );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user