Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the plugin to "Pym.js Embeds" in most places. #42

Merged
merged 3 commits into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pym Shortcode
# Pym.js Embeds

This plugin allows the use of NPR's [Pym.js](http://blog.apps.npr.org/pym.js/) responsive iframe script on WordPress sites, through the use of shortcodes and Gutenberg block.
This plugin allows the use of NPR's [Pym.js](http://blog.apps.npr.org/pym.js/) responsive iframe script on WordPress sites, through the use of shortcodes and Gutenberg blocks.

For detailed examples, ➡️ [read the docs!](./docs/) ⬅️
80 changes: 40 additions & 40 deletions docs/readme.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inc/block.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* The Gutenberg block for Pym embeds
* The Gutenberg block for Pym.js embeds
*
* @package pym-shortcode
* @package pym-embeds
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions inc/class-pymsrc-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* The class and related methods for tracking which pymsrc tags will be output upon the page
*
* @package pym-shortcode
* @package pym-embeds
*/

/**
Expand Down Expand Up @@ -129,13 +129,13 @@ public function warning_message_debug() {
/**
* Output a thing in the footer that shows up in the browser console, to assist in debugging
*
* This has to support IE 9 because Pym supports IE 9, but `console.log` and `console.error` aren't available in IE 9 unless the dev tools are open. Thus, the check `window.console`.
* This has to support IE 9 because Pym.js supports IE 9, but `console.log` and `console.error` aren't available in IE 9 unless the dev tools are open. Thus, the check `window.console`.
* @link https://stackoverflow.com/questions/8002116/should-i-be-removing-console-log-from-production-code/15771110
*/
public function warning_message_footer() {
printf(
'<script type="text/javascript">window.console && console.log( \'%1$s\', %2$s );</script>',
wp_json_encode( __( 'Hi Pym user! It looks like your post has multiple values for pymsrc for the blocks and shortcodes in use on this page. This may be causing problems for your Pym embeds. For more details, see https://github.com/INN/pym-shortcode/tree/master/docs#ive-set-a-different-pymsrc-option-but-now-im-seeing-a-message-in-the-console', 'pym_shortcode' ) ),
wp_json_encode( __( 'Hi Pym.js user! It looks like your post has multiple values for pymsrc for the blocks and shortcodes in use on this page. This may be causing problems for your Pym.js embeds. For more details, see https://github.com/INN/pym-shortcode/tree/master/docs#ive-set-a-different-pymsrc-option-but-now-im-seeing-a-message-in-the-console', 'pym_shortcode' ) ),
wp_json_encode( $this->sources )
);
}
Expand Down
2 changes: 2 additions & 0 deletions inc/info-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* The informational page for this plugin.
*
* This is available to everyone who can edit posts, because they'll need this info if they're creating new child pages for embed using the shortcode or plugin.
*
* @package pym-embeds
*/

namespace INN\PymEmbeds\Info;
Expand Down
1 change: 1 addition & 0 deletions inc/settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* The settings page for this plugin.
*
* @package pym-embeds
*/

namespace INN\PymEmbeds\Settings;
Expand Down
21 changes: 12 additions & 9 deletions inc/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
/**
* The [pym] shortcode and related functions
*
* @package pym-shortcode
* @package pym-embeds
*/

use INN\PymEmbeds\Settings\option_key;

/**
* A shortcode to simplify the process of embedding articles using pym.js
*
* This function also powers the Pym Embed block output.
* This function also powers the Pym.js Embed block output in Gutenberg,
* as the render callback for a dynamic block.
*
* @param Array $atts the attributes passed in the shortcode.
* @param String $content the enclosed content; should be empty for this shortcode.
Expand Down Expand Up @@ -72,8 +73,10 @@ function pym_shortcode( $atts = array(), $content = '', $tag = '' ) {
$pymsrc = $atts['pymsrc'];
}

// If this is the first Pym element on the page, output the pymsrc script tag
// or if the pymsrc is set, output that.
// If this is the first Pym.js element on the page,
// register the default pymsrc script tag for output.
//
// Or, if the pymsrc is set, register that specific pymsrc for output.
if ( 0 === $pym_id || ! empty( $atts['pymsrc'] ) ) {
$pymsrc_output = Pymsrc_Output::get_instance();
$pymsrc_output->add( $pymsrc );
Expand Down Expand Up @@ -111,19 +114,19 @@ function pym_shortcode( $atts = array(), $content = '', $tag = '' ) {
* @link https://github.com/INN/pym-shortcode/issues/19
*
* @param Array $args Has the following indices:
* - 'pym_id' Which Pym instance this is on the page, provided for
* - 'pym_id' Which Pym.js embed instance this is on the page, provided for
* informational purposes. In this function, the pym_id value is
* used as the variable name in `var pym_id = new pym.Parent(...);`
* - 'actual_id' the element ID used for the Pym container element,
* - 'actual_id' the element ID used for the Pym.js container element,
* which is at this point set on the page and not changeable from
* this function. This is the first argument for `new pym.Parent()`.
* - 'src' the URL for the Pym child page. This is the second argument
* - 'src' the URL for the Pym.js child page. This is the second argument
* for `new pym.Parent()`.
* - 'pymoptions' The third argument for `pym.Parent()` See the xdomain
* argument in http://blog.apps.npr.org/pym.js/#example-block
* - 'actual_classes' The classes used on the Pym container element,
* - 'actual_classes' The classes used on the Pym.js container element,
* provided to this function for informational purposes.
* - 'pymsrc' The URL from which Pym is to be loaded for this emebed,
* - 'pymsrc' The URL from which Pym.js is to be loaded for this emebed,
* based on the shortcode/block options and the plugin settings.
*
* @since 1.3.2.1
Expand Down
18 changes: 9 additions & 9 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* This is the display title for your block, which can be translated with `i18n` functions.
* The block inserter will show this name.
*/
title: __( 'Pym Embed' ),
title: __( 'Pym.js Embed' ),

