PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Setting / ComponentFactory / CommentDisplay.php
codepress-admin-columns / classes / Setting / ComponentFactory Last commit date
DateFormat 3 days ago FieldTypeConfigurator 3 days ago Media 3 days ago Post 3 days ago Pro 3 days ago ActionIcons.php 3 days ago AttachmentDisplay.php 3 days ago BaseComponentFactory.php 3 days ago BeforeAfter.php 3 days ago BooleanValues.php 3 days ago CharacterLimit.php 3 days ago ColumnInfo.php 3 days ago CommentDisplay.php 3 days ago CommentLink.php 3 days ago CommentStatus.php 3 days ago CustomField.php 3 days ago CustomFieldFactory.php 3 days ago DateFormat.php 3 days ago DateSaveFormat.php 3 days ago ExifData.php 3 days ago FieldType.php 3 days ago FieldTypeFactory.php 3 days ago FieldTypeFactoryBuilder.php 3 days ago FileDisplay.php 3 days ago FileLink.php 3 days ago FilePreviewSize.php 3 days ago HiddenInput.php 3 days ago HiddenLabel.php 3 days ago ImageSize.php 3 days ago ImageSizeBase.php 3 days ago IncludeMissingSizes.php 3 days ago InputNameAware.php 3 days ago IsLink.php 3 days ago IsLinkable.php 3 days ago IsMultiple.php 3 days ago Label.php 3 days ago LinkLabel.php 3 days ago LinkToMenu.php 3 days ago LinkablePostProperty.php 3 days ago MediaLink.php 3 days ago Message.php 3 days ago ModalDisplay.php 3 days ago Name.php 3 days ago NumberFormat.php 3 days ago NumberOfItems.php 3 days ago Password.php 3 days ago PathScope.php 3 days ago PostExtendedProperty.php 3 days ago PostLink.php 3 days ago PostProperty.php 3 days ago PostStatus.php 3 days ago PostStatusIcon.php 3 days ago PostType.php 3 days ago PostTypeFactory.php 3 days ago RelatedUserMetaField.php 3 days ago SelectOptions.php 3 days ago Separator.php 3 days ago SerializedArrayKeys.php 3 days ago SerializedDisplay.php 3 days ago StringLimit.php 3 days ago Taxonomy.php 3 days ago TaxonomyFactory.php 3 days ago TermLink.php 3 days ago TermProperty.php 3 days ago UseIcon.php 3 days ago UserLink.php 3 days ago UserLinkFactory.php 3 days ago UserProperty.php 3 days ago VideoDisplay.php 3 days ago Width.php 3 days ago WordLimit.php 3 days ago WordsPerMinute.php 3 days ago
CommentDisplay.php
102 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC\Setting\ComponentFactory;
6
7 use AC;
8 use AC\Expression\StringComparisonSpecification;
9 use AC\FormatterCollection;
10 use AC\Setting\Children;
11 use AC\Setting\ComponentCollection;
12 use AC\Setting\Config;
13 use AC\Setting\Control\Input;
14 use AC\Setting\Control\Input\OptionFactory;
15 use AC\Setting\Control\OptionCollection;
16
17 final class CommentDisplay extends BaseComponentFactory
18 {
19 public const PROPERTY_COMMENT = 'comment';
20 public const PROPERTY_DATE = 'date';
21 public const PROPERTY_ID = 'id';
22 public const PROPERTY_AUTHOR = 'author';
23 public const PROPERTY_AUTHOR_EMAIL = 'author_email';
24
25 private StringLimit $string_limit;
26
27 private CommentLink $comment_link;
28
29 private UserProperty $user_display;
30
31 public function __construct(
32 StringLimit $string_limit,
33 CommentLink $comment_link,
34 UserProperty $user_display
35 ) {
36 $this->string_limit = $string_limit;
37 $this->comment_link = $comment_link;
38 $this->user_display = $user_display;
39 }
40
41 protected function get_label(Config $config): ?string
42 {
43 return __('Comment Display', 'codepress-admin-columns');
44 }
45
46 protected function get_input(Config $config): ?Input
47 {
48 return OptionFactory::create_select(
49 'comment',
50 OptionCollection::from_array([
51 self::PROPERTY_COMMENT => __('Comment'),
52 self::PROPERTY_ID => __('ID'),
53 self::PROPERTY_AUTHOR => __('Author'),
54 self::PROPERTY_AUTHOR_EMAIL => __('Author Email', 'codepress-admin-column'),
55 self::PROPERTY_DATE => __('Date'),
56 ]),
57 $config->get('comment', self::PROPERTY_COMMENT)
58 );
59 }
60
61 protected function get_children(Config $config): ?Children
62 {
63 return new Children(
64 new ComponentCollection([
65 $this->string_limit->create(
66 $config,
67 StringComparisonSpecification::equal(self::PROPERTY_COMMENT)
68 ),
69 $this->comment_link->create(
70 $config,
71 StringComparisonSpecification::equal(self::PROPERTY_COMMENT)
72 ),
73 $this->user_display->create(
74 $config,
75 StringComparisonSpecification::equal(self::PROPERTY_AUTHOR)
76 ),
77 ])
78 );
79 }
80
81 protected function add_formatters(Config $config, FormatterCollection $formatters): void
82 {
83 switch ($config->get('comment')) {
84 case self::PROPERTY_DATE:
85 $formatters->add(new AC\Formatter\Comment\Property('comment_date'));
86 break;
87 case self::PROPERTY_AUTHOR:
88 $formatters->add(new AC\Formatter\Comment\Property('comment_author'));
89 break;
90 case self::PROPERTY_AUTHOR_EMAIL:
91 $formatters->add(new AC\Formatter\Comment\Property('comment_author_email'));
92 break;
93 case self::PROPERTY_ID:
94 break;
95 default:
96 $formatters->add(new AC\Formatter\Comment\Content());
97 $formatters->add(new AC\Formatter\StringSanitizer());
98 }
99 }
100
101 }
102