diff --git a/.gitattributes b/.gitattributes index fdc43f4..06f1ad5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,34 @@ -# Set the default behavior, in case people don't have core.autocrlf set. -# Git will always convert line endings to LF on checkout, even on Windows -* text eol=lf +# Auto detect text files and perform LF normalization +* text=auto -# Denote all files that are truly binary and should not be modified. -*.eot binary -*.ttf binary -*.woff binary -*.png binary -*.jpg bin -*.mp3 binary -*.ogg binary -*.mp4 binary -*.webm binary +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +.gitattributes export-ignore +.gitignore export-ignore +.github export-ignore +.github/** export-ignore +bin export-ignore +bin/** export-ignore +docs export-ignore +docs/** export-ignore +tests export-ignore +tests/** export-ignore +phpcs.xml.dist export-ignore +phpunit.xml.dist export-ignore +README.md export-ignore +hookdoc-conf.json export-ignore +package.json export-ignore +composer.json export-ignore diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..948bc20 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ + + +## Description + + +## How Has This Been Tested? + + + + +## Screenshots (jpeg or gifs if applicable): + +## Types of changes + + + + + +## Checklist: +- [ ] My code is tested. +- [ ] My code is backward-compatible with WordPress 4.9 and PHP 7.0. +- [ ] My code follows the WordPress coding standards. +- [ ] My code has proper inline documentation. diff --git a/.github/hookdoc-tmpl/README.md b/.github/hookdoc-tmpl/README.md new file mode 100644 index 0000000..db3a293 --- /dev/null +++ b/.github/hookdoc-tmpl/README.md @@ -0,0 +1,3 @@ +## Able Player for WordPress Plugin Hook Documentation + +This resource is generated documentation on actions and filters found in Able Player for WordPress. Use the sidebar to browse and navigate. \ No newline at end of file diff --git a/.github/hookdoc-tmpl/layout.tmpl b/.github/hookdoc-tmpl/layout.tmpl new file mode 100644 index 0000000..8ca2291 --- /dev/null +++ b/.github/hookdoc-tmpl/layout.tmpl @@ -0,0 +1,38 @@ + + + + + <?js= title ?> - Able Player for WordPress Hook Doumentation + + + + + + + + + class="home"> + +
+ +

