"Generic"
/**
* Default user group on register.
*/
const OPTION_REGISTER_DEFAULT_GROUP = 'option_register_default_group';
/**
* Interval, expressed in seconds per which check new comments.
* When OPTION_NOTIFY_ON_NEW_COMMENT is not enabled, this constant not used.
*/
const OPTION_INTERVAL_COMMENTS_CHECK = 'option_interval_comment_check';
/**
* General
*/
const OPTION_READ_MORE_TOGGLE = 'option_read_more_toggle'; // Ability to toggle read more.
const OPTION_RATING_TOGGLE = 'option_rating_toggle'; // Display page rating.
const OPTION_COUNT_PER_PAGE = 'option_comments_count_per_page'; // Number of comments displayed per page and on the page load.
const OPTION_COMMENT_UPDATE_TIME = 'option_comment_update_time'; // Comment update time.
const OPTION_USER_AGREEMENT_LINK = 'option_comments_user_agreement_link'; // Link to the user agreement.
const OPTION_LOAD_ON_SCROLL = 'options_load_on_scroll'; // Load comments on scroll to it.
const OPTION_MODERATE_FIRST = 'options_moderate_first'; // Mark comments for moderation before they are added.
const OPTION_MODERATE_WORDS = 'options_moderate_words'; // List of words to mark comments as spam.
const OPTION_LINKS_ON_HOLD = 'options_links_on_hold'; // Put comments with links on hold.
const OPTION_SHOW_SOCIALS_IN_LOGIN_PAGE = 'options_show_socials_in_login_page'; // Show/hide list of available socials in WordPress's native login form.
const OPTION_SHOW_ADMIN_BAR = 'options_show_admin_bar'; // Show/hide admin bar for authorized users (users with manage_options would be able to see it).
const OPTION_SHOW_PROFILE_URL = 'options_show_profile_url'; // Show/hide profile URL on client mini social icon.
const OPTION_SHOW_TWITTER_EMBEDS = 'options_show_tweet_attachments'; // Show tweet (from Twitter) attachments
const OPTION_SHOW_VIDEO_ATTACHMENTS = 'options_show_video_attachments'; // Show/hide video attachments.
const OPTION_SHOW_IMAGE_ATTACHMENTS = 'options_show_image_attachments'; // Show/hide image attachments.
const OPTION_MAKE_LINKS_CLICKABLE = 'options_make_links_clickable'; // Whether required to make links clickable.
const OPTION_COPYRIGHT_TOGGLE = 'option_copyright_toggle'; // Show/hide copyright.
/**
* File upload
*/
const OPTION_FILES_TOGGLE = 'options_files_toggle';
const OPTION_FILES_GUEST_CAN_UPLOAD = 'options_files_guest_can_upload';
const OPTION_FILES_MIME_TYPES = 'options_files_mime_types';
const OPTION_FILES_LIMIT = 'options_files_limit';
const OPTION_FILES_LIMIT_PERIOD = 'options_files_limit_period';
const OPTION_FILES_MAX_SIZE = 'options_files_max_size';
/**
* Design
*/
const OPTION_FORM_TYPE = 'options_form_type'; // Define form type: only guest users, only social networks or both of it.
const FORM_OPTION_GUEST_ONLY = 'form_option_guest_only'; // Option to enable comments only from guest.
const FORM_OPTION_WORDPRESS_ONLY = 'form_option_wordpress_only'; // Option to allow comments from users who authorized using social.
const FORM_OPTION_SOCIALS_ONLY = 'form_option_socials_only'; // Option to allow comments from users who authorized using social.
const FORM_OPTION_ALL = 'form_option_all'; // Option to allow both: guest & social login.
/**
* Define what fields to show and order.
*/
const OPTION_GUEST_FIELDS = 'options_guest_fields';
/**
* Custom design options.
*/
const OPTION_DESIGN_CUSTOM_TOGGLE = 'options_design_custom_toggle';
const OPTION_DESIGN_GLOBAL_PADDING = 'options_design_global_padding';
const OPTION_DESIGN_GLOBAL_MARGIN = 'options_design_global_margin';
const OPTION_DESIGN_GLOBAL_BACKGROUND_BORDER_RADIUS = 'options_design_global_background_border_radius';
const OPTION_DESIGN_GLOBAL_BACKGROUND_COLOR = 'options_design_global_background_color';
const OPTION_DESIGN_FONT_SIZE = 'options_design_font_size';
const OPTION_DESIGN_FONT_FAMILY = 'options_design_font_family';
const OPTION_DESIGN_SEMI_HIDDEN_COLOR = 'options_design_semi_hidden_color';
const OPTION_DESIGN_LINK_COLOR = 'options_design_link_color';
const OPTION_DESIGN_TEXT_COLOR = 'options_design_text_color';
const OPTION_DESIGN_FORM_FIELD_BACKGROUND_COLOR = 'options_design_form_field_background_color';
const OPTION_DESIGN_ATTACHMENT_COLOR = 'options_design_attachment_color';
const OPTION_DESIGN_ATTACHMENT_BACKGROUND_COLOR = 'options_design_attachment_background_color';
const OPTION_DESIGN_AVATAR_RADIUS = 'options_design_avatar_radius';
const OPTION_DESIGN_PARENT_AVATAR_SIZE = 'options_design_parent_avatar_size';
const OPTION_DESIGN_CHILD_AVATAR_SIZE = 'options_design_child_avatar_size';
const OPTION_DESIGN_BUTTON_COLOR = 'options_design_button_color';
const OPTION_DESIGN_BUTTON_BACKGROUND_COLOR = 'options_design_button_background_color';
const OPTION_DESIGN_BUTTON_BACKGROUND_COLOR_ACTIVE = 'options_design_button_background_color_active';
const OPTION_DESIGN_BUTTON_RADIUS = 'options_design_button_radius';
const OPTION_DESIGN_GLOBAL_RADIUS = 'options_design_global_radius';
/**
* Roles
*/
const DEFAULT_ROLE_SUBSCRIBER = 'subscriber'; // Normal subscriber (from WordPress)
const DEFAULT_ROLE_SOCIAL_SUBSCRIBER = 'social_subscriber'; // Custom social subscriber. Role introduced via this plugin.
/**
* Editor options.
*/
const OPTION_EDITOR_CSS = 'option_editor_css'; // Add custom CSS
/**
* @inheritdoc
*/
protected $option_group = 'anycomment-generic-group';
/**
* @inheritdoc
*/
protected $option_name = 'anycomment-generic';
/**
* @inheritdoc
*/
protected $field_options = [
'wrapper' => '
'
];
/**
* @inheritdoc
*/
protected $section_options = [
'wrapper' => ''
];
/**
* @inheritdoc
*/
protected $default_options = [
self::OPTION_COPYRIGHT_TOGGLE => 'on',
self::OPTION_COMMENT_UPDATE_TIME => 5,
self::OPTION_COUNT_PER_PAGE => 20,
self::OPTION_INTERVAL_COMMENTS_CHECK => 10,
self::OPTION_DEFAULT_SORT_BY => self::SORT_DESC,
self::COMMENT_RATING_LIKES => self::COMMENT_RATING_LIKES,
// Files
self::OPTION_FILES_LIMIT => 5,
self::OPTION_FILES_LIMIT_PERIOD => 900,
self::OPTION_FILES_MAX_SIZE => 1.5,
self::OPTION_FILES_MIME_TYPES => 'image/*, .pdf',
// Notifications
self::OPTION_NOTIFY_REPLY_EMAIL_TEMPLATE => "New reply for you in {blogUrlHtml}.\nFrom post {postUrlHtml}.\n\n{commentFormatted}\n{replyButton}",
self::OPTION_NOTIFY_ADMIN_EMAIL_TEMPLATE => "New comment posted in {blogUrlHtml}.\nFor post {postUrlHtml}.\n\n{commentFormatted}\n{replyButton}",
self::OPTION_NOTIFY_SUBSCRIBERS_EMAIL_TEMPLATE => "New comment in {blogUrlHtml}.\nFrom post {postUrlHtml}.\n\n{commentFormatted}\n{replyButton}\n\nYou were subscribed to this post.\n\nYou may unbsubscribe by following this link:\n{unsubscribeUrl}",
self::OPTION_NOTIFY_SUBSCRIBERS_CONFIRMATION_EMAIL_TEMPLATE => "You were subscribed to {postUrlHtml} on {postTitle}.\n\nPlease follow link below to confirm this action or ignore this message if you think you received this by mistake.\n\n{confirmatiomButton}\n\nOr use link below:\n{confirmationUrl}",
// Other design
self::OPTION_FORM_TYPE => self::FORM_OPTION_SOCIALS_ONLY,
self::OPTION_GUEST_FIELDS => '{name} {email} {website}',
// Editor
self::OPTION_EDITOR_TOOLBAR_TOGGLE => 'on',
self::OPTION_EDITOR_TOOLBAR_BOLD => 'on',
self::OPTION_EDITOR_TOOLBAR_ITALIC => 'on',
self::OPTION_EDITOR_TOOLBAR_UNDERLINE => 'on',
self::OPTION_EDITOR_TOOLBAR_QUOTE => 'on',
self::OPTION_EDITOR_TOOLBAR_ORDERED => 'on',
self::OPTION_EDITOR_TOOLBAR_BULLET => 'on',
self::OPTION_EDITOR_TOOLBAR_LINK => 'on',
self::OPTION_EDITOR_TOOLBAR_CLEAN => 'on',
// Custom design
self::OPTION_DESIGN_GLOBAL_PADDING => '0',
self::OPTION_DESIGN_GLOBAL_MARGIN => '20px 0',
self::OPTION_DESIGN_GLOBAL_BACKGROUND_BORDER_RADIUS => '0',
self::OPTION_DESIGN_FONT_SIZE => '14px',
self::OPTION_DESIGN_FONT_FAMILY => "'Noto-Sans', sans-serif",
self::OPTION_DESIGN_SEMI_HIDDEN_COLOR => '#B6C1C6',
self::OPTION_DESIGN_LINK_COLOR => '#1DA1F2',
self::OPTION_DESIGN_TEXT_COLOR => '#2A2E2E',
self::OPTION_DESIGN_FORM_FIELD_BACKGROUND_COLOR => '#ffffff',
self::OPTION_DESIGN_ATTACHMENT_COLOR => '#eeeeee',
self::OPTION_DESIGN_ATTACHMENT_BACKGROUND_COLOR => '#eeeeee',
self::OPTION_DESIGN_AVATAR_RADIUS => '50% 50% 50% 0',
self::OPTION_DESIGN_PARENT_AVATAR_SIZE => '48px',
self::OPTION_DESIGN_CHILD_AVATAR_SIZE => '30px',
self::OPTION_DESIGN_BUTTON_COLOR => '#ffffff',
self::OPTION_DESIGN_BUTTON_BACKGROUND_COLOR => '#1DA1F2',
self::OPTION_DESIGN_BUTTON_BACKGROUND_COLOR_ACTIVE => '#4f9f49',
self::OPTION_DESIGN_BUTTON_RADIUS => '20px',
self::OPTION_DESIGN_GLOBAL_RADIUS => '10px',
];
/**
* @inheritdoc
*/
protected $page_slug = 'anycomment-settings';
/**
* AnyCommentAdminPages constructor.
*
* @param bool $init if required to init the modle.
*/
public function __construct( $init = true ) {
parent::__construct();
if ( $init ) {
$this->init_hooks();
}
}
/**
* Initiate hooks.
*/
private function init_hooks() {
add_action( 'admin_init', [ $this, 'init_settings' ] );
// Create role
add_role(
AnyCommentGenericSettings::DEFAULT_ROLE_SOCIAL_SUBSCRIBER,
__( 'Social Network Subscriber', 'anycomment' ),
[
'read' => true,
'edit_posts' => false,
'delete_posts' => false,
]
);
}
/**
* {@inheritdoc}
*/
public function init_settings() {
$form = $this->form();
$form->add_section(
$this->section_builder()
->set_id( 'generic' )
->set_title( __( 'Generic', "anycomment" ) )
->set_wrapper( '' )
->set_fields( [
$this->field_builder()
->checkbox()
->set_id( self::OPTION_PLUGIN_TOGGLE )
->set_title( __( 'Enable Comments', "anycomment" ) )
->set_description( esc_html( __( 'When on, comments are visible. When off, default WordPress\' comments shown. This can be used to configure social networks on fresh installation.', "anycomment" ) ) ),
$this->field_builder()
->set_id( self::OPTION_DEFAULT_SORT_BY )
->select()
->set_args( [
'options' => [
self::SORT_DESC => __( 'Newest first', 'anycomment' ),
self::SORT_ASC => __( 'Oldest first', 'anycomment' ),
]
] )
->set_description( esc_html( __( 'Default sorting.', "anycomment" ) ) ),
$this->field_builder()
->set_id( self::OPTION_COMMENT_RATING )
->select()
->set_title( __( 'Comment rating', "anycomment" ) )
->set_args( [
'options' => [
self::COMMENT_RATING_LIKES => __( 'Likes only', 'anycomment' ),
self::COMMENT_RATING_LIKES_DISLIKES => __( 'Likes and dislikes', 'anycomment' ),
]
] )
->set_description( esc_html( __( 'Type of rating used for single comment. Option "Likes" would display only heart like, whereas "Likes and dislikes" would display up and down options.', "anycomment" ) ) ),
$this->field_builder()
->set_id( self::OPTION_DEFAULT_AVATAR )
->select()
->set_title( __( 'Default Avatar', "anycomment" ) )
->set_args( [
'options' => [
self::OPTION_DEFAULT_AVATAR_ANYCOMMENT => __( 'No avatar (from AnyComment)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_MP => __( 'No avatar (from Gravatar)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_IDENTICON => __( 'Identicon (from Gravatar)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_MONSTEROID => __( 'Monsteroid (from Gravatar)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_WAVATAR => __( 'Wavatar (from Gravatar)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_RETRO => __( 'Retro (from Gravatar)', 'anycomment' ),
self::OPTION_DEFAULT_AVATAR_ROBOHASH => __( 'Robohash (from Gravatar)', 'anycomment' ),
]
] )
->set_description( esc_html( __( 'Default avatar when user does not have any.', "anycomment" ) ) ),
$this->field_builder()
->set_id( self::OPTION_REGISTER_DEFAULT_GROUP )
->select()
->set_title( __( 'Register User Group', "anycomment" ) )
->set_args( [
'options' => [
self::DEFAULT_ROLE_SUBSCRIBER => __( 'Subscriber', 'anycomment' ),
self::DEFAULT_ROLE_SOCIAL_SUBSCRIBER => __( 'Social Network Subscriber', 'anycomment' ),
]
] )
->set_description( esc_html( __( 'When users will authorize via plugin, they are being registered and be assigned with group selected above.', "anycomment" ) ) ),
$this->field_builder()
->set_id( self::OPTION_COMMENT_DATETIME_FORMAT )
->select()
->set_title( __( 'Date & Time Format', "anycomment" ) )
->set_args( [
'options' => [
self::DATETIME_FORMAT_RELATIVE => __( 'Relative (e.g. 1 minute ago)', 'anycomment' ),
self::DATETIME_FORMAT_NATIVE => __( 'Absolute (format taken from WordPress)', 'anycomment' ),
]
] )
->set_description( esc_html( __( 'Choose comment date & time format.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_COMMENT_UPDATE_TIME )
->set_title( __( 'Comment Update Time', "anycomment" ) )
->set_description( esc_html( __( 'Number of minutes user can update his comment. "0" or empty for no limit.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_COUNT_PER_PAGE )
->set_title( __( 'Number of Comments Loaded', "anycomment" ) )
->set_description( esc_html( __( 'Number of comments to load initially and per page.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_LOAD_ON_SCROLL )
->set_title( __( 'Load on Scroll', "anycomment" ) )
->set_description( esc_html( __( 'Load comments when user scrolls to it.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_SOCIALS_IN_LOGIN_PAGE )
->set_title( __( 'Show Login Page Socials', "anycomment" ) )
->set_description( esc_html( __( 'Show list of available socials under WordPress\'s native login form.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_ADMIN_BAR )
->set_title( __( 'Show Admin Bar', "anycomment" ) )
->set_description( esc_html( __( 'Show admin bar for regular WordPress users and those who logged in via social.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_PROFILE_URL )
->set_title( __( 'Show Profile URL', "anycomment" ) )
->set_description( esc_html( __( 'Show link to user in the social media or website when available (name of the user will be clickable).', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_TWITTER_EMBEDS )
->set_title( __( 'Display Twitter Embeds', "anycomment" ) )
->set_description( esc_html( __( 'Detect & display tweets from Twitter as embedded widget.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_VIDEO_ATTACHMENTS )
->set_title( __( 'Display Video Attachments', "anycomment" ) )
->set_description( esc_html( __( 'Display video link from comment as attachment.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_SHOW_IMAGE_ATTACHMENTS )
->set_title( __( 'Display Image Attachments', "anycomment" ) )
->set_description( esc_html( __( 'Display image link from comment as attachment.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_RATING_TOGGLE )
->set_title( __( 'Display Rating', "anycomment" ) )
->set_description( esc_html( __( 'Display 5 star rating above comments.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_READ_MORE_TOGGLE )
->set_title( __( 'Shorten Long Comments', "anycomment" ) )
->set_description( esc_html( __( 'Shorten long comments with "Read more" message.', "anycomment" ) ) ),
// $this->field_builder()
// ->input_checkbox()
// ->set_id(self::OPTION_MAKE_LINKS_CLICKABLE)
// ->set_title(__( 'Links Clickable', "anycomment" ))
// ->set_description(esc_html( __( 'Links in comment are clickable.', "anycomment" ) )),
$this->field_builder()
->text()
->set_id( self::OPTION_USER_AGREEMENT_LINK )
->set_title( __( 'User Agreement Link', "anycomment" ) )
->set_description( esc_html( __( 'Link to User Agreement, where described how your process users data once they authorize via social network and/or add new comment.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_COPYRIGHT_TOGGLE )
->set_title( __( 'Thanks', "anycomment" ) )
->set_description( esc_html( __( 'Show AnyComment\'s link in the footer of comments. Copyright helps to bring awareness of such plugin and bring people to allow us to understand that it is a wanted product and give more often updated.', "anycomment" ) ) ),
] )
);
/**
* Section: Elements
*/
$form->add_section(
$this->section_builder()
->set_id( 'elements' )
->set_title( __( 'Elements', "anycomment" ) )
->set_fields( [
$this->field_builder()
->select()
->set_id( self::OPTION_FORM_TYPE )
->set_title( __( 'Comment form', "anycomment" ) )
->set_args( [
'options' => [
self::FORM_OPTION_ALL => __( 'Anyone', 'anycomment' ),
self::FORM_OPTION_WORDPRESS_ONLY => __( 'WordPress only', 'anycomment' ),
self::FORM_OPTION_SOCIALS_ONLY => __( 'Socials only', 'anycomment' ),
self::FORM_OPTION_GUEST_ONLY => __( 'Guests only', 'anycomment' ),
],
] )
->set_description( esc_html( __( 'Users who able to leave comments.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_GUEST_FIELDS )
->set_title( __( 'Guest Fields', "anycomment" ) )
->set_description( esc_html( __( 'Use this rearrange guest form fields or remove something. {name} is required and if you do not add it, it will be added by plugin. {name} is name field, {email} is email field, {website} is website field.', "anycomment" ) ) ),
/**
* Editor options
*/
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_TOGGLE )
->set_title( __( 'Enable Toolbar', "anycomment" ) )
->set_description( esc_html( __( 'Enable editor toolbar (show options to modify comment text - bold, italics, etc).', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_BOLD )
->set_title( __( 'Bold', "anycomment" ) )
->set_description( esc_html( __( 'Show bold option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_ITALIC )
->set_title( __( 'Italic', "anycomment" ) )
->set_description( esc_html( __( 'Show italic option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_UNDERLINE )
->set_title( __( 'Underline', "anycomment" ) )
->set_description( esc_html( __( 'Show underline option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_QUOTE )
->set_title( __( 'Quote', "anycomment" ) )
->set_description( esc_html( __( 'Show quote option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_ORDERED )
->set_title( __( 'Ordered list', "anycomment" ) )
->set_description( esc_html( __( 'Show ordered list option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_BULLET )
->set_title( __( 'Unordered list', "anycomment" ) )
->set_description( esc_html( __( 'Show unordered list option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_LINK )
->set_title( __( 'Link', "anycomment" ) )
->set_description( esc_html( __( 'Show link option in editor toolbar.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_EDITOR_TOOLBAR_CLEAN )
->set_title( __( 'Clean formatting', "anycomment" ) )
->set_description( esc_html( __( 'Show clean formatting option in editor toolbar.', "anycomment" ) ) ),
] )
);
/**
* Section: Design
*/
$form->add_section(
$this->section_builder()
->set_id( 'design' )
->set_title( __( 'Design', "anycomment" ) )
->set_fields( [
$this->field_builder()
->checkbox()
->set_id( self::OPTION_DESIGN_CUSTOM_TOGGLE )
->set_title( __( 'Custom Design', "anycomment" ) )
->set_description( esc_html( __( 'Use custom design. Enable this option to display design changes from below.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_FONT_SIZE )
->set_title( __( 'Text Size', "anycomment" ) )
->set_description( esc_html( __( 'Overal text size. You may use "px", "pt", "em" or "%".', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_FONT_FAMILY )
->set_title( __( 'Font Choice', "anycomment" ) )
->set_description( esc_html( __( 'Global font family.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_TEXT_COLOR )
->set_title( __( 'Text Color', "anycomment" ) )
->set_description( esc_html( __( 'Global text color.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_LINK_COLOR )
->set_title( __( 'Link Color', "anycomment" ) )
->set_description( esc_html( __( 'Links color.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_GLOBAL_BACKGROUND_COLOR )
->set_title( __( 'Global background color', "anycomment" ) )
->set_description( esc_html( __( 'Global background color used for all comments.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_GLOBAL_BACKGROUND_BORDER_RADIUS )
->set_title( __( 'Global background border radius', "anycomment" ) )
->set_description( esc_html( __( 'Global background border radius. Could be useful when you have background different then website primary color.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_GLOBAL_MARGIN )
->set_title( __( 'Global margin', "anycomment" ) )
->set_description( esc_html( __( 'Global margin for all comments. You may use "px", "em" or "%".', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_GLOBAL_PADDING )
->set_title( __( 'Global padding', "anycomment" ) )
->set_description( esc_html( __( 'Global padding for all comments. You may use "px", "em" or "%".', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_GLOBAL_RADIUS )
->set_title( __( 'Border radius', "anycomment" ) )
->set_description( esc_html( __( 'Border radius. You may use "px", "em" or "%".', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_SEMI_HIDDEN_COLOR )
->set_title( __( 'Semi Hidden Color', "anycomment" ) )
->set_description( esc_html( __( 'Semi hidden color. This is used for dates, action links, etc.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_FORM_FIELD_BACKGROUND_COLOR )
->set_title( __( 'Form Fields Background', "anycomment" ) )
->set_description( esc_html( __( 'Form fields background color.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_ATTACHMENT_COLOR )
->set_title( __( 'Attachment Text Color', "anycomment" ) )
->set_description( esc_html( __( 'Attachments text color. For example, YouTube attachments do not have previews, instead they have "YouTube" text over.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_ATTACHMENT_BACKGROUND_COLOR )
->set_title( __( 'Attachment Background Color', "anycomment" ) )
->set_description( esc_html( __( 'Attachment background color. For example, user may attach PNG image with transparent background. This color will be used as background behind the image.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_AVATAR_RADIUS )
->set_title( __( 'Avatar Border Radius', "anycomment" ) )
->set_description( esc_html( __( 'Avatar border radius. You may use "px" or "%". "50%" will make avatars rounded.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_PARENT_AVATAR_SIZE )
->set_title( __( 'Avatar Parent Size', "anycomment" ) )
->set_description( esc_html( __( 'Parent comment avatar size.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_CHILD_AVATAR_SIZE )
->set_title( __( 'Avatar Child Size', "anycomment" ) )
->set_description( esc_html( __( 'Child comment avatar size. Usually, this is reply comment.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_DESIGN_BUTTON_RADIUS )
->set_title( __( 'Button Radius', "anycomment" ) )
->set_description( esc_html( __( 'Button border radius.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_BUTTON_COLOR )
->set_title( __( 'Button Color', "anycomment" ) )
->set_description( esc_html( __( 'Button text color.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_BUTTON_BACKGROUND_COLOR )
->set_title( __( 'Button Background Color', "anycomment" ) )
->set_description( esc_html( __( 'Button background color.', "anycomment" ) ) ),
$this->field_builder()
->color()
->set_id( self::OPTION_DESIGN_BUTTON_BACKGROUND_COLOR_ACTIVE )
->set_title( __( 'Button Background Color Active', "anycomment" ) )
->set_description( esc_html( __( 'Button background color when hovered or focused.', "anycomment" ) ) ),
] )
);
/**
* Section: Moderation
*/
$form->add_section(
$this->section_builder()
->set_id( 'moderation' )
->set_title( __( 'Moderation', "anycomment" ) )
->set_fields( [
$this->field_builder()
->checkbox()
->set_id( self::OPTION_MODERATE_FIRST )
->set_title( __( 'Moderate First', "anycomment" ) )
->set_description( esc_html( __( 'Moderators should check comment before it appears.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_LINKS_ON_HOLD )
->set_title( __( 'Links on Hold', "anycomment" ) )
->set_description( esc_html( __( 'Comment with links should be marked for moderation.', "anycomment" ) ) ),
$this->field_builder()
->textarea()
->set_id( self::OPTION_MODERATE_WORDS )
->set_title( __( 'Spam Words', "anycomment" ) )
->set_description( esc_html( __( 'Comment should be marked for moderation when matched word from this list of comma-separated values.', "anycomment" ) ) ),
] )
);
/**
* Section: Notifications
*/
$form->add_section(
$this->section_builder()
->set_id( 'notifications' )
->set_title( __( 'Notifications', "anycomment" ) )
->set_fields( [
$this->field_builder()
->text()
->set_id( self::OPTION_NOTIFY_SENDER_NAME )
->set_title( __( 'Sender Name', "anycomment" ) )
->set_description( esc_html( __( 'Send name shown to email recipient. This could be your blog name.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_NOTIFY_ON_NEW_COMMENT )
->set_title( __( 'Real-time updates', "anycomment" ) )
->set_description( esc_html( __( 'Show comments in real-time. Users on the page would be notified about new comments by green alert and see comment without page reload.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_INTERVAL_COMMENTS_CHECK )
->set_title( __( 'New Comment Interval Checking', "anycomment" ) )
->set_description( esc_html( __( 'Interval (in seconds) to check for new comments. Minimum 5 and maximum is 100 seconds.', "anycomment" ) ) ),
// Admin email notifications
$this->field_builder()
->checkbox()
->set_id( self::OPTION_NOTIFY_ADMINISTRATOR )
->set_title( __( 'Notify Administrator', "anycomment" ) )
->set_description( esc_html( __( 'Notify administrator via email about new comment.', "anycomment" ) ) ),
$this->field_builder()
->textarea()
->set_id( self::OPTION_NOTIFY_ADMIN_EMAIL_TEMPLATE )
->set_title( __( 'Admin Email Template', "anycomment" ) )
->set_description( esc_html( __( 'Email template sent to admin about new comment.', "anycomment" ) ) )
->set_after( function () {
$supportedList = [
'{blogName}' => __( 'Blog name as text', 'anycomment' ),
'{blogUrl}' => __( 'Blog link as text', 'anycomment' ),
'{blogUrlHtml}' => __( 'Blog name in HTML link', 'anycomment' ),
'{postTitle}' => __( 'Post title as text', 'anycomment' ),
'{postUrl}' => __( 'Post URL as text', 'anycomment' ),
'{postUrlHtml}' => __( 'Post title in HTML link', 'anycomment' ),
'{commentText}' => __( 'Comment text', 'anycomment' ),
'{commentFormatted}' => __( 'Comment text nicely formatted', 'anycomment' ),
'{replyUrl}' => __( 'Reply link as text', 'anycomment' ),
'{replyButton}' => __( 'Reply link as button', 'anycomment' ),
'{adminModerationUrl}' => __( 'Direct link to admin to see all comments waiting to reviewed', 'anycomment' ),
'{adminEditUrl}' => __( 'Direct link to admin to edit comment', 'anycomment' ),
];
$id = self::OPTION_NOTIFY_ADMIN_EMAIL_TEMPLATE . time();
$html = '' . __( 'More info', 'anycomment' ) . '';
foreach ( $supportedList as $code => $description ) {
$html .= sprintf( "- %s - %s
", $code, $description );
}
$html .= '
';
$html .= '';
return $html;
} ),
// Reply email notifications
$this->field_builder()
->checkbox()
->set_id( self::OPTION_NOTIFY_ON_NEW_REPLY )
->set_title( __( 'Notify on new replies', "anycomment" ) )
->set_description( esc_html( __( 'Notify users by email (if specified) about new replies. Make sure you have proper SMTP configurations in order to send emails.', "anycomment" ) ) ),
$this->field_builder()
->textarea()
->set_id( self::OPTION_NOTIFY_REPLY_EMAIL_TEMPLATE )
->set_title( __( 'Reply Email Template', "anycomment" ) )
->set_description( esc_html( __( 'Email template on new comment reply.', "anycomment" ) ) )
->set_after( function () {
$supportedList = [
'{blogName}' => __( 'Blog name as text', 'anycomment' ),
'{blogUrl}' => __( 'Blog link as text', 'anycomment' ),
'{blogUrlHtml}' => __( 'Blog name in HTML link', 'anycomment' ),
'{postTitle}' => __( 'Post title as text', 'anycomment' ),
'{postUrl}' => __( 'Post URL as text', 'anycomment' ),
'{postUrlHtml}' => __( 'Post title in HTML link', 'anycomment' ),
'{commentText}' => __( 'Comment text', 'anycomment' ),
'{commentFormatted}' => __( 'Comment text nicely formatted', 'anycomment' ),
'{replyUrl}' => __( 'Reply link as text', 'anycomment' ),
'{replyButton}' => __( 'Reply link as button', 'anycomment' ),
];
$id = self::OPTION_NOTIFY_REPLY_EMAIL_TEMPLATE . time();
$html = '' . __( 'More info', 'anycomment' ) . '';
foreach ( $supportedList as $code => $description ) {
$html .= sprintf( "- %s - %s
", $code, $description );
}
$html .= '
';
$html .= '';
return $html;
} ),
// Subscription email notifications
$this->field_builder()
->checkbox()
->set_id( self::OPTION_NOTIFY_SUBSCRIBERS )
->set_title( __( 'Notify Post Subscribers', "anycomment" ) )
->set_description( esc_html( __( 'Show subscription form and notify active post subscribers. Make sure you have proper SMTP configurations in order to send emails.', "anycomment" ) ) ),
$this->field_builder()
->textarea()
->set_id( self::OPTION_NOTIFY_SUBSCRIBERS_EMAIL_TEMPLATE )
->set_title( __( 'Subscription Email Template', "anycomment" ) )
->set_description( esc_html( __( 'Email template for subscriptions.', "anycomment" ) ) )
->set_after( function () {
$supportedList = [
'{blogName}' => __( 'Blog name as text', 'anycomment' ),
'{blogUrl}' => __( 'Blog link as text', 'anycomment' ),
'{blogUrlHtml}' => __( 'Blog name in HTML link', 'anycomment' ),
'{postTitle}' => __( 'Post title as text', 'anycomment' ),
'{postUrl}' => __( 'Post URL as text', 'anycomment' ),
'{unsubscribeUrl}' => __( 'Unsubscribe URL as text', 'anycomment' ),
'{postUrlHtml}' => __( 'Post title in HTML link', 'anycomment' ),
'{commentText}' => __( 'Comment text', 'anycomment' ),
'{commentFormatted}' => __( 'Comment text nicely formatted', 'anycomment' ),
'{replyUrl}' => __( 'Reply link as text', 'anycomment' ),
'{replyButton}' => __( 'Reply link as button', 'anycomment' ),
];
$id = self::OPTION_NOTIFY_SUBSCRIBERS_EMAIL_TEMPLATE . time();
$html = '' . __( 'More info', 'anycomment' ) . '';
foreach ( $supportedList as $code => $description ) {
$html .= sprintf( "- %s - %s
", $code, $description );
}
$html .= '
';
$html .= '';
return $html;
} ),
$this->field_builder()
->textarea()
->set_id( self::OPTION_NOTIFY_SUBSCRIBERS_CONFIRMATION_EMAIL_TEMPLATE )
->set_title( __( 'Subscription Confirmation Email Template', "anycomment" ) )
->set_description( esc_html( __( 'Email template for confirming subscription.', "anycomment" ) ) )
->set_after( function () {
$supportedList = [
'{blogName}' => __( 'Blog name as text', 'anycomment' ),
'{blogUrl}' => __( 'Blog link as text', 'anycomment' ),
'{blogUrlHtml}' => __( 'Blog name in HTML link', 'anycomment' ),
'{postTitle}' => __( 'Post title as text', 'anycomment' ),
'{postUrl}' => __( 'Post URL as text', 'anycomment' ),
'{postUrlHtml}' => __( 'Post title in HTML link', 'anycomment' ),
'{confirmationUrl}' => __( 'Confirmation link as text', 'anycomment' ),
'{confirmationButton}' => __( 'Confirmation link as button', 'anycomment' ),
];
$id = self::OPTION_NOTIFY_SUBSCRIBERS_CONFIRMATION_EMAIL_TEMPLATE . time();
$html = '' . __( 'More info', 'anycomment' ) . '';
foreach ( $supportedList as $code => $description ) {
$html .= sprintf( "- %s - %s
", $code, $description );
}
$html .= '
';
$html .= '';
return $html;
} ),
] )
);
/**
* Section: Files
*/
$form->add_section(
$this->section_builder()
->set_id( 'files' )
->set_title( __( 'Files', "anycomment" ) )
->set_fields( [
$this->field_builder()
->checkbox()
->set_id( self::OPTION_FILES_TOGGLE )
->set_title( __( 'Allow File Uploads', "anycomment" ) )
->set_description( esc_html( __( 'Allow to upload files.', "anycomment" ) ) ),
$this->field_builder()
->checkbox()
->set_id( self::OPTION_FILES_GUEST_CAN_UPLOAD )
->set_title( __( 'File Upload By Guests', "anycomment" ) )
->set_description( esc_html( __( 'Guest users can upload documents. Please be careful about this setting as some users may potentially misuse this and periodically upload unwanted files.', "anycomment" ) ) ),
$this->field_builder()
->text()
->set_id( self::OPTION_FILES_MIME_TYPES )
->set_title( __( 'File MIME Types', "anycomment" ) )
->set_description( esc_html( __( 'Comma-separated list of allowed MIME types (e.g. .png, .jpg, etc). Alternatively, you may write "image/*" for all image types or "audio/*" for audios.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_FILES_LIMIT )
->set_title( __( 'File Upload Limit', "anycomment" ) )
->set_description( esc_html( __( 'Maximum number of files to upload per period defined in the field below.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_FILES_LIMIT_PERIOD )
->set_title( __( 'File Upload Limit Period', "anycomment" ) )
->set_description( esc_html( __( 'If user will cross the limit (defined above) within specified period (in seconds) in this field, he will be give a warning.', "anycomment" ) ) ),
$this->field_builder()
->number()
->set_id( self::OPTION_FILES_MAX_SIZE )
->set_title( __( 'File Size', "anycomment" ) )
->set_description( esc_html( __( 'Maximum allowed file size in megabytes. For example, regular PNG image is about ~ 1.5-2MB, JPEG are even smaller.', "anycomment" ) ) ),
] )
);
/**
* Section: Editor
*/
$form->add_section(
$this->section_builder()
->set_id( 'editor' )
->set_title( __( 'Editor', "anycomment" ) )
->set_fields( [
$this->field_builder()
->code()
->set_id( self::OPTION_EDITOR_CSS )
->set_args( [ 'mode' => 'css' ] )
->set_title( __( 'Custom CSS', "anycomment" ) )
->set_description( esc_html( __( 'Write custom CSS, it will be only related to AnyComment. Notice: you may require to drop the cache after your changes if you have any caching plugin installed.', "anycomment" ) ) ),
] )
);
}
/**
* {@inheritdoc}
*/
public function run() {
$sections_html = '';
$tabs = $this->do_tab_menu();
$html = <<