File manager - Edit - /home/ferretapmx/public_html/article.tar
Back
src/Extension/Article.php 0000644 00000005106 15231065043 0011404 0 ustar 00 <?php /** * @package Joomla.Plugin * @subpackage Schemaorg.article * * @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Schemaorg\Article\Extension; use Joomla\CMS\Event\Plugin\System\Schemaorg\BeforeCompileHeadEvent; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Schemaorg\SchemaorgPluginTrait; use Joomla\CMS\Schemaorg\SchemaorgPrepareDateTrait; use Joomla\CMS\Schemaorg\SchemaorgPrepareImageTrait; use Joomla\Event\Priority; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Schemaorg Plugin * * @since 5.1.0 */ final class Article extends CMSPlugin implements SubscriberInterface { use SchemaorgPluginTrait; use SchemaorgPrepareDateTrait; use SchemaorgPrepareImageTrait; /** * Load the language file on instantiation. * * @var boolean * @since 5.1.0 */ protected $autoloadLanguage = true; /** * The name of the schema form * * @var string * @since 5.1.0 */ protected $pluginName = 'Article'; /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.1.0 */ public static function getSubscribedEvents(): array { return [ 'onSchemaPrepareForm' => 'onSchemaPrepareForm', 'onSchemaBeforeCompileHead' => ['onSchemaBeforeCompileHead', Priority::BELOW_NORMAL], ]; } /** * Cleanup all Article types * * @param BeforeCompileHeadEvent $event The given event * * @return void * * @since 5.1.0 */ public function onSchemaBeforeCompileHead(BeforeCompileHeadEvent $event): void { $schema = $event->getSchema(); $graph = $schema->get('@graph'); foreach ($graph as &$entry) { if (!isset($entry['@type']) || $entry['@type'] !== 'Article') { continue; } if (!empty($entry['datePublished'])) { $entry['datePublished'] = $this->prepareDate($entry['datePublished']); } if (!empty($entry['dateModified'])) { $entry['dateModified'] = $this->prepareDate($entry['dateModified']); } if (!empty($entry['image'])) { $entry['image'] = $this->prepareImage($entry['image']); } } $schema->set('@graph', $graph); } } src/Extension/.htaccess 0000555 00000000355 15231065043 0011110 0 ustar 00 <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>