refactor: Kern ohne Divi – Ports BuilderDetector, MediaUsageSource, EnvironmentComponent und ausgeschlossene Post-Typen im ContentSchema; Divi-Implementierungen und Verdrahtung über DiviIntegration/Plugin; CoreIndependenceTest
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
abeb4b0eed
commit
06148fb8c1
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Integrations\Divi;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use LIT\MCP\Integrations\Media\AttachmentFile;
|
||||
use LIT\MCP\Integrations\Media\ContentMediaReferences;
|
||||
use LIT\MCP\Integrations\Media\MediaUsageFinder;
|
||||
use LIT\MCP\Integrations\Media\MediaUsageSource;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* The logo in Divi's theme options as a usage of an attachment: "possible", because only the file URL is stored
|
||||
* (it may belong to another copy of the file); none without a file or a logo.
|
||||
*/
|
||||
final class DiviLogoUsage implements MediaUsageSource
|
||||
{
|
||||
public function usagesOf(int $attachmentId): array
|
||||
{
|
||||
$stem = AttachmentFile::stem($attachmentId);
|
||||
$logo = DesignSystemReader::diviLogo();
|
||||
if ($stem === '' || $logo === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (ContentMediaReferences::matches(ContentMediaReferences::fileRegex($stem), $logo) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [MediaUsageFinder::siteUsage('Divi-Logo', 'option', 'divi_logo', MediaUsageFinder::POSSIBLE)];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user