Opened 8 years ago
Last modified 18 months ago
#37938 accepted enhancement
Make existing HTML parsing functionality from REST API and Press This reusable
Reported by: | dshanske | Owned by: | kraftbj |
---|---|---|---|
Milestone: | Future Release | Priority: | low |
Severity: | minor | Version: | 4.2 |
Component: | Pings/Trackbacks | Keywords: | needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
WordPress already has an HTML parsing function in the form of WP_Press_This::source_data_fetch_fallback and its private called functions.
Suggesting this be split off so it can be used elsewhere. Specifically, my use case is over on the Ping and Trackbacks component. One of the proposals I keep advocating for is improving the presentation.
As we already have this code in WordPress that allows for parsing of HTML for images, embeds, meta tags, etc, it should be used over writing new code to do the same.
But if it were to be called right now, it would reretrieve source HTML already retrieved by the Pingback code and passed into the comment array.
Change History (10)
#1
@
8 years ago
- Keywords needs-patch needs-unit-tests added
- Milestone changed from Awaiting Review to Future Release
#2
@
8 years ago
@swissspidy If you remember, I chimed in re link previews during the oEmbed discussions, so I completely agree there too.
This should be relatively easy to separate. The code is pretty much written and stable. WP_Press_This will just call another class and focus on the Press This legacy merge and other related things.
This ticket was mentioned in Slack in #core by dshanske. View the logs.
8 years ago
#4
@
7 years ago
- Owner set to kraftbj
- Status changed from new to accepted
Noting that while I'm closing out various PT tickets since it is moving to a plugin, I'm leaving this since this is more of an enhancement to Core than strictly PT. I do like this idea though.
This ticket was mentioned in Slack in #core-pressthis by kraft. View the logs.
7 years ago
#7
@
7 years ago
I'm not a core coder. I just came to this from the link in the PT-in-4-9 thread.
Like many people, I'm sorely disappointed in the loss of the ability to populate the PT plugin like the bookmarklet availed.
WHAT CAN WE DO to get such functionality back - HOWEVER it could be accomplished (vice this bookmarklet ya'll have seen fit to deprecate)?
#8
@
18 months ago
Press This is no longer in core, but there is WP_REST_URL_Details_Controller
now that does a similar thing.
#9
@
18 months ago
The goal of this at the time when Press This was being split off was to keep some version of the parsing part of the code in Core. If this is built into a REST controller, should the ticket then evolve to that being usable in a non-REST context as well?
#10
@
18 months ago
- Component changed from Embeds to Pings/Trackbacks
- Summary changed from Split Source Parsing Functions from Press This So Can Be Used Globally to Make existing HTML parsing functionality from REST API and Press This reusable
I think that makes sense to me. It should be possible to abstract that logic and extend it so it's useful for pingbacks/trackbacks and other use cases in core.
Thought the same the other day. A separate class would be very handy for things like automatic link previews.