Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Record View
|
||||
* @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
|
||||
* @subpackage Content
|
||||
* @since 17 Apr 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\cms\modules\front\database;
|
||||
@@ -146,6 +145,9 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->metaTags['og:description'] = $record->record_meta_description;
|
||||
}
|
||||
|
||||
/* Set record URL as canonical tag */
|
||||
\IPS\Output::i()->linkTags['canonical'] = $record->url();
|
||||
|
||||
/* Update location */
|
||||
if( $record->database()->use_categories )
|
||||
{
|
||||
@@ -172,6 +174,82 @@ class _record extends \IPS\Content\Controller
|
||||
{
|
||||
\IPS\Output::i()->metaTags['og:image'] = (string) \IPS\File::get( 'cms_Records', $record->record_image )->url;
|
||||
}
|
||||
|
||||
/* Add Json-LD */
|
||||
\IPS\Output::i()->jsonLd['article'] = array(
|
||||
'@context' => "http://schema.org",
|
||||
'@type' => "Article",
|
||||
'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 ),
|
||||
'text' => strip_tags( $record->truncated() ),
|
||||
'articleBody' => strip_tags( $record->truncated() ),
|
||||
'dateCreated' => \IPS\DateTime::ts( $record->record_saved )->format( \IPS\DateTime::ISO8601 ),
|
||||
'datePublished' => \IPS\DateTime::ts( $record->record_publish_date ?: $record->record_saved )->format( \IPS\DateTime::ISO8601 ),
|
||||
'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(),
|
||||
'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(),
|
||||
'image' => \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'logo' => \IPS\Member::load( $record->member_id )->get_photo()
|
||||
),
|
||||
'interactionStatistic' => array(
|
||||
array(
|
||||
'@type' => 'InteractionCounter',
|
||||
'interactionType' => "http://schema.org/ViewAction",
|
||||
'userInteractionCount' => $record->record_views
|
||||
),
|
||||
array(
|
||||
'@type' => 'InteractionCounter',
|
||||
'interactionType' => "http://schema.org/FollowAction",
|
||||
'userInteractionCount' => $record::containerFollowerCount( $record->container() )
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if( $record->averageReviewRating() )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['aggregateRating'] = array(
|
||||
'@type' => 'AggregateRating',
|
||||
'ratingValue' => $record->averageReviewRating(),
|
||||
'ratingCount' => $record->rating_hits,
|
||||
'reviewCount' => $record->record_reviews,
|
||||
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
|
||||
);
|
||||
}
|
||||
|
||||
if( $record::database()->options['reviews'] )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['interactionStatistic'][] = array(
|
||||
'@type' => 'InteractionCounter',
|
||||
'interactionType' => "http://schema.org/ReviewAction",
|
||||
'userInteractionCount' => $record->record_reviews
|
||||
);
|
||||
}
|
||||
|
||||
if( $record::database()->options['comments'] )
|
||||
{
|
||||
\IPS\Output::i()->jsonLd['article']['commentCount'] = $record->record_comments;
|
||||
\IPS\Output::i()->jsonLd['article']['interactionStatistic'][] = array(
|
||||
'@type' => 'InteractionCounter',
|
||||
'interactionType' => "http://schema.org/CommentAction",
|
||||
'userInteractionCount' => $record->record_comments
|
||||
);
|
||||
}
|
||||
|
||||
\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\cms\Databases\Dispatcher::i()->output .= \IPS\cms\Theme::i()->getTemplate( $record->container()->_template_display, 'cms', 'database' )->record( $record, $comments, $form, $nextUnread );
|
||||
@@ -304,8 +382,8 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( $record->url(), $record->_title );
|
||||
|
||||
\IPS\Output::i()->title = $title;
|
||||
\IPS\Output::i()->output .= (string) $table;
|
||||
\IPS\Output::i()->title = $title;
|
||||
\IPS\cms\Databases\Dispatcher::i()->output .= (string) $table;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,7 +524,7 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'codemirror/codemirror.js', 'core', 'interface' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'codemirror/codemirror.css', 'core', 'interface' ) );
|
||||
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'revisions', 'cms' ), 'view' ), $record, $revision, $conflicts );
|
||||
\IPS\cms\Databases\Dispatcher::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'revisions', 'cms' ), 'view' ), $record, $revision, $conflicts );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -527,7 +605,7 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->allowDefaultWidgets = FALSE;
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\cms\Pages\Page::$currentPage->getWidgets();
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), array( $database->template_form, 'cms', 'database' ) ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\cms\Databases\Dispatcher::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), array( $database->template_form, 'cms', 'database' ) ), 'recordForm' ), NULL, $category, $database, \IPS\cms\Pages\Page::$currentPage, $title, $hasModOptions );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( $title );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -698,9 +776,9 @@ class _record extends \IPS\Content\Controller
|
||||
* @return void
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function _rep( $commentClass, $comment, $item )
|
||||
protected function _react( $commentClass, $comment, $item )
|
||||
{
|
||||
return $this->_doSomething( '_rep', $commentClass, $comment, $item );
|
||||
return $this->_doSomething( '_react', $commentClass, $comment, $item );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -712,9 +790,9 @@ class _record extends \IPS\Content\Controller
|
||||
* @return void
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function _showRep( $commentClass, $comment, $item )
|
||||
protected function _showReactions( $commentClass, $comment, $item )
|
||||
{
|
||||
return $this->_doSomething( '_showRep', $commentClass, $comment, $item );
|
||||
return $this->_doSomething( '_showReactions', $commentClass, $comment, $item );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -747,4 +825,16 @@ class _record extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->error( 'node_error', '2T252/F', 403, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moderate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function moderate()
|
||||
{
|
||||
parent::moderate();
|
||||
|
||||
\IPS\cms\Databases\Dispatcher::i()->output = \IPS\Output::i()->output;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user