Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to shortcodes #250

Merged
merged 26 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e7d3cf9
Convert template codes to shortcodes.
toolstack Jan 13, 2023
bf6cf24
Add length to excerpt shortcode.
toolstack Jan 13, 2023
caea1ec
Make sure we have a post before using it to set class variables with.
toolstack Jan 16, 2023
4a17bb4
Separate the shortcode upgrade function and call it in the settings.
toolstack Jan 16, 2023
bc8e46e
Fix shortcode output.
toolstack Jan 16, 2023
621911d
Merge branch 'pfefferle:master' into switch-to-shortcodes
toolstack Jan 22, 2023
b5fa16b
Move the shortcodes to their own class.
toolstack Jan 22, 2023
740a73b
Add size attribute to the image shortcode.
toolstack Jan 22, 2023
3a82891
Minor cleanups.
toolstack Jan 22, 2023
efa62ac
Add missing text domain
pfefferle Jan 23, 2023
71f3a47
Converted shortcode class to static.
toolstack Jan 23, 2023
16b52c0
run also on PR
pfefferle Jan 23, 2023
aec21a4
coding standards
pfefferle Jan 23, 2023
75cc35c
I think it is enough to check if $post or $post_id is set
pfefferle Jan 23, 2023
3666f89
with `shortcode_atts` there is no need to check if attr is set
pfefferle Jan 23, 2023
b458cc6
coding standard
pfefferle Jan 23, 2023
d4b88f2
mastodon sadly does not support target on links
pfefferle Jan 23, 2023
cb1c26a
use static method to upgrade post content to shortcodes
pfefferle Jan 23, 2023
092a6bd
coding standards
pfefferle Jan 23, 2023
fe4e096
I would keep it simple for now
pfefferle Jan 23, 2023
c93f026
always escape output
pfefferle Jan 23, 2023
4d75ade
strong is not supported
pfefferle Jan 23, 2023
718bd78
typos
pfefferle Jan 23, 2023
a55dc90
fix length
pfefferle Jan 23, 2023
7be74c1
fix upgrade call
pfefferle Jan 23, 2023
e1df129
simplify inline help a bit
pfefferle Jan 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
* Initialize plugin
*/
function init() {
\defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 );
\defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 );
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
\defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '<strong><a><p><ul><ol><li><code><blockquote><pre><img>' );
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<p><strong>%title%</strong></p>\n\n%content%\n\n<p>%hashtags%</p>\n\n<p>%shortlink%</p>" );
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<p><strong>[ap_title]</strong></p>\n\n[ap_content]\n\n<p>[ap_hashtags]</p>\n\n<p>[ap_shortlink]</p>" );
pfefferle marked this conversation as resolved.
Show resolved Hide resolved
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );

require_once \dirname( __FILE__ ) . '/includes/class-shortcodes.php';
require_once \dirname( __FILE__ ) . '/includes/table/followers-list.php';
require_once \dirname( __FILE__ ) . '/includes/class-signature.php';
require_once \dirname( __FILE__ ) . '/includes/class-webfinger.php';
Expand Down
3 changes: 3 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public static function settings_page() {

switch ( $tab ) {
case 'settings':
$post_model = new \Activitypub\Model\Post();
$post_model->upgrade_post_content_template();

\load_template( \dirname( __FILE__ ) . '/../templates/settings.php' );
break;
case 'welcome':
Expand Down
Loading