| 1 |
<?php |
| 2 |
\load_template( |
| 3 |
__DIR__ . '/admin-header.php', |
| 4 |
true, |
| 5 |
array( |
| 6 |
'settings' => '', |
| 7 |
'welcome' => '', |
| 8 |
'blog-profile' => 'active', |
| 9 |
'followers' => '', |
| 10 |
) |
| 11 |
); |
| 12 |
?> |
| 13 |
|
| 14 |
<div class="activitypub-settings activitypub-settings-page hide-if-no-js"> |
| 15 |
<form method="post" action="options.php"> |
| 16 |
<?php \settings_fields( 'activitypub_blog' ); ?> |
| 17 |
|
| 18 |
<div class="box"> |
| 19 |
<h3><?php \esc_html_e( 'Blog-Profile', 'activitypub' ); ?></h3> |
| 20 |
<table class="form-table"> |
| 21 |
<tbody> |
| 22 |
<tr> |
| 23 |
<th scope="row"> |
| 24 |
<?php \esc_html_e( 'Manage Avatar', 'activitypub' ); ?> |
| 25 |
</th> |
| 26 |
<td> |
| 27 |
<?php if ( \has_site_icon() ) : ?> |
| 28 |
<p><img src="<?php echo esc_url( get_site_icon_url( '50' ) ); ?>" /></p> |
| 29 |
<?php endif; ?> |
| 30 |
<p class="description"> |
| 31 |
<?php |
| 32 |
echo \wp_kses( |
| 33 |
\sprintf( |
| 34 |
// translators: %s is a URL. |
| 35 |
\__( 'The ActivityPub plugin uses the WordPress Site Icon as Avatar for the Blog-Profile, you can change the Site Icon in the "<a href="%s">General Settings</a>" of WordPress.', 'activitypub' ), |
| 36 |
\esc_attr( \admin_url( 'options-general.php' ) ) |
| 37 |
), |
| 38 |
'default' |
| 39 |
); |
| 40 |
?> |
| 41 |
</p> |
| 42 |
</td> |
| 43 |
</tr> |
| 44 |
<tr> |
| 45 |
<th> |
| 46 |
<?php \esc_html_e( 'Manage Header Image', 'activitypub' ); ?> |
| 47 |
</th> |
| 48 |
<td> |
| 49 |
<?php |
| 50 |
$classes_for_upload_button = 'button upload-button button-add-media button-add-header-image'; |
| 51 |
$classes_for_update_button = 'button'; |
| 52 |
$classes_for_wrapper = ''; |
| 53 |
|
| 54 |
if ( (int) get_option( 'activitypub_header_image', 0 ) ) { |
| 55 |
$classes_for_wrapper .= ' has-header-image'; |
| 56 |
$classes_for_button = $classes_for_update_button; |
| 57 |
$classes_for_button_on_change = $classes_for_upload_button; |
| 58 |
} else { |
| 59 |
$classes_for_wrapper .= ' hidden'; |
| 60 |
$classes_for_button = $classes_for_upload_button; |
| 61 |
$classes_for_button_on_change = $classes_for_update_button; |
| 62 |
} |
| 63 |
?> |
| 64 |
<div id="activitypub-header-image-preview-wrapper" class='<?php echo esc_attr( $classes_for_wrapper ); ?>'> |
| 65 |
<img id='activitypub-header-image-preview' src='<?php echo esc_url( wp_get_attachment_url( get_option( 'activitypub_header_image' ) ) ); ?>' style="max-width: 100%;" /> |
| 66 |
</div> |
| 67 |
<button |
| 68 |
type="button" |
| 69 |
id="activitypub-choose-from-library-button" |
| 70 |
type="button" |
| 71 |
class="<?php echo esc_attr( $classes_for_button ); ?>" |
| 72 |
data-alt-classes="<?php echo esc_attr( $classes_for_button_on_change ); ?>" |
| 73 |
data-choose-text="<?php esc_attr_e( 'Choose a Header Image', 'activitypub' ); ?>" |
| 74 |
data-update-text="<?php esc_attr_e( 'Change Header Icon', 'activitypub' ); ?>" |
| 75 |
data-update="<?php esc_attr_e( 'Set as Header Image', 'activitypub' ); ?>" |
| 76 |
data-state="<?php echo esc_attr( (int) get_option( 'activitypub_header_image', 0 ) ); ?>"> |
| 77 |
<?php if ( (int) get_option( 'activitypub_header_image', 0 ) ) : ?> |
| 78 |
<?php esc_html_e( 'Change Header Image', 'activitypub' ); ?> |
| 79 |
<?php else : ?> |
| 80 |
<?php esc_html_e( 'Choose a Header Image', 'activitypub' ); ?> |
| 81 |
<?php endif; ?> |
| 82 |
</button> |
| 83 |
<button |
| 84 |
id="activitypub-remove-header-image" |
| 85 |
type="button" |
| 86 |
<?php echo (int) get_option( 'activitypub_header_image', 0 ) ? 'class="button button-secondary reset"' : 'class="button button-secondary reset hidden"'; ?>> |
| 87 |
<?php esc_html_e( 'Remove Header Image', 'activitypub' ); ?> |
| 88 |
</button> |
| 89 |
<input type='hidden' name='activitypub_header_image' id='activitypub_header_image' value='<?php echo esc_attr( get_option( 'activitypub_header_image' ) ); ?>'> |
| 90 |
</td> |
| 91 |
</tr> |
| 92 |
<tr> |
| 93 |
<th scope="row"> |
| 94 |
<?php \esc_html_e( 'Change profile ID', 'activitypub' ); ?> |
| 95 |
</th> |
| 96 |
<td> |
| 97 |
<label for="activitypub_blog_identifier"> |
| 98 |
<input class="blog-user-identifier" name="activitypub_blog_identifier" id="activitypub_blog_identifier" type="text" value="<?php echo esc_attr( \get_option( 'activitypub_blog_identifier', \Activitypub\Model\Blog::get_default_username() ) ); ?>" /> |
| 99 |
@<?php echo esc_html( \wp_parse_url( \home_url(), PHP_URL_HOST ) ); ?> |
| 100 |
</label> |
| 101 |
<p class="description"> |
| 102 |
<?php \esc_html_e( 'This profile name will federate all posts written on your blog, regardless of the author who posted it.', 'activitypub' ); ?> |
| 103 |
</p> |
| 104 |
<p> |
| 105 |
<strong> |
| 106 |
<?php \esc_html_e( 'Please avoid using an existing author’s name as the blog profile ID. Fediverse platforms might use caching and this could break the functionality completely.', 'activitypub' ); ?> |
| 107 |
</strong> |
| 108 |
</p> |
| 109 |
</td> |
| 110 |
</tr> |
| 111 |
<tr> |
| 112 |
<th scope="row"> |
| 113 |
<?php \esc_html_e( 'Change Description', 'activitypub' ); ?> |
| 114 |
</th> |
| 115 |
<td> |
| 116 |
<label for="activitypub_blog_description"> |
| 117 |
<textarea |
| 118 |
class="blog-user-description large-text" |
| 119 |
rows="5" |
| 120 |
name="activitypub_blog_description" |
| 121 |
id="activitypub_blog_description" |
| 122 |
placeholder="<?php echo esc_attr( \get_bloginfo( 'description' ) ); ?>" |
| 123 |
><?php echo \esc_html( \get_option( 'activitypub_blog_description' ) ); ?></textarea> |
| 124 |
</label> |
| 125 |
<p class="description"> |
| 126 |
<?php \esc_html_e( 'By default the ActivityPub plugin uses the WordPress tagline as a description for the blog profile.', 'activitypub' ); ?> |
| 127 |
</p> |
| 128 |
</td> |
| 129 |
</tr> |
| 130 |
<tr scope="row"> |
| 131 |
<th> |
| 132 |
<label><?php \esc_html_e( 'Extra Fields', 'activitypub' ); ?></label> |
| 133 |
</th> |
| 134 |
<td> |
| 135 |
<p class="description"><?php \esc_html_e( 'Your homepage, social profiles, pronouns, age, anything you want.', 'activitypub' ); ?></p> |
| 136 |
|
| 137 |
<table class="widefat striped activitypub-extra-fields" role="presentation" style="margin: 15px 0;"> |
| 138 |
<?php |
| 139 |
$extra_fields = \Activitypub\Collection\Extra_Fields::get_actor_fields( \Activitypub\Collection\Users::BLOG_USER_ID ); |
| 140 |
|
| 141 |
if ( empty( $extra_fields ) ) { |
| 142 |
?> |
| 143 |
<tr> |
| 144 |
<td colspan="3"> |
| 145 |
<?php \esc_html_e( 'No extra fields found.', 'activitypub' ); ?> |
| 146 |
</td> |
| 147 |
</tr> |
| 148 |
<?php |
| 149 |
} |
| 150 |
foreach ( $extra_fields as $extra_field ) { |
| 151 |
?> |
| 152 |
<tr> |
| 153 |
<td><?php echo \esc_html( $extra_field->post_title ); ?></td> |
| 154 |
<td><?php echo \wp_kses_post( \get_the_excerpt( $extra_field ) ); ?></td> |
| 155 |
<td> |
| 156 |
<a href="<?php echo \esc_url( \get_edit_post_link( $extra_field->ID ) ); ?>" class="button"> |
| 157 |
<?php \esc_html_e( 'Edit', 'activitypub' ); ?> |
| 158 |
</a> |
| 159 |
</td> |
| 160 |
</tr> |
| 161 |
<?php } ?> |
| 162 |
</table> |
| 163 |
|
| 164 |
<p> |
| 165 |
<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=ap_extrafield_blog' ) ); ?>" class="button"> |
| 166 |
<?php esc_html_e( 'Add new', 'activitypub' ); ?> |
| 167 |
</a> |
| 168 |
<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=ap_extrafield_blog' ) ); ?>"> |
| 169 |
<?php esc_html_e( 'Manage all', 'activitypub' ); ?> |
| 170 |
</a> |
| 171 |
</p> |
| 172 |
</td> |
| 173 |
</tr> |
| 174 |
</tbody> |
| 175 |
</table> |
| 176 |
</div> |
| 177 |
|
| 178 |
<?php \do_settings_sections( 'activitypub_blog_profile' ); ?> |
| 179 |
|
| 180 |
<?php \submit_button(); ?> |
| 181 |
</form> |
| 182 |
</div> |
| 183 |
|