Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Edits to new layout properties #12

Merged
merged 12 commits into from
Mar 8, 2022
Merged

Edits to new layout properties #12

merged 12 commits into from
Mar 8, 2022

Conversation

jwcounts
Copy link

@jwcounts jwcounts commented Mar 7, 2022

Fixed some bugs with the new get_body_with_layout() function, as well as incorporating transcripts where available. Also added some helper functions and a better fallback in case layout information isn't present.

Added support for displaying slideshows included in some NPR articles, using a library called Splide.

Finally, incorporated a bunch of feedback from the Wordpress Plugin Directory team, mostly around sanitizing and validating incoming data, and properly escaping outgoing data. Needed to do this in order to get the plugin approved and reopened in the plugin directory.

- Added fallbacks for when layout isn't present
- Added helper functions for transcripts
- Added support for collection elements
- Added support for lists
- Added intermediate support for slideshows
-Added support for corrections
Improved speed on API Push mapping page
- refined MySQL query
- Added transient caching
Added slideshow support via splide
Small tweak to layout language
- Previously formatted as shortcode with info as JSON
- Shortcode would then parse and enqueue style and scripts
- Now just generates and saves inline
@jwcounts jwcounts changed the title Jcounts layout Edits to new layout properties Mar 7, 2022
@jwcounts jwcounts requested a review from tamw-wnet March 7, 2022 22:49
if ( isset( $_POST['publishNow'] ) ) {
$publish = true;
}
if ( isset( $_POST['createDaft'] ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 'createDaft' a typo? @jwcounts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do see that its in the original code however

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a typo in the variable name, but yeah, it's been there a while and is consistent. I decided not to mess with it. The text on the visible button that's connected to is correct, though.

AND $wpdb->postmeta.meta_key NOT RegExp '(^[0-9]+$)'
";
//AND $wpdb->postmeta.meta_key NOT RegExp '(^[_0-9].+$)'
$keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
if ( $keys ) natcasesort( $keys );

//set_transient('ds_npr_' . $post_type .'_meta_keys', $keys, 60*60*24); # 1 Day Expiration
set_transient( 'ds_npr_' . $post_type . '_meta_keys', $keys, 60*60*24 ); # 1 Day Expiration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwcounts do you know why this transient setting was disabled/commented out previously? Are there consequences to re-enabling?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, we're the first people to touch this file in about 4 years. I'm assuming that it was commented out because transients were probably newer and less reliable.

As for consequences, I'm assuming that setting a transient without any kind of caching mechanism installed probably doesn't do anything, and getting a transient returns a blank (which is accepted behavior for an expired transient too).

Copy link
Author

@jwcounts jwcounts Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also glad to take a stab at that MySQL query, because those dropdowns were returning over 10k entries apiece. It took the page a good 45 seconds to load each time, and most of them were _oembed_ transients.

Copy link
Member

@tamw-wnet tamw-wnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwcounts Could you point out a couple of test case stories you used for the slideshow and rich media stuff? I want to replicate them in my environment, I'm particularly interested to see how the splide stuff works and make sure it will respond properly in my env.

@jwcounts
Copy link
Author

jwcounts commented Mar 8, 2022

Here's the ID for an article about Stephen Breyer's retirement: 1075781724

It's got the slideshow, inline photos, and a YouTube video. I haven't found many with slideshows, but I'll do some more searching.

Others to check:

  • 1079271255 (this one has YouTube and Twitter embeds)
  • 1082297385 (this is a good one as it is mostly transcript)
  • 1078968784 (embedded documents as well)

@tamw-wnet
Copy link
Member

@jwcounts things are generally looking really good, but I think something that has changed is that transcripts were broken and now aren't. Can we add a div around that transcript? Maybe id = npr_transcript ?

@jwcounts
Copy link
Author

jwcounts commented Mar 8, 2022

Good idea. I'll include that in a bit.

@tamw-wnet
Copy link
Member

Ok, other than the items (making transcripts and corrections css-addressible), this all looks really solid to me. Once those are added, this has my approval -- even more, I think these are great, particularly the slideshow handling!

@tamw-wnet tamw-wnet closed this Mar 8, 2022
@tamw-wnet tamw-wnet reopened this Mar 8, 2022
@tamw-wnet
Copy link
Member

sry didn't mean to close

@jwcounts
Copy link
Author

jwcounts commented Mar 8, 2022

Thanks! I've been very happy with the progress so far.

jwcounts added 2 commits March 8, 2022 16:15
CSS-addressible handling of correction text with localized display of…
@jwcounts
Copy link
Author

jwcounts commented Mar 8, 2022

Sounds like we can wrap this up.

@jwcounts jwcounts merged commit 67100ef into main Mar 8, 2022
@jwcounts jwcounts deleted the jcounts-layout branch March 8, 2022 22:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants