Skip to content

Commit

Permalink
Merge pull request #250 from toolstack/switch-to-shortcodes
Browse files Browse the repository at this point in the history
Switch to shortcodes
  • Loading branch information
pfefferle authored Jan 23, 2023
2 parents 5eac4c7 + e1df129 commit bd89066
Show file tree
Hide file tree
Showing 9 changed files with 632 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: pat-s/always-upload-cache@v1.1.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use the hash of composer.json as the key for your cache if you do not commit composer.lock.
# Use the hash of composer.json as the key for your cache if you do not commit composer.lock.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
#key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Unit Testing
on:
push:
pull_request:
push:
pull_request:
jobs:
phpunit:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
* 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>" );
\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__ ) );
Expand Down Expand Up @@ -70,6 +71,9 @@ function init() {
require_once \dirname( __FILE__ ) . '/includes/class-hashtag.php';
\Activitypub\Hashtag::init();

require_once \dirname( __FILE__ ) . '/includes/class-shortcodes.php';
\Activitypub\Shortcodes::init();

require_once \dirname( __FILE__ ) . '/includes/class-debug.php';
\Activitypub\Debug::init();

Expand Down
2 changes: 2 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static function settings_page() {

switch ( $tab ) {
case 'settings':
\Activitypub\Model\Post::upgrade_post_content_template();

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

0 comments on commit bd89066

Please sign in to comment.