Skip to content

Commit

Permalink
simplify inline help a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Jan 23, 2023
1 parent 7be74c1 commit e1df129
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
46 changes: 46 additions & 0 deletions includes/help.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
<?php

\get_current_screen()->add_help_tab(
array(
'id' => 'template-tags',
'title' => \__( 'Template Tags', 'activitypub' ),
'content' =>
'<p>' . __( 'The following Template Tags are available:', 'activitypub' ) . '</p>' .
'<dl>
<dt><code>[ap_title]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s title.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_content]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s content.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_excerpt lenght="400"]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s excerpt (default 400 chars). length parameter is optional.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_permalink type="url"]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s permalink. Type can be either: <code>url</code> or <code>html</code> (an &lt;a /&gt; tag to the url).', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_shortlink type="url"]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s shortlink. Type can be either <code>url</code> or <code>html</code> (an &lt;a /&gt; tag to the url). I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, to prettify the Shortlinks.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_hashtags]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s tags as hashtags.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_hashcats]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s categories as hashtags.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_image type=full]</code></dt>
<dd>' . \wp_kses( __( 'The URL for the post\'s featured image, defaults to full size. The type attribute can be any of the following: <code>thumbnail</code>, <code>medium</code>, <code>large</code>, <code>full</code>', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_author]</code></dt>
<dd>' . \wp_kses( __( 'The author\'s name.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_authorurl]</code></dt>
<dd>' . \wp_kses( __( 'The URL to the author\'s profile page.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_date]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s date.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_time]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s time.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_datetime]</code></dt>
<dd>' . \wp_kses( __( 'The post\'s date/time formated as "date @ time".', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_blogurl]</code></dt>
<dd>' . \wp_kses( __( 'The URL to the site.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_blogname]</code></dt>
<dd>' . \wp_kses( __( 'The name of the site.', 'activitypub' ), 'default' ) . '</dd>
<dt><code>[ap_blogdesc]</code></dt>
<dd>' . \wp_kses( __( 'The description of the site.', 'activitypub' ), 'default' ) . '</dd>
</dl>' .
'<p>' . __( 'You may also use any Shortcode normally available to you on your site, however be aware that Shortcodes may significantly increase the size of your content depending on what they do.', 'activitypub' ) . '</p>' .
'<p>' . __( 'Note: the old Template Tags are now deprecated and automatically converted to the new ones.', 'activitypub' ) . '</p>' .
'<p>' . \wp_kses( \__( '<a href="https://github.com/pfefferle/wordpress-activitypub/issues/new" target="_blank">Let me know</a> if you miss a template pattern.', 'activitypub' ), 'activitypub' ) . '</p>',
)
);

\get_current_screen()->add_help_tab(
array(
'id' => 'glossar',
Expand Down
25 changes: 6 additions & 19 deletions templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,22 @@
<p>
<textarea name="activitypub_custom_post_content" id="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo wp_kses( ACTIVITYPUB_CUSTOM_POST_CONTENT, 'post' ); ?>"><?php echo wp_kses( \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ), 'post' ); ?></textarea>
<details>
<summary><?php esc_html_e( 'See the complete list of ActivityPub shortcodes.', 'activitypub' ); ?></summary>
<summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary>
<div class="description">
<p><?php esc_html_e( 'You may use any shortcode normally available to you on your site, however be aware that shortcodes may significantly increase the size of your content depending on what they do.', 'activitypub' ); ?>
<p><?php esc_html_e( 'In addition, the following shortcodes are available during an ActivityPub post:', 'activitypub' ); ?>
<ul>
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li>
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li>
<li><code>[ap_excerpt <i>lenght=400</i>]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars). length parameter is optional.', 'activitypub' ); ?></li>
<li><code>[ap_permalink <i>type=url</i>]</code> - <?php \esc_html_e( 'The post\'s permalink. Type can be either: url (default, the escaped url), html (an a tag to the url).', 'activitypub' ); ?></li>
<?php // translators: ?>
<li><code>[ap_shortlink <i>type=url</i>]</code> - <?php echo \wp_kses( \__( 'The post\'s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, to prettify the Shortlinks. Type can be either: url (default, the escaped url), html (an a tag to the url).', 'activitypub' ), 'default' ); ?></li>
<li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars).', 'activitypub' ); ?></li>
<li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post\'s permalink.', 'activitypub' ); ?></li>
<li><code>[ap_shortlink]</code> - <?php echo \wp_kses( \__( 'The post\'s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>.', 'activitypub' ), 'default' ); ?></li>
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li>
<li><code>[ap_hashcats]</code> - <?php \esc_html_e( 'The post\'s categories as hashtags.', 'activitypub' ); ?></li>
<li><code>[ap_image <i>type=full</i>]</code> - <?php \esc_html_e( 'The URL for the post\'s featured image, defaults to full size. The type attribute can be any of the following: thumbnail, medium, large, full', 'activitypub' ); ?></li>
<li><code>[ap_author]</code> - <?php \esc_html_e( 'The author\'s name.', 'activitypub' ); ?></li>
<li><code>[ap_authorurl]</code> - <?php \esc_html_e( 'The URL to the author\'s profile page.', 'activitypub' ); ?></li>
<li><code>[ap_date]</code> - <?php \esc_html_e( 'The post\'s date.', 'activitypub' ); ?></li>
<li><code>[ap_time]</code> - <?php \esc_html_e( 'The post\'s time.', 'activitypub' ); ?></li>
<li><code>[ap_datetime]</code> - <?php \esc_html_e( 'The post\'s date/time formated as "date @ time".', 'activitypub' ); ?></li>
<li><code>[ap_blogurl]</code> - <?php \esc_html_e( 'The URL to the site.', 'activitypub' ); ?></li>
<li><code>[ap_blogname]</code> - <?php \esc_html_e( 'The name of the site.', 'activitypub' ); ?></li>
<li><code>[ap_blogdesc]</code> - <?php \esc_html_e( 'The description of the site.', 'activitypub' ); ?></li>
<li><code>[ap_image]</code> - <?php \esc_html_e( 'The URL for the post\'s featured image.', 'activitypub' ); ?></li>
</ul>
<p><?php esc_html_e( 'Note: the old template codes are now deprecated and automatically converted to the new shortcodes.', 'activitypub' ); ?>
<p><?php \esc_html_e( 'You can find the full list with all possible attributes in the help section on the top-right of the screen.', 'activitypub' ); ?></p>
</div>
</details>
</p>
<?php // translators: ?>
<p><?php echo \wp_kses( \__( '<a href="https://github.com/pfefferle/wordpress-activitypub/issues/new" target="_blank">Let me know</a> if you miss a template pattern.', 'activitypub' ), 'activitypub' ); ?></p>
</td>
</tr>
<tr>
Expand Down

0 comments on commit e1df129

Please sign in to comment.