/**
* An icon property should be specified to make it easier to identify a block.
Expand Down Expand Up @@ -114,10 +114,10 @@
icon: 'analytics'
},
),
__( 'Pym Child URL' )
__( 'Pym.js Child URL' )
],
value: props.attributes.src,
placeholder: __( 'What is the URL of your Pym child page?' ),
placeholder: __( 'What is the URL of your Pym.js child page?' ),
onChange: ( value ) => { props.setAttributes( { src: value } ); },
} )
),
Expand All @@ -130,26 +130,26 @@
*/
el( InspectorControls, {},
el( TextControl, {
label: __( 'Pym Child URL' ),
label: __( 'Pym.js Child URL' ),
value: props.attributes.src,
placeholder: __( 'What is the URL of your Pym child page?' ),
placeholder: __( 'What is the URL of your Pym.js child page?' ),
onChange: ( value ) => { props.setAttributes( { src: value } ); },
} ),
),
el( InspectorAdvancedControls, {},
el( TextControl, {
label: __( 'Parent element ID (optional)' ),
label: __( 'Parent Element ID (optional)' ),
value: props.attributes.id,
onChange: ( value ) => { props.setAttributes( { id: value } ); },
help: __( 'The Pym block will automatically generate an ID for the parent element and use that to initiate the Pym embed. If your child page\'s code requires its parent to have a specific element ID, set that here.' ),
help: __( 'The Pym.js block will automatically generate an ID for the parent element and use that to initiate the Pym.js embed. If your child page\'s code requires its parent to have a specific element ID, set that here.' ),
} ),
el( TextControl, {
label: __( 'Pym.js source URL (optional)' ),
label: __( 'Pym.js Source URL (optional)' ),
value: props.attributes.pymsrc,
onChange: ( value ) => { props.setAttributes( { pymsrc: value } ); },
} ),
el( TextControl, {
label: __( 'Pym Options' ),
label: __( 'Pym.js Options' ),
value: props.attributes.pymoptions,
onChange: ( value ) => { props.setAttributes( { pymoptions: value } ); },
// @todo make this translatable https://github.com/WordPress/gutenberg/blob/master/packages/i18n/README.md
Expand Down
2 changes: 1 addition & 1 deletion pym-shortcode.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Plugin Name: Pym Shortcode
Plugin Name: Pym.js Embeds
Plugin URI: https://github.com/INN/pym-shortcode
Description: Adds a [pym src=""] shortcode to simplify use of NPR's Pym.js
Version: 1.3.2.1
Expand Down
31 changes: 14 additions & 17 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== Pym Shortcode ===
=== Pym.js Embeds ===
Contributors: inn_nerds
Donate link: https://inn.org/donate
Tags: shortcode, iframe, javascript, embeds, responsive, pym, NPR
Expand All @@ -9,15 +9,15 @@ Stable tag: 1.3.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A WordPress solution to embed iframes that are responsive horizontally and vertically using the NPR Visuals Team's pym.js.
A WordPress solution to embed iframes that are responsive horizontally and vertically using the NPR Visuals Team's `Pym.js`.

== Description ==

Pym Shortcode will resize an iframe responsively depending on the height of its content and the width of its container. The plugin uses [Pym.js](http://blog.apps.npr.org/pym.js/), developed by the NPR Visuals Team, to allow embedded content in WordPress posts and pages using a simple shortcode.
Pym.js Embeds provides shortcode and Gutenberg block wrappers for embedding responsive iframes using [Pym.js](http://blog.apps.npr.org/pym.js/), developed by the NPR Visuals Team. Embedded content resizes vertically to match its container's width.

== Installation ==

1. In the WordPress Dashboard go to **Plugins**, then click the **Add Plugins** button and search the WordPress Plugins Directory for Pym Shortcode. Alternatively, you can download the zip file from this Github repo and upload it manually to your WordPress site.
1. In the WordPress Dashboard go to **Plugins**, then click the **Add Plugins** button and search the WordPress Plugins Directory for Pym.js Embeds. Alternatively, you can download the zip file from this Github repo and upload it manually to your WordPress site.
2. Activate the plugin through the 'Plugins' screen in WordPress
3. In **Settings > Pym.js Embed Settings**, decide whether you'd like to change the plugin's behavior to use a non-default source URL for `Pym.js`, and whether you'd like to prevent post authors from setting embed-specific URLs for `Pym.js`
4. Begin embedding content!
Expand All @@ -32,17 +32,17 @@ Embeddable table from NPR:

![an embeddable table from NPR](img/responsive-iframe-npr.png)

Pym Shortcode in a WordPress post:
Pym.js Shortcode in a WordPress post:

![Pym Shortcode in a WordPress post](img/pym-shortcode-in-post.png)
![Pym.js Shortcode in a WordPress post](img/pym-shortcode-in-post.png)

Desktop view of the WordPress post with the NPR embed using Pym Shortcode:
Desktop view of the WordPress post with the NPR embed using Pym.js Shortcode:

![Desktop view of the WordPress post with the NPR embed using Pym Shortcode](img/pym-example-desktop.png)
![Desktop view of the WordPress post with the NPR embed using Pym.js Shortcode](img/pym-example-desktop.png)

Mobile view of the WordPress post with the NPR embed using Pym Shortcode:
Mobile view of the WordPress post with the NPR embed using Pym.js Shortcode:

![Mobile view of the WordPress post with the NPR embed using Pym Shortcode](img/pym-example-phone.png)
![Mobile view of the WordPress post with the NPR embed using Pym.js Shortcode](img/pym-example-phone.png)

== Changelog ==

Expand All @@ -54,7 +54,8 @@ Following the practice begun at plugin version 1.1.2 of [having the plugin versi

New features:

* Adds a "Pym Embed" block for use in Gutenberg. [PR #34](https://github.com/INN/pym-shortcode/pull/34) for issue [#28](https://github.com/INN/pym-shortcode/issues/28).
* Plugin renamed from "Pym Shortcode" to "Pym.js Embeds".
* Adds a "Pym.js Embed" block for use in Gutenberg. [PR #34](https://github.com/INN/pym-shortcode/pull/34) for issue [#28](https://github.com/INN/pym-shortcode/issues/28).
* If a block is created using this plugin and Gutenberg, and Gutenberg is then disabled, the block will show a link to the embedded graphic.
* Through the settings page, you can now serve pym.js using your newsroom's CDN or NPR's CDN! [PR #45]() for [issue #31](https://github.com/INN/pym-shortcode/issues/31).
* Adds a settings page, available to those with the `manage_options` capability, with the following options:
Expand All @@ -77,7 +78,7 @@ Changes:

= 1.3.2 =

* *RECOMMENDED UPDATE* : Pym users, NPR has released an update that closes a potential security hole. We recommend everyone update to 1.3.2.
* *RECOMMENDED UPDATE* : Pym.js users, NPR has released an update that closes a potential security hole. We recommend everyone update to 1.3.2.
* Update to pym.js version 1.3.2: https://github.com/nprapps/pym.js/releases/tag/v1.3.2 (Changelog at https://github.com/nprapps/pym.js/blob/v1.3.2/CHANGELOG)

= 1.3.1 =
Expand Down Expand Up @@ -118,11 +119,7 @@ Changes:

* First release of the plugin

== Upgrade Notice ==

No updates at this time.

== Pym Resources from NPR ==
== Pym.js Resources from NPR ==

You may also want to look at NPR's Pym.js resources:

Expand Down