first commit
This commit is contained in:
43
plugins/schemaorg/blogposting/blogposting.xml
Executable file
43
plugins/schemaorg/blogposting/blogposting.xml
Executable 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>
|
||||
199
plugins/schemaorg/blogposting/forms/schemaorg.xml
Executable file
199
plugins/schemaorg/blogposting/forms/schemaorg.xml
Executable 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>
|
||||
47
plugins/schemaorg/blogposting/services/provider.php
Normal file
47
plugins/schemaorg/blogposting/services/provider.php
Normal 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;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
102
plugins/schemaorg/blogposting/src/Extension/BlogPosting.php
Executable file
102
plugins/schemaorg/blogposting/src/Extension/BlogPosting.php
Executable 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);
|
||||
}
|
||||
}
|
||||
43
plugins/schemaorg/book/book.xml
Executable file
43
plugins/schemaorg/book/book.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_book</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_BOOK_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\Book</namespace>
|
||||
<files>
|
||||
<folder plugin="book">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_book.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_book.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>
|
||||
205
plugins/schemaorg/book/forms/schemaorg.xml
Executable file
205
plugins/schemaorg/book/forms/schemaorg.xml
Executable file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="Book"
|
||||
type="subform"
|
||||
showon="schemaType:Book"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Book"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteBook"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_BOOK_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_NAME_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_AUTHOR_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="datePublished"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_DATE_PUBLISHED_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="abridged"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_ABRIDGED_LABEL"
|
||||
default="0"
|
||||
>
|
||||
<option>JNONE</option>
|
||||
<option value="true">JYES</option>
|
||||
<option value="false">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="bookEdition"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_BOOK_EDITION_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="bookFormat"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_BOOK_FORMAT_LABEL"
|
||||
default="0"
|
||||
>
|
||||
<option>JNONE</option>
|
||||
<option value="AudiobookFormat">PLG_SCHEMAORG_BOOK_FIELD_AUDIOBOOK_LABEL</option>
|
||||
<option value="EBook">PLG_SCHEMAORG_BOOK_FIELD_E_BOOK_LABEL</option>
|
||||
<option value="GraphicNovel">PLG_SCHEMAORG_BOOK_FIELD_GRAPHIC_NOVEL</option>
|
||||
<option value="Hardcover">PLG_SCHEMAORG_BOOK_FIELD_HARDCOVER_LABEL</option>
|
||||
<option value="Paperback">PLG_SCHEMAORG_BOOK_FIELD_PAPERBACK_LABEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="illustrator"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_ILLUSTRATOR_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Person"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_ILLUSTRATOR_NAME_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="url"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_URL_LABEL"
|
||||
filter="url"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="email"
|
||||
type="email"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_EMAIL_LABEL"
|
||||
validate="email"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="isbn"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_ISBN_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="numberOfPages"
|
||||
type="number"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_NUMBER_OF_PAGES_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_GENERIC_TITLE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_BOOK_FIELD_GENERIC_VALUE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
49
plugins/schemaorg/book/services/provider.php
Normal file
49
plugins/schemaorg/book/services/provider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.book
|
||||
*
|
||||
* @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\Book\Extension\Book;
|
||||
|
||||
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 Book(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'book')
|
||||
);
|
||||
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
92
plugins/schemaorg/book/src/Extension/Book.php
Executable file
92
plugins/schemaorg/book/src/Extension/Book.php
Executable file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.book
|
||||
*
|
||||
* @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\Book\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\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 Book extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use SchemaorgPluginTrait;
|
||||
use SchemaorgPrepareDateTrait;
|
||||
|
||||
/**
|
||||
* 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 = 'Book';
|
||||
|
||||
/**
|
||||
* 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 Book 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'] !== 'Book') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($entry['datePublished'])) {
|
||||
$entry['datePublished'] = $this->prepareDate($entry['datePublished']);
|
||||
}
|
||||
}
|
||||
|
||||
$schema->set('@graph', $graph);
|
||||
}
|
||||
}
|
||||
43
plugins/schemaorg/event/event.xml
Executable file
43
plugins/schemaorg/event/event.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_event</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_EVENT_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\Event</namespace>
|
||||
<files>
|
||||
<folder plugin="event">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_event.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_event.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>
|
||||
271
plugins/schemaorg/event/forms/schemaorg.xml
Executable file
271
plugins/schemaorg/event/forms/schemaorg.xml
Executable file
@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="Event"
|
||||
type="subform"
|
||||
showon="schemaType:Event"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Event"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteEvent"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_EVENT_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="media"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_IMAGE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_NAME_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="description"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_DESCRIPTION_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="aggregateRating"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_AGGREGATE_RATING_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="AggregateRating"
|
||||
/>
|
||||
<field
|
||||
name="ratingValue"
|
||||
type="number"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_RATING_VALUE_LABEL"
|
||||
max="5"
|
||||
/>
|
||||
<field
|
||||
name="reviewCount"
|
||||
type="number"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_REVIEW_COUNT_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="startDate"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_START_DATE_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="location"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_LOCATION_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Place"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_LOCATION_NAME_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="organizer"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_ORGANIZER_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_TYPE_LABEL"
|
||||
default="person"
|
||||
>
|
||||
<option value="person">PLG_SCHEMAORG_EVENT_FIELD_PERSON_LABEL</option>
|
||||
<option value="organization">PLG_SCHEMAORG_EVENT_FIELD_ORGANIZATION_LABEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_ORGANIZER_NAME_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="url"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_URL_LABEL"
|
||||
filter="url"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="logo"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_LOGO_LABEL"
|
||||
showon="@type:organization"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="ImageObject"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="media"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_URL_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="email"
|
||||
type="email"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_EMAIL_LABEL"
|
||||
validate="email"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_GENERIC_TITLE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_EVENT_FIELD_GENERIC_VALUE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
48
plugins/schemaorg/event/services/provider.php
Normal file
48
plugins/schemaorg/event/services/provider.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.event
|
||||
*
|
||||
* @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\Event\Extension\Event;
|
||||
|
||||
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 Event(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'event')
|
||||
);
|
||||
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
98
plugins/schemaorg/event/src/Extension/Event.php
Executable file
98
plugins/schemaorg/event/src/Extension/Event.php
Executable file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.event
|
||||
*
|
||||
* @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\Event\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 Event 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 = 'Event';
|
||||
|
||||
/**
|
||||
* 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 Event 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'] !== 'Event') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($entry['startDate'])) {
|
||||
$entry['startDate'] = $this->prepareDate($entry['startDate']);
|
||||
}
|
||||
|
||||
if (!empty($entry['image'])) {
|
||||
$entry['image'] = $this->prepareImage($entry['image']);
|
||||
}
|
||||
}
|
||||
|
||||
$schema->set('@graph', $graph);
|
||||
}
|
||||
}
|
||||
441
plugins/schemaorg/jobposting/forms/schemaorg.xml
Executable file
441
plugins/schemaorg/jobposting/forms/schemaorg.xml
Executable file
@ -0,0 +1,441 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="JobPosting"
|
||||
type="subform"
|
||||
showon="schemaType:JobPosting"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="JobPosting"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteJobPost"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_JOBPOSTING_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="title"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_TITLE_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="description"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_DESCRIPTION_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="identifier"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_IDENTIFIER_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PropertyValue"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_NAME_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="value"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_VALUE_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<field
|
||||
name="datePosted"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_DATEPOSTED_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="validThrough"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_VALIDTHROUGH_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="jobLocationType"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBLOCATIONTYPE_LABEL"
|
||||
default="0"
|
||||
>
|
||||
<option value=""></option>
|
||||
<option value="Telecommute">PLG_SCHEMAORG_JOBPOSTING_FIELD_TELECOMMUTE_LABEL</option>
|
||||
<option value="Onsite">PLG_SCHEMAORG_JOBPOSTING_FIELD_ONSITE_LABEL</option>
|
||||
<option value="Hybrid">PLG_SCHEMAORG_JOBPOSTING_FIELD_HYBRID_LABEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="applicantLocationRequirements"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_APPLICANT_LOCATION_REQUIREMENT_LABEL"
|
||||
showon="jobLocationType:Telecommute"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Country"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_APPLICANT_LOCATION_REQUIREMENT_COUNTRY_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="employmentType"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_EMPLOYMENTTYPE_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="jobStartDate"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBSTARTDATE_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBSTARTDATE_TYPE_LABEL"
|
||||
default="text"
|
||||
>
|
||||
<option value="text">PLG_SCHEMAORG_JOBPOSTING_FIELD_TEXT_LABEL</option>
|
||||
<option value="Date">PLG_SCHEMAORG_JOBPOSTING_FIELD_DATE_LABEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="value"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBSTARTDATE_DATE_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
showon="@type:Date"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="text"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBSTARTDATE_TEXT_LABEL"
|
||||
filter="string"
|
||||
hint="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBSTARTDATE_TEXT_HINT"
|
||||
showon="@type:text"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<field
|
||||
name="hiringOrganization"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_HIRINGORGANIZATION_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="list"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_HIRINGORGANIZATION_TYPE_LABEL"
|
||||
default="organization"
|
||||
>
|
||||
<option value="person">PLG_SCHEMAORG_JOBPOSTING_FIELD_PERSON_LABEL</option>
|
||||
<option value="organization">PLG_SCHEMAORG_JOBPOSTING_FIELD_ORGANIZATION_LABEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_HIRINGORGANIZATION_NAME_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="url"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_URL_LABEL"
|
||||
filter="url"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="logo"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_IMAGE_LABEL"
|
||||
showon="@type:organization"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="ImageObject"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="media"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_URL_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
<field
|
||||
name="email"
|
||||
type="email"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_EMAIL_LABEL"
|
||||
validate="email"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="jobLocation"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_JOBLOCATION_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Place"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_STREET_ADDRESS_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_LOCALITY_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressRegion"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_ADDRESS_REGION_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_POSTAL_CODE_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressCountry"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_ADDRESS_COUNTRY_LABEL"
|
||||
filter="string"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="baseSalary"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_LABEL"
|
||||
type="subform"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="MonetaryAmount"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="currency"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_CURRENCY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="value"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_SALARY_VALUE_LABEL"
|
||||
>
|
||||
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="QuantitativeValue"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="maxValue"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_MAXVALUE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="minValue"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_MINVALUE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="value"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_VALUE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="unitText"
|
||||
type="list"
|
||||
default="0"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_UNITTEXT_LABEL"
|
||||
>
|
||||
<option value=""></option>
|
||||
<option value="HOUR">PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_UNIT_OPTION_HOUR</option>
|
||||
<option value="DAY">PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_UNIT_OPTION_DAY</option>
|
||||
<option value="WEEK">PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_UNIT_OPTION_WEEK</option>
|
||||
<option value="MONTH">PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_UNIT_OPTION_MONTH</option>
|
||||
<option value="YEAR">PLG_SCHEMAORG_JOBPOSTING_FIELD_BASESALARY_UNIT_OPTION_YEAR</option>
|
||||
</field>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_GENERIC_TITLE_LABEL"
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_JOBPOSTING_FIELD_GENERIC_VALUE_LABEL"
|
||||
/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
43
plugins/schemaorg/jobposting/jobposting.xml
Executable file
43
plugins/schemaorg/jobposting/jobposting.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_jobposting</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_JOBPOSTING_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\JobPosting</namespace>
|
||||
<files>
|
||||
<folder plugin="jobposting">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_jobposting.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_jobposting.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>
|
||||
48
plugins/schemaorg/jobposting/services/provider.php
Normal file
48
plugins/schemaorg/jobposting/services/provider.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.jobposting
|
||||
*
|
||||
* @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\JobPosting\Extension\JobPosting;
|
||||
|
||||
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 JobPosting(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'jobposting')
|
||||
);
|
||||
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
96
plugins/schemaorg/jobposting/src/Extension/JobPosting.php
Executable file
96
plugins/schemaorg/jobposting/src/Extension/JobPosting.php
Executable file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.jobposting
|
||||
*
|
||||
* @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\JobPosting\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\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 JobPosting extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use SchemaorgPluginTrait;
|
||||
use SchemaorgPrepareDateTrait;
|
||||
|
||||
/**
|
||||
* 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 = 'JobPosting';
|
||||
|
||||
/**
|
||||
* 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 JobPosting types
|
||||
*
|
||||
* @param BeforeCompileHeadEvent $event The given event
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function onSchemaBeforeCompileHead(BeforeCompileHeadEvent $event)
|
||||
{
|
||||
$schema = $event->getSchema();
|
||||
|
||||
$graph = $schema->get('@graph');
|
||||
|
||||
foreach ($graph as &$entry) {
|
||||
if (!isset($entry['@type']) || $entry['@type'] !== 'JobPosting') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($entry['datePosted'])) {
|
||||
$entry['datePosted'] = $this->prepareDate($entry['datePosted']);
|
||||
}
|
||||
|
||||
if (!empty($entry['validThrough'])) {
|
||||
$entry['validThrough'] = $this->prepareDate($entry['validThrough']);
|
||||
}
|
||||
}
|
||||
|
||||
$schema->set('@graph', $graph);
|
||||
}
|
||||
}
|
||||
121
plugins/schemaorg/organization/forms/schemaorg.xml
Executable file
121
plugins/schemaorg/organization/forms/schemaorg.xml
Executable file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="Organization"
|
||||
type="subform"
|
||||
showon="schemaType:Organization"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Organization"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteBook"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_ORGANIZATION_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_NAME_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="media"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_LOGO_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="url"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_URL_LABEL"
|
||||
filter="url"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="email"
|
||||
type="email"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_EMAIL_LABEL"
|
||||
validate="email"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_GENERIC_TITLE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_ORGANIZATION_FIELD_GENERIC_VALUE_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
/>
|
||||
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
43
plugins/schemaorg/organization/organization.xml
Executable file
43
plugins/schemaorg/organization/organization.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_organization</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_ORGANIZATION_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\Organization</namespace>
|
||||
<files>
|
||||
<folder plugin="organization">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_organization.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_organization.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>
|
||||
47
plugins/schemaorg/organization/services/provider.php
Normal file
47
plugins/schemaorg/organization/services/provider.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.organization
|
||||
*
|
||||
* @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\Organization\Extension\Organization;
|
||||
|
||||
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 Organization(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'organization')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
45
plugins/schemaorg/organization/src/Extension/Organization.php
Executable file
45
plugins/schemaorg/organization/src/Extension/Organization.php
Executable file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.organization
|
||||
*
|
||||
* @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\Organization\Extension;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Schemaorg\SchemaorgPluginTrait;
|
||||
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 Organization extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use SchemaorgPluginTrait;
|
||||
|
||||
/**
|
||||
* 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 = 'Organization';
|
||||
}
|
||||
113
plugins/schemaorg/person/forms/schemaorg.xml
Executable file
113
plugins/schemaorg/person/forms/schemaorg.xml
Executable file
@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="Person"
|
||||
type="subform"
|
||||
showon="schemaType:Person"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Person"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteBook"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_PERSON_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_NAME_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="url"
|
||||
type="url"
|
||||
filter="url"
|
||||
validate="url"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_URL_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="email"
|
||||
type="email"
|
||||
validate="email"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_EMAIL_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="address"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_ADDRESS_LABEL"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="PostalAddress"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="addressLocality"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_LOCALITY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="postalCode"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_POSTAL_CODE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="streetAddress"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_STREET_ADDRESS_LABEL"
|
||||
/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_GENERIC_TITLE_LABEL"
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_PERSON_FIELD_GENERIC_VALUE_LABEL"
|
||||
/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
43
plugins/schemaorg/person/person.xml
Executable file
43
plugins/schemaorg/person/person.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_person</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_PERSON_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\Person</namespace>
|
||||
<files>
|
||||
<folder plugin="person">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_person.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_person.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>
|
||||
48
plugins/schemaorg/person/services/provider.php
Normal file
48
plugins/schemaorg/person/services/provider.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.person
|
||||
*
|
||||
* @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\Person\Extension\Person;
|
||||
|
||||
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 Person(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'person')
|
||||
);
|
||||
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
45
plugins/schemaorg/person/src/Extension/Person.php
Executable file
45
plugins/schemaorg/person/src/Extension/Person.php
Executable file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.person
|
||||
*
|
||||
* @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\Person\Extension;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Schemaorg\SchemaorgPluginTrait;
|
||||
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 Person extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use SchemaorgPluginTrait;
|
||||
|
||||
/**
|
||||
* 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 = 'Person';
|
||||
}
|
||||
15
plugins/schemaorg/recipe/forms/duration.xml
Executable file
15
plugins/schemaorg/recipe/forms/duration.xml
Executable file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<field
|
||||
name="hour"
|
||||
type="number"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_HOUR_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="min"
|
||||
type="number"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_MINUTE_LABEL"
|
||||
max="59"
|
||||
/>
|
||||
</form>
|
||||
276
plugins/schemaorg/recipe/forms/schemaorg.xml
Executable file
276
plugins/schemaorg/recipe/forms/schemaorg.xml
Executable file
@ -0,0 +1,276 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="schema">
|
||||
<fieldset
|
||||
name="schema"
|
||||
label="PLG_SYSTEM_SCHEMA_FIELD_SCHEMA_LABEL"
|
||||
>
|
||||
<field
|
||||
name="Recipe"
|
||||
type="subform"
|
||||
showon="schemaType:Recipe"
|
||||
>
|
||||
<form>
|
||||
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="Recipe"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="noteBook"
|
||||
type="note"
|
||||
description="PLG_SCHEMAORG_RECIPE_DESCRIPTION_LABEL"
|
||||
class="alert alert-info w-100"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="media"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_IMAGE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_NAME_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author"
|
||||
type="text"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_AUTHOR_LABEL"
|
||||
filter="string"
|
||||
size="30"
|
||||
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cookTime"
|
||||
type="subform"
|
||||
formsource="plugins\schemaorg\recipe\forms\duration.xml"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_COOK_TIME_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="datePublished"
|
||||
type="calendar"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_DATE_PUBLISHED_LABEL"
|
||||
class="input-small"
|
||||
filter="user_utc"
|
||||
showtime="false"
|
||||
todaybutton="true"
|
||||
translateformat="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="description"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_DESCRIPTION_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cookingMethod"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_COOKING_METHOD_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="prepTime"
|
||||
type="subform"
|
||||
formsource="plugins\schemaorg\recipe\forms\duration.xml"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_PREPARATION_TIME_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="recipeCategory"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_CATEGORY_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="recipeCuisine"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_CUISINE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="recipeInstructions"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_INSTRUCTIONS_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="recipeYield"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_YIELD_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="suitableForDiet"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_SUITABLE_FOR_DIET_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="recipeIngredient"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_INGREDIENTS_LABEL"
|
||||
multiple="true"
|
||||
min="1"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="ingredient"
|
||||
type="text"
|
||||
hiddenLabel="true"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="nutrition"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_NUTRITION_LABEL"
|
||||
>
|
||||
|
||||
<form>
|
||||
<field
|
||||
name="@type"
|
||||
type="hidden"
|
||||
default="NutritionInformation"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="calories"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_CALORIES_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="carbohydrateContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_CARBOHYDRATE_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cholesterolContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_CHOLESTEROL_CONTENT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="fatContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_FAT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="fiberContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_FIBER_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="proteinContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_PROTEIN_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="saturatedFatContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_SATURATED_FAT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="sodiumContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_SODIUM_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="sugarContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_SUGAR_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="transFatContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_TRANS_FAT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="unsaturatedFatContent"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_UNSATURATED_FAT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="servingSize"
|
||||
type="text"
|
||||
filter="string"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_SERVING_SIZE_LABEL"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="genericField"
|
||||
type="subform"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_GENERIC_FIELD_LABEL"
|
||||
multiple="true"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="genericTitle"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_GENERIC_TITLE_LABEL"
|
||||
/>
|
||||
<field
|
||||
name="genericValue"
|
||||
type="text"
|
||||
filter="string"
|
||||
size="30"
|
||||
label="PLG_SCHEMAORG_RECIPE_FIELD_GENERIC_VALUE_LABEL"
|
||||
/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
43
plugins/schemaorg/recipe/recipe.xml
Executable file
43
plugins/schemaorg/recipe/recipe.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="schemaorg" method="upgrade">
|
||||
<name>plg_schemaorg_recipe</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_RECIPE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Schemaorg\Recipe</namespace>
|
||||
<files>
|
||||
<folder plugin="recipe">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_recipe.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_schemaorg_recipe.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>
|
||||
48
plugins/schemaorg/recipe/services/provider.php
Normal file
48
plugins/schemaorg/recipe/services/provider.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.recipe
|
||||
*
|
||||
* @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\Recipe\Extension\Recipe;
|
||||
|
||||
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 Recipe(
|
||||
$dispatcher,
|
||||
(array) PluginHelper::getPlugin('schemaorg', 'recipe')
|
||||
);
|
||||
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
121
plugins/schemaorg/recipe/src/Extension/Recipe.php
Executable file
121
plugins/schemaorg/recipe/src/Extension/Recipe.php
Executable file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Schemaorg.recipe
|
||||
*
|
||||
* @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\Recipe\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\SchemaorgPrepareDurationTrait;
|
||||
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 Recipe extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
use SchemaorgPluginTrait;
|
||||
use SchemaorgPrepareDateTrait;
|
||||
use SchemaorgPrepareDurationTrait;
|
||||
|
||||
/**
|
||||
* 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 = 'Recipe';
|
||||
|
||||
/**
|
||||
* 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 Recipe types
|
||||
*
|
||||
* @param BeforeCompileHeadEvent $event The given event
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function onSchemaBeforeCompileHead(BeforeCompileHeadEvent $event)
|
||||
{
|
||||
$schema = $event->getSchema();
|
||||
|
||||
$graph = $schema->get('@graph');
|
||||
|
||||
foreach ($graph as &$entry) {
|
||||
if (!isset($entry['@type']) || $entry['@type'] !== 'Recipe') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($entry['datePublished'])) {
|
||||
$entry['datePublished'] = $this->prepareDate($entry['datePublished']);
|
||||
}
|
||||
|
||||
if (!empty($entry['cookTime'])) {
|
||||
$entry['cookTime'] = $this->prepareDuration($entry['cookTime']);
|
||||
}
|
||||
|
||||
if (!empty($entry['prepTime'])) {
|
||||
$entry['prepTime'] = $this->prepareDuration($entry['prepTime']);
|
||||
}
|
||||
|
||||
// Clean recipeIngredient
|
||||
if (isset($entry['recipeIngredient']) && \is_array($entry['recipeIngredient'])) {
|
||||
$result = [];
|
||||
|
||||
foreach ($entry['recipeIngredient'] as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
foreach ($value as $k => $v) {
|
||||
$result[] = $v;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[] = $value;
|
||||
}
|
||||
|
||||
$entry['recipeIngredient'] = !empty($result) ? $result : null;
|
||||
}
|
||||
}
|
||||
|
||||
$schema->set('@graph', $graph);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user