diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 83d3ebf2..651d0454 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -46,7 +46,7 @@ jobs: run: | cd packages/web-component/wordpress-plugin unzip -d extract read-along-web-app-loader.zip - if ! diff -qr read-along-web-app-loader extract/read-along-web-app-loader; then \ + if ! diff --exclude=js -qr read-along-web-app-loader extract/read-along-web-app-loader; then \ echo The zipped WordPress plugin packages/web-component/wordpress-plugin/read-along-web-app-loader.zip is out of date.; \ false; \ fi diff --git a/.gitignore b/.gitignore index 4717139e..d894bf63 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ www .python-version *~ **/version.ts +packages/web-component/wordpress-plugin/read-along-web-app-loader/js/* diff --git a/packages/web-component/bin/make-wordpress-plugin b/packages/web-component/bin/make-wordpress-plugin new file mode 100644 index 00000000..8184896f --- /dev/null +++ b/packages/web-component/bin/make-wordpress-plugin @@ -0,0 +1,5 @@ +#!/bin/bash +# delete previous version +cd packages/web-component/wordpress-plugin/ || exit +rm -rf read-along-web-app-loader.zip +zip a -r ./read-along-web-app-loader.zip ./read-along-web-app-loader diff --git a/packages/web-component/wordpress-plugin/README.md b/packages/web-component/wordpress-plugin/README.md index 3e7d8feb..b152674f 100644 --- a/packages/web-component/wordpress-plugin/README.md +++ b/packages/web-component/wordpress-plugin/README.md @@ -16,7 +16,7 @@ This page contains instructions on how to embed a read-along book in your WordPr You must have an administrator account on your WordPress site to install this plugin. -### Manual Installation +### Installation ![Manual Installation Screenshot](read-along-web-app-loader/assets/screenshot-manual-install.png) @@ -28,15 +28,6 @@ You must have an administrator account on your WordPress site to install this pl 6. Choose File `read-along-web-app-loader.zip` and click **Install Now** 7. Activate the plugin. -### Installing from the Plugin Directory _(coming soon)_ - -1. Login to your WordPress site -2. Choose Plugins from the menu of the Dashboard -3. Click **Add New Plugin** -4. Search for `Read Along` -5. Click **Install Now** when you find **Read Along Web App Loader** -6. Click **Activate** - ## Embedding a Read-Along in WordPress There are several ways to deploy your read-along on your WordPress site. In this configuration, you plan to upload all your read-along assets to your site's Media Library and embed them in a page or post. diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip b/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip index 03b6e1f0..13d72636 100644 Binary files a/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip and b/packages/web-component/wordpress-plugin/read-along-web-app-loader.zip differ diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php b/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php new file mode 100644 index 00000000..ddfcbbb2 --- /dev/null +++ b/packages/web-component/wordpress-plugin/read-along-web-app-loader/read-along-web-app-loader.php @@ -0,0 +1,107 @@ + Read_Along_Web_App_VERSION, + ], + $attrs, + $tag + ); + + if (!is_null($content)) { + $output = apply_filters("the_content", $content); + } + + $src = sprintf( + "https://unpkg.com/@readalongs/web-component@%s/dist/web-component/web-component.esm.js", + $attributes["version"] + ); + //script source code https://github.com/ReadAlongs/Studio-Web/ + wp_enqueue_script_module( + "read_along_web_component_script", + $src, + [], + Read_Along_Web_App_VERSION + ); + return $output; + } + /** + * Register read-along formats + */ + public static function supported_format($mimes = []) + { + //add key for read along format + $mimes["readalong"] = "text/xml"; + //add other supported audio formats + $mimes["m4a"] = "audio/mp4"; + $mimes["wav"] = "audio/wav"; + + return $mimes; + } + /** + * add the shortcode + * + */ + + public static function init() + { + if (!shortcode_exists("read_along_web_app_loader")) { + add_shortcode("read_along_web_app_loader", [ + get_called_class(), + "short_code", + ]); + } + } + /** + * Begins execution of the plugin. + * + * @since 1.0.0 + */ + public static function run() + { + add_action("init", [get_called_class(), "init"], 11); //hook to the init + } +} +add_filter("upload_mimes", ["ReadAlongWebAppLoader", "supported_format"]); //add supported formats +ReadAlongWebAppLoader::run(); //run the plugin diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader/readme.txt b/packages/web-component/wordpress-plugin/read-along-web-app-loader/readme.txt index 96bcdf0a..d2a66c69 100644 --- a/packages/web-component/wordpress-plugin/read-along-web-app-loader/readme.txt +++ b/packages/web-component/wordpress-plugin/read-along-web-app-loader/readme.txt @@ -1,26 +1,28 @@ === ReadAlong Web App Loader === Contributors: deltork Tags: read-along, read along, web app loading -Requires at least: 4.7 +Requires at least: 6.5.0 Tested up to: 6.5.2 -Stable tag: 1.0.0 +Stable tag: 1.4.0 Requires PHP: 7.0 License: MIT -License URI: https://github.com/ReadAlongs/Studio-Web/blob/main/LICENSE +License https://github.com/ReadAlongs/Studio-Web/blob/main/LICENSE -This WordPress plugin allows the deployment and activation of Read-Alongs generated using https://github.com/ReadAlongs/ on WordPress sites. +This WordPress plugin allows the deployment and activation of a Read-Along generated using https://github.com/ReadAlongs/ on WordPress sites. == Description == -This WordPress plugin allows the deployment and activation of Read-Alongs generated using https://github.com/ReadAlongs/ on WordPress sites. Just wrap your `` in a WordPress shortcode `[read_along_web_app_loader]`. The plugin does not load the script on all pages on your site; it will only add the script to the pages with the shortcode. -The shortcode accepts two optional attributes: - - The `src` attribute for users with custom scripts; defaults to unpkg.com - - The `version` attribute for which version on unpkg.com defaults; to the latest +This plugin is a free service (no account required) for activating the <read-along> tag in a WordPress site. The source code of the scripts used to activate the <read-along> tag is https://github.com/ReadAlongs/Studio-Web/. +This plugin will help you deploy and activate a Read-Along generated using **Studio-Web** or **Studio-CLI** from https://github.com/ReadAlongs/ on your WordPress site. +Please copy and paste the HTML code from the WordPress deployment section of the readme.txt generated by our studio application. Alternatively, just wrap your `` in a WordPress shortcode `[read_along_web_app_loader]`. + +The shortcode accepts one optional attribute: + - The `version` attribute for which version of the read-along web app to use == Frequently Asked Questions == -= How to get the code required for my read along = += How to get the code required for my read-along = Copy the code from the WordPress deployment section of the readme.txt @@ -30,15 +32,23 @@ There are two ways to generate a read-along. The online web app (download the we == Screenshots == -1. Configure read-along web app component in your WordPress classic editor -2. Sample read-along book -3. Configure read-along web app component in your WordPress block editor +1. Configure the read-along web app component in your WordPress classic editor +2. Sample read-along book +3. Configure the read-along web app component in your WordPress block editor == Changelog == - += 1.5.0= +* default read-along app version bumped to 1.5.0 += 1.4.0= +* default read-along app version bumped to 1.4.0 += 1.3.2 = +* Code updates = 1.0.0 = * Initial Release - - == Upgrade Notice == += 1.3.2 = +Bumped default read-along app version to 1.3.0 + +== Contributing == +The ReadAlong is an open-source project. You can make a Pull-Request to our repo at https://github.com/ReadAlongs/Studio-Web/ diff --git a/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php b/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php deleted file mode 100644 index c03428e4..00000000 --- a/packages/web-component/wordpress-plugin/read-along-web-app-loader/wp-read-along-web-app-loader.php +++ /dev/null @@ -1,109 +0,0 @@ - "latest", - "src" => - "https://unpkg.com/@readalongs/web-component@%s/dist/web-component/web-component.esm.js", - ], - $attrs, - $tag - ); - $output = ""; - wp_enqueue_style( - "Read_Along_Web_App_Loader_Font", - "https://fonts.googleapis.com/css?family=Lato%7CMaterial+Icons%7CMaterial+Icons+Outlined", - [], - "1.0.0" - ); - if (!is_null($content)) { - $output = apply_filters("the_content", $content); - } - $src = $attributes["src"]; - //format - if (!array_key_exists("src", $attrs) || stristr($src, "%s")) { - $src = sprintf($src, $attributes["version"]); - } - return $output . - "\n\n" . - sprintf("", $src); -} -/** - * Register read-along formats - */ -function add_read_along_format($mimes = []) -{ - //add key for read along format - $mimes["readalong"] = "text/xml"; - //add other supported audio formats - $mimes["m4a"] = "audio/mp4"; - $mimes["wav"] = "audio/wav"; - - return $mimes; -} -/** - * add the shortcode - * - */ - -function run_read_along_web_app_init() -{ - if (!shortcode_exists("read_along_web_app_loader")) { - add_shortcode( - "read_along_web_app_loader", - "read_along_web_app_loader_short_code" - ); - } -} -/** - * Begins execution of the plugin. - * - * @since 1.0.0 - */ -function run_read_along_web_app() -{ - add_action("init", "run_read_along_web_app_init", 11); //hook to the init -} -run_read_along_web_app(); //run the plugin -add_filter("upload_mimes", "add_read_along_format");//add supported formats