Skip to content

Commit bd89066

Browse files
authored
Merge pull request #250 from toolstack/switch-to-shortcodes
Switch to shortcodes
2 parents 5eac4c7 + e1df129 commit bd89066

File tree

9 files changed

+632
-165
lines changed

9 files changed

+632
-165
lines changed

.github/workflows/phpcs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: pat-s/[email protected]
2222
with:
2323
path: ${{ steps.composer-cache.outputs.dir }}
24-
# Use the hash of composer.json as the key for your cache if you do not commit composer.lock.
24+
# Use the hash of composer.json as the key for your cache if you do not commit composer.lock.
2525
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
2626
#key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
2727
restore-keys: ${{ runner.os }}-composer-

.github/workflows/phpunit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Unit Testing
22
on:
3-
push:
4-
pull_request:
3+
push:
4+
pull_request:
55
jobs:
66
phpunit:
77
runs-on: ubuntu-latest

activitypub.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
* Initialize plugin
2020
*/
2121
function init() {
22+
\defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 );
2223
\defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 );
2324
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=<p>)|(?<=<br>)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
2425
\defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '<strong><a><p><ul><ol><li><code><blockquote><pre><img>' );
25-
\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>" );
26+
\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>" );
2627
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
2728
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
2829
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
@@ -70,6 +71,9 @@ function init() {
7071
require_once \dirname( __FILE__ ) . '/includes/class-hashtag.php';
7172
\Activitypub\Hashtag::init();
7273

74+
require_once \dirname( __FILE__ ) . '/includes/class-shortcodes.php';
75+
\Activitypub\Shortcodes::init();
76+
7377
require_once \dirname( __FILE__ ) . '/includes/class-debug.php';
7478
\Activitypub\Debug::init();
7579

includes/class-admin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public static function settings_page() {
5050

5151
switch ( $tab ) {
5252
case 'settings':
53+
\Activitypub\Model\Post::upgrade_post_content_template();
54+
5355
\load_template( \dirname( __FILE__ ) . '/../templates/settings.php' );
5456
break;
5557
case 'welcome':

0 commit comments

Comments
 (0)