first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="schemaorg" method="upgrade">
<name>plg_schemaorg_blogposting</name>
<author>Joomla! Project</author>
<creationDate>2023-07</creationDate>
<copyright>(C) 2023 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>5.0.0</version>
<description>PLG_SCHEMAORG_BLOGPOSTING_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Schemaorg\BlogPosting</namespace>
<files>
<folder plugin="blogposting">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_schemaorg_blogposting.ini</language>
<language tag="en-GB">language/en-GB/plg_schemaorg_blogposting.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="allowedlist"
type="SchemaorgComponentSections"
label="JSCHEMAORG_EXTENSION_ALLOWED_LABEL"
description="JSCHEMAORG_EXTENSION_ALLOWED_DESCRIPTION"
multiple="multiple"
layout="joomla.form.field.list-fancy-select"
/>
<field
name="forbiddenlist"
type="SchemaorgComponentSections"
label="JSCHEMAORG_EXTENSION_FORBIDDEN_LABEL"
description="JSCHEMAORG_EXTENSION_FORBIDDEN_DESCRIPTION"
multiple="multiple"
layout="joomla.form.field.list-fancy-select"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fields name="schema">
<fieldset
name="schema"
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
>
<field
name="BlogPosting"
type="subform"
showon="schemaType:BlogPosting"
>
<form>
<field
name="@type"
type="hidden"
default="BlogPosting"
/>
<field
name="noteBlogPost"
type="note"
description="PLG_SCHEMAORG_BLOGPOSTING_DESCRIPTION_LABEL"
class="alert alert-info w-100"
/>
<field
name="image"
type="media"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_IMAGE_LABEL"
/>
<field
name="headline"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_HEADLINE_LABEL"
filter="string"
size="30"
/>
<field
name="description"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_DESCRIPTION_LABEL"
filter="string"
/>
<field
name="author"
type="subform"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_AUTHOR_LABEL"
>
<form>
<field
name="@type"
type="list"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_TYPE_LABEL"
default="person"
>
<option value="person">PLG_SCHEMAORG_BLOGPOSTING_FIELD_PERSON_LABEL</option>
<option value="organization">PLG_SCHEMAORG_BLOGPOSTING_FIELD_ORGANIZATION_LABEL</option>
</field>
<field
name="name"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_NAME_LABEL"
filter="string"
/>
<field
name="url"
type="url"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_URL_LABEL"
filter="url"
validate="url"
/>
<field
name="logo"
type="subform"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_LOGO_LABEL"
showon="@type:organization"
>
<form>
<field
name="@type"
type="hidden"
default="ImageObject"
/>
<field
name="url"
type="media"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_URL_LABEL"
/>
</form>
</field>
<field
name="email"
type="email"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_EMAIL_LABEL"
validate="email"
/>
<field
name="address"
type="subform"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_ADDRESS_LABEL"
>
<form>
<field
name="@type"
type="hidden"
default="PostalAddress"
/>
<field
name="addressLocality"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_LOCALITY_LABEL"
/>
<field
name="postalCode"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_POSTAL_CODE_LABEL"
/>
<field
name="streetAddress"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_STREET_ADDRESS_LABEL"
/>
</form>
</field>
</form>
</field>
<field
name="datePublished"
type="calendar"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_DATE_PUBLISHED_LABEL"
class="input-small"
filter="user_utc"
showtime="false"
todaybutton="true"
translateformat="true"
/>
<field
name="dateModified"
type="calendar"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_DATE_MODIFIED_LABEL"
class="input-small"
filter="user_utc"
showtime="false"
todaybutton="true"
translateformat="true"
/>
<field
name="genericField"
type="subform"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_GENERIC_FIELD_LABEL"
multiple="true"
>
<form>
<field
name="genericTitle"
type="text"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_GENERIC_TITLE_LABEL"
filter="string"
size="30"
/>
<field
name="genericValue"
type="text"
filter="string"
size="30"
label="PLG_SCHEMAORG_BLOGPOSTING_FIELD_GENERIC_VALUE_LABEL"
/>
</form>
</field>
</form>
</field>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Schemaorg.blogposting
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Schemaorg\BlogPosting\Extension\BlogPosting;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 5.0.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new BlogPosting(
$dispatcher,
(array) PluginHelper::getPlugin('schemaorg', 'blogposting')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,102 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Schemaorg.blogposting
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Schemaorg\BlogPosting\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.0.0
*/
final class BlogPosting extends CMSPlugin implements SubscriberInterface
{
use SchemaorgPluginTrait;
use SchemaorgPrepareDateTrait;
use SchemaorgPrepareImageTrait;
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 5.0.0
*/
protected $autoloadLanguage = true;
/**
* The name of the schema form
*
* @var string
* @since 5.0.0
*/
protected $pluginName = 'BlogPosting';
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 5.0.0
*/
public static function getSubscribedEvents(): array
{
return [
'onSchemaPrepareForm' => 'onSchemaPrepareForm',
'onSchemaBeforeCompileHead' => ['onSchemaBeforeCompileHead', Priority::BELOW_NORMAL],
];
}
/**
* Cleanup all BlogPosting types
*
* @param BeforeCompileHeadEvent $event The given event
*
* @return void
*
* @since 5.0.0
*/
public function onSchemaBeforeCompileHead(BeforeCompileHeadEvent $event): void
{
$schema = $event->getSchema();
$graph = $schema->get('@graph');
foreach ($graph as &$entry) {
if (!isset($entry['@type']) || $entry['@type'] !== 'BlogPosting') {
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);
}
}