+
+ +
+ +
+ + + +
+ + + + + diff --git a/.github/hookdoc-tmpl/static/styles-docs.css b/.github/hookdoc-tmpl/static/styles-docs.css new file mode 100644 index 0000000..cbc2361 --- /dev/null +++ b/.github/hookdoc-tmpl/static/styles-docs.css @@ -0,0 +1,178 @@ +body { + background: #fefefe; + color: #232323; + font-size: 1.3rem; + font-weight: 300; + margin: 0; + border-top: 30px solid #243f82; +} + +#main { + border-top: 10px solid #79b3e1; +} + +nav { + margin-top: 0; + padding-top: 28px; + border-top: 10px solid #9b5; +} + +section { + margin-right: 0; +} + +footer { + padding: 12px 24px; +} + +h1, h2, h3 { + line-height: 1.2; + font-family: Garamond, serif; + font-weight: 900; + letter-spacing: -.01em; +} + +h1.page-title { + font-size: 42px; + margin-top: .5em; +} + +.type-signature { + color: #000; +} + +dl.details { + background: #fafafa; + padding: 10px; +} + +dl.details dt { + padding-top: 0; +} + +dl.details li { + padding-top: 0; +} + +nav ul { + font-size: 1.2rem; +} + +nav li a { + background-image: none; +} + +nav li a:hover { + text-decoration: underline; +} + +article h1 { + margin: 12px 0 32px; +} + +a { + text-decoration: underline; + color: #243f82; + transition: all .1s; +} + +a:visited, +a:active { + color: #232323; +} + +a:focus, +a:hover { + color: #000; + text-decoration: none; +} + +a.banner { + background-image: none; + margin-left: -10px; +} + +a.banner img { + width: 100%; + max-width: 888px; +} + +footer { + font-style: normal; +} + +.home #main main > section:first-of-type, +.home nav > h2 { + display: none; +} + +.prettyprint.source { + font-size: 1.1rem; +} + +.prettyprint code { + padding: 2px 10px; + line-height: 16px; + min-height: 16px; + height: auto; +} + +.pln { + color: #3d3d3c; } + +@media screen { + /* string content */ + .str { + color: #617c00; } + + /* a keyword */ + .kwd { + color: #794998; } + + /* a comment */ + .com { + color: #6e605c; } + + /* a type name */ + .typ { + color: #32619e; } + + /* a literal value */ + .lit { + color: #e5770f; } + + /* punctuation */ + .pun { + color: #3d3d3c; } + + /* lisp open bracket */ + .opn { + color: #2d2d2c; } + + /* lisp close bracket */ + .clo { + color: #2d2d2c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #e5770f; } + + /* a markup attribute value */ + .atv { + color: #2e898f; } + + /* a declaration */ + .dec { + color: #e5770f; } + + /* a variable name */ + .var { + color: #b81819; } + + /* a function name */ + .fun { + color: #32619e; } } \ No newline at end of file diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..e338360 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,25 @@ +name: Build Hook Docs + +on: + push: + branches: + - main + +jobs: + hookdocs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10 + uses: actions/setup-node@v1 + with: + node-version: '10.x' + - name: npm install, and build docs + run: | + npm install + npm run build:docs + - name: Deploy to GH Pages + uses: peaceiris/actions-gh-pages@v3 + with: + publish_dir: './docs' + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..368ace6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: Code Linting + +on: + push: + paths: + - '.github/workflows/main.yml' + - '**.php' + - 'phpcs.xml.dist' + - 'composer.json' + - 'composer.lock' + pull_request: + branches: + - trunk + # Only run if PHP-related files changed. + paths: + - '.github/workflows/main.yml' + - '**.php' + - 'phpcs.xml.dist' + - 'composer.json' + - 'composer.lock' + types: + - opened + - reopened + - synchronize + +jobs: + php-lint: + name: PHP + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: styfle/cancel-workflow-action@0.8.0 + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Validate Composer configuration + run: composer validate --strict + - name: Composer Install + run: composer install --no-interaction --no-progress + - name: PHP Lint + run: composer lint diff --git a/.gitignore b/.gitignore index 8b9e517..905eea5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,58 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + .DS_Store -thirdparty/jwplayer.* -thirdparty/jquery-*.js +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# JetBrains +.idea +src/.idea/workspace.xml +src/todo.txt +src/todo.txt +src/.idea/php.xml +src/.idea/workspace.xml +src/.idea/php.xml +src/.idea/workspace.xml +src/todo.txt +src/.idea/php.xml +src/.idea/workspace.xml +/node_modules +/vendor diff --git a/.wp-env.json b/.wp-env.json new file mode 100644 index 0000000..799e268 --- /dev/null +++ b/.wp-env.json @@ -0,0 +1,4 @@ +{ + "core": null, + "plugins": [ "." ] +} \ No newline at end of file diff --git a/README.md b/README.md index 8feb3f2..bd385d7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,39 @@ -Able Player WordPress Plugin -============================ +## Able Player WordPress Plugin -*Able Player* is a fully accessible cross-browser HTML5 media player for audio and video. +*Able Player* is a fully accessible cross-browser HTML5 media player for audio and video. -This plugin is designed to simplify the process of adding Able Player to WordPress websites. +This plugin is designed to simplify the process of adding Able Player to WordPress websites. + +See the [Able Player WordPress plug-in](https://wordpress.org/plugins/ableplayer/) site to download the latest stable version, rate the plugin, and report issues via the Support Forum. + +This GitHub repo is for development between stable versions. See the main [Able Player](http://ableplayer.github.io/ableplayer) project page for more details about Able Player. - -For additional details about this WordPress plugin, see the [readme.txt](readme.txt) file. +[![Code Linting](https://github.com/ableplayer/ableplayer-wordpress/actions/workflows/main.yml/badge.svg)](https://github.com/ableplayer/ableplayer-wordpress/actions/workflows/main.yml) [![License](https://img.shields.io/badge/license-GPL--2.0%2B-green.svg)](https://www.gnu.org/license/gpl-2.0.html) + +## Able Player for WordPress Build Environment + +* Tags: html5,media,audio,video,accessibility +* Requires at least: 4.9 +* Tested up to: 6.9 +* Stable tag: `2.3.0-rc1` +* License: MIT +* License URI: https://github.com/ableplayer/ableplayer-wordpress/blob/master/LICENSE + +This is the development environment for Able Player for WordPress + +## Contact + +Bugs or feature development contributions should be made through the [GitHub repository](https://github.com/ableplayer/ableplayer-wordpress/issues) + +## Authors + +* [Joe Dolson](https://www.joedolson.com) +* [Terrill Thompson](https://terrillthompson.com) + +## Contributors + +[Github Contributors](https://github.com/ableplayer/ableplayer-wordpress/graphs/contributors) +* [Joe Dolson](https://www.joedolson.com) \ No newline at end of file diff --git a/ableplayer.php b/ableplayer.php deleted file mode 100644 index df8d178..0000000 --- a/ableplayer.php +++ /dev/null @@ -1,237 +0,0 @@ - tags - * - * NOTE: This will affect ALL content on site, and may have undesirable consequences - * Therefore it's commented out by default. Test before using. - * - * -*/ -// remove_filter ('the_content', 'wpautop'); - -/* - * - * load styles and scripts to head - * -*/ - -function ableplayer_enqueue_scripts(){ - - // Documentation: - // http://codex.wordpress.org/Function_Reference/wp_enqueue_script - - // Register/enqueue common scripts that can be called automatically with just their handles (as of WP 3.5) - wp_enqueue_script( 'jquery' ); - - // Register/enqueue other dependencies - wp_enqueue_script( 'js-cookie', plugins_url('thirdparty',__FILE__).'/js.cookie.js',array('jquery')); - wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js' ); - - // Register/enqueue Able Player JavaScript (two options; uncomment the one you prefer) - - // JS Option 1: minified, for production - wp_enqueue_script( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.min.js',array('jquery')); - - // JS Option 2: human-readable, for debugging - // wp_enqueue_script( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.js',array('jquery')); - - // Register/enqueue Able Player CSS (two options; uncomment the one you prefer) - - // CSS Option 1: minified, for production - wp_enqueue_style( 'ableplayer', plugins_url('build',__FILE__).'/ableplayer.min.css'); - - // CSS Option 2: human-readable; use this if you intend to change the styles and customize the player - // wp_enqueue_style( 'ableplayer', plugins_url('styles',__FILE__).'/ableplayer.css'); - -} -add_action( 'wp_enqueue_scripts', 'ableplayer_enqueue_scripts'); - - -/* - * - * Add support for [ableplayer] shortcode - * - * -*/ - -function ableplayer_shortcode( $atts,$content=null ) { - - // Each of the following attributes can be passed with the [ableplayer] shortcode - // 'id' and 'type' (video or audio) is required - - // normalize attribute keys, lowercase - $atts = array_change_key_case((array)$atts, CASE_LOWER); - - // build complete array of all attributes; defaults will be overridden with user values - $all_atts = shortcode_atts([ - 'id' => ableplayer_get_unique_id(), - 'youtube-id' => '', - 'youtube-desc-id' => '', - 'youtube-nocookie' => '', - 'vimeo-id' => '', - 'vimeo-desc-id' => '', - 'autoplay' => 'false', - 'preload' => 'auto', - 'loop' => 'false', - 'playsinline' => 'true', - 'hidecontrols' => 'false', - 'poster' => '', - 'width' => '', - 'height' => '', - 'heading' => '', - 'speed' => 'animals', - 'start' => '', - 'volume' => '', - 'seekinterval' => '', - 'nowplaying' => 'false', - 'skin' => '2020' - ], $atts ); - - // output - if (!($all_atts['youtube-id'] || $all_atts['vimeo-id'])) { - // required fields are missing - return false; - } - else { - // build a video player! - $o = '