Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -182,8 +182,8 @@ class _record extends \IPS\Content\Controller
|
||||
'url' => (string) $record->url(),
|
||||
'discussionUrl' => (string) $record->url(),
|
||||
'mainEntityOfPage' => (string) $record->url(),
|
||||
'name' => htmlspecialchars( $record->_title, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'headline' => htmlspecialchars( $record->_title, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'name' => $record->_title,
|
||||
'headline' => $record->_title,
|
||||
'text' => strip_tags( $record->truncated() ),
|
||||
'articleBody' => strip_tags( $record->truncated() ),
|
||||
'dateCreated' => \IPS\DateTime::ts( $record->record_saved )->format( \IPS\DateTime::ISO8601 ),
|
||||
@@ -191,20 +191,19 @@ class _record extends \IPS\Content\Controller
|
||||
'dateModified' => \IPS\DateTime::ts( $record->record_edit_time ?: ( $record->record_publish_date ?: $record->record_saved ) )->format( \IPS\DateTime::ISO8601 ),
|
||||
'pageStart' => 1,
|
||||
'pageEnd' => $record->commentPageCount(),
|
||||
/* Image is required */
|
||||
'image' => $record->record_image ? (string) \IPS\File::get( 'cms_Records', $record->record_image )->url : \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'author' => array(
|
||||
'@type' => 'Person',
|
||||
'name' => htmlspecialchars( \IPS\Member::load( $record->member_id )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'url' => (string) \IPS\Member::load( $record->member_id )->url(),
|
||||
'name' => \IPS\Member::load( $record->member_id )->name,
|
||||
'image' => \IPS\Member::load( $record->member_id )->get_photo()
|
||||
),
|
||||
'publisher' => array(
|
||||
'@type' => 'Organization',
|
||||
'name' => htmlspecialchars( \IPS\Member::load( $record->member_id )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
|
||||
'url' => (string) \IPS\Member::load( $record->member_id )->url(),
|
||||
'name' => \IPS\Member::load( $record->member_id )->name,
|
||||
'image' => \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'logo' => \IPS\Member::load( $record->member_id )->get_photo()
|
||||
'logo' => array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
)
|
||||
),
|
||||
'interactionStatistic' => array(
|
||||
array(
|
||||
@@ -220,6 +219,44 @@ class _record extends \IPS\Content\Controller
|
||||
),
|
||||
);
|
||||
|
||||
/* Do we have a real author? */
|
||||
if( $record->member_id )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['author']['url'] = (string) \IPS\Member::load( $record->member_id )->url();
|
||||
\IPS\Output::i()->jsonLd['article']['publisher']['url'] = (string) \IPS\Member::load( $record->member_id )->url();
|
||||
}
|
||||
|
||||
/* Image is required */
|
||||
if( $record->record_image )
|
||||
{
|
||||
try
|
||||
{
|
||||
$imageObj = \IPS\File::get( 'cms_Records', $record->record_image );
|
||||
$imageDims = $imageObj->getImageDimensions();
|
||||
|
||||
\IPS\Output::i()->jsonLd['article']['image'] = array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => (string) $imageObj->url,
|
||||
'width' => $imageDims[0],
|
||||
'height' => $imageDims[1]
|
||||
);
|
||||
}
|
||||
/* File doesn't exist */
|
||||
catch ( \RuntimeException $e ){}
|
||||
catch ( \DomainException $e ){}
|
||||
}
|
||||
else
|
||||
{
|
||||
$photoVars = explode( 'x', \IPS\THUMBNAIL_SIZE );
|
||||
|
||||
\IPS\Output::i()->jsonLd['article']['image'] = array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'width' => $photoVars[0],
|
||||
'height' => $photoVars[1]
|
||||
);
|
||||
}
|
||||
|
||||
if( $record->averageReviewRating() )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['aggregateRating'] = array(
|
||||
@@ -230,6 +267,14 @@ class _record extends \IPS\Content\Controller
|
||||
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
|
||||
);
|
||||
}
|
||||
elseif( $record->container()->allow_rating )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
'ratingValue' => $record->averageRating(),
|
||||
'ratingCount' => $record->numberOfRatings(),
|
||||
);
|
||||
}
|
||||
|
||||
if( $record::database()->options['reviews'] )
|
||||
{
|
||||
@@ -251,7 +296,15 @@ class _record extends \IPS\Content\Controller
|
||||
}
|
||||
|
||||
\IPS\Output::i()->contextualSearchOptions = array();
|
||||
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $record::$title ) ) ) ) ] = array( 'type' => mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ), 'nodes' => $record->_id );
|
||||
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $record::$title ) ) ) ) ] = array( 'type' => mb_strtolower( str_replace( '\\', '_', mb_substr( get_class( $record ), 4 ) ) ), 'item' => $record->_id );
|
||||
|
||||
try
|
||||
{
|
||||
$container = $record->container();
|
||||
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item_categories' ) ] = array( 'type' => mb_strtolower( str_replace( '\\', '_', mb_substr( get_class( $record ), 4 ) ) ), 'nodes' => $container->_id );
|
||||
}
|
||||
catch ( \BadMethodCallException $e ) { }
|
||||
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $record->container()->_template_display, 'cms', 'database' )->record( $record, $comments, $form, $nextUnread );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user