Skip to content

Commit

Permalink
refactor: word press plugin update to address review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
deltork committed May 10, 2024
1 parent f824714 commit 70e5634
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 119 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ www
.nx
.python-version
*~
packages/web-component/wordpress-plugin/read-along-web-app-loader/js/*
10 changes: 10 additions & 0 deletions packages/web-component/bin/make-wordpress-plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
#build the web-component
npx nx build web-component
# delete previous version
rm -rf packages/web-component/wordpress-plugin/read-along-web-app-loader/js/*
rm -rf packages/web-component/wordpress-plugin/read-along-web-app-loader.zip
#add build to plugin and make zip
cp dist/packages/web-component/dist/web-component/* packages/web-component/wordpress-plugin/read-along-web-app-loader/js/
cd packages/web-component/wordpress-plugin/
zip a -r ./read-along-web-app-loader.zip ./read-along-web-app-loader
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/**
* This plugin loads the scripts and styles for a read along component
*
* @link https://github.com/ReadAlongs/
* @since 1.0.0
*
* @package Read_Along_Web_App_Loader
*
* @wordpress-plugin
* Plugin Name: Read-Along Web App Loader
* Plugin URI: https://github.com/ReadAlongs/Studio-Web/
* Description: This plugin loads the script and styles needed to activate the &lt;read-along&gt; tag in a Word Press site
* Version: 1.3.0
* Author: Delasie Torkornoo
* License: MIT
* License URI: https://github.com/ReadAlongs/Studio-Web/blob/main/LICENSE
*/

// If this file is called directly, abort.
if (!defined("WPINC")) {
die();
}
/**
* Currently plugin version.
*/
define("Read_Along_Web_App_Loader_VERSION", "1.3.0");
define("Read_Along_Web_App_VERSION", "1.3.0");
class ReadAlongWebAppLoader
{
/**
* This function handles the activation of the code
* The [read_along_web_app_loader version=""] short code
* Accepts version of read-along generated
*/

public static function short_code($attrs = [], $content = null)
{
$output = "";
wp_enqueue_style(
"Read_Along_Web_App_Loader_Font",
"https://fonts.googleapis.com/css?family=Lato%7CMaterial+Icons%7CMaterial+Icons+Outlined",
[],
Read_Along_Web_App_Loader_VERSION
);
wp_enqueue_script_module(
"read_along_web_component_script",
plugin_dir_url(__FILE__) . "js/web-component.esm.js",
[],
Read_Along_Web_App_VERSION
);
if (!is_null($content)) {
$output = apply_filters("the_content", $content);
}

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
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
=== 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.3.0
Requires PHP: 7.0
License: MIT
License URI: 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 `<read-along>` 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 loads the script and styles needed to activate the &lt;read-along&gt; tag in a Word Press site.
This WordPress plugin allows the deployment and activation of a Read-Along generated using https://github.com/ReadAlongs/ on WordPress sites. Just wrap your `<read-along>` 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 one optional attribute:
- The `version` attribute for which version of the read-along generator

== Frequently Asked Questions ==

Expand All @@ -31,11 +30,12 @@ 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
2. Sample read-along book
3. Configure read-along web app component in your WordPress block editor

== Changelog ==

= 1.3.0=
* Embedded the ReadAlong app scripts
= 1.0.0 =
* Initial Release

Expand Down

This file was deleted.

0 comments on commit 70e5634

Please sign in to comment.