Git Product home page Git Product logo

alleyinteractive / apple-news Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beezwax/wp-publish-to-apple-news

153.0 49.0 71.0 14.16 MB

The Publish to Apple News plugin enables your WordPress blog content to be published to your Apple News channel.

Home Page: https://wordpress.org/plugins/publish-to-apple-news/

License: GNU General Public License v3.0

PHP 90.19% CSS 0.68% JavaScript 9.13%
hacktoberfest

apple-news's Introduction

Publish to Apple News

read me standard badge

The Publish to Apple News plugin enables your WordPress content to be published to your Apple News channel.

  • Convert your WordPress content into Apple News format automatically.
  • Create a custom design for your Apple News content with no programming knowledge required.
  • Automatically or manually publish posts from WordPress to Apple News.
  • Control individual posts with options to publish, update, or delete.
  • Publish individual posts or in bulk.
  • Handles image galleries and popular embeds like YouTube and Vimeo that are supported by Apple News.

Please visit our wiki for detailed information on the follow items:

Background

To enable content from your WordPress site to be published to your Apple News channel, you must obtain and enter Apple News API credentials from Apple.

Please see the Apple Developer and Apple News Publisher documentation and terms on Apple's website for complete information.

Releases

Install

See the wiki for installation instructions.

Use

See the wiki for usage instructions as well as configuration guidance.

Source

Changelog

See the release archive for the changelog.

Development Process

Contributing

The wiki has details about contributing.

Project Structure

Third-Party Dependencies

Related Efforts

Maintainers

Alley logo

Releasing the Plugin

The plugin uses a built release workflow to compile and tag releases. Whenever a new version is detected in the root composer.json file or in the plugin's headers, the workflow will automatically build the plugin and tag it with a new version. The built tag will contain all the required front-end assets the plugin may require. This works well for publishing to WordPress.org or for submodule-ing.

When you are ready to release a new version of the plugin, you can run npm run release to start the process of setting up a new release.

Contributors

Thanks to all of the contributors to this project.

License

This project is licensed under the GNU Public License (GPL) version 3 or later.

apple-news's People

Contributors

attackant avatar bcampeau avatar benjmyers avatar benpbolton avatar bh247484 avatar danbowles avatar danielbachhuber avatar dashaluna avatar david-binda avatar dlh01 avatar ffffelix avatar gosukiwi avatar hrkhal avatar hughiemolloy avatar jackmarketon avatar jaygonzales avatar jomurgel avatar kaitlinbolling avatar kasparsd avatar kevinfodness avatar manewc avatar mattheu avatar mboynes avatar mogmarsh avatar norcross avatar roborourke avatar ryanmarkel avatar smerriman avatar srtfisher avatar tylermachado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apple-news's Issues

Non-prefixed option names

All of the settings in Apple_Exporter\Settings::settings are stored in individual options without a prefix. These should be prefixed, or stored in a single serialised option with a suitable name.

Issues with Video component

Hi there,

Thanks so much for this great plugin. I have been have using it to generate Apple News Format, but one issue I have is that for some reason the embeddable video component doesn't seem to work for me.

Here is the code being used to generate the video markup that goes into the content:

 $html = '<p><iframe class="youtube" src="https://www.youtube.com/embed/'. $a['id'] .'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></p>';

Is there anything there that would stop it from being parsed as a embeddable video component?

Stepping through the code, in a post with no content except an embedded video inside a p tag, it will check a node with the tagname p, failing to match it as a p element and then testing it as a container.

It then checks a node with tagname 'iframe', failing to match it on the iframe check, with a nodevalue of "".

Not sure what im doing wrong here, have checked it without the `html

` wrapper and i just get an empty article.

Unlike the gallery element the video component doesnt state what exactly it expects to find (e.g. A div with class gallery).

What exactly is the iframe/embed component trying to match on/ any ideas why this isnt working? Let me know if you need any other info, would be very grateful for any advice you can give me on this.

Containers and Sections?

Hi Guys,

Just a quick one, just wondering if the plugin supported containers and sections yet? Couldn't find any reference to them in the readme and in the code their doesnt seem to be a component defined though there is a check to see if a component has child nodes.

Is this something that is supported yet? I am guessing not but if so I would be happy to add the info to the readme for others if someone can fill me in. I am looking to produce something that looks like this from the Apple News Example articles:

screen shot 2016-01-07 at 11 42 34

How to alter component's `style` property, not `text style`?

I've been looking to add a border to a quote component.

According to docs, the border is added to ComponentStyle property, not to confuse with ComponentTextStyle - which is different thing.

I've looked around code and couldn't find any filters that would allow me to alter component's ComponentStyle. Have I missed it?

For example, Cover component adds style aka ComponentStyle property in the build() function, but there are filters to alter it? Here is the code reference.

I couldn't find a builder class for ComponentStyle similar to ComponentTextStyle - that would be super handy!

Is there other way I can alter style property to add a border?

Incorrect publish notice

The plugin will display the success notice in certain circumstances even when the plugin fails to publish to Apple News. This is likely related to an incorrect interpretation of the API status or the API using the same status as success in these instances. Requires further investigation.

Articles removed via iCloud will break the Apple News list table

When an article is removed via iCloud, the stored Apple News ID is no longer valid and therefore breaks when trying to display the current status. If the ID is invalid, all apple_news_ post meta values should be removed automatically or at the very least, an non-fatal error should be displayed.

Duplicate of https://goo.gl/vg8EUj posting here since it appears support isn't given on Wordpress site

This is a duplicate of https://goo.gl/vg8EUj re-posting here as I haven't seen a responce to any support threads on the plugin's wordpress page at https://wordpress.org/support/plugin/publish-to-apple-news

I've just started with the plugin. I've submitted several of my existing articles to Apple News, however only one is showing on their side. Also none are showing what I open Apple News on my iPhone when logged into iCoud with my Apple News Account. All articles I have submitted show as Live and Published in the plugin. I haven't submitted by channel for final approval as yet because I want to preview the drafts first to make sure I'm happy with the typesetting. Any idea what is going wrong?

I have also contacted Apple News Publishing Support and am waiting for the their response.

Article Format Not Accepted

Got this from apple on a few posts. Is there something specific to get around this?

While reviewing your Apple News Format submission, we noticed that something isn't quite right. Please resolve these issues, and then resubmit your content at News Publisher.
Articles contain exposed unicode, HTML, or XML.
Regards,
The Apple News Team

Fatal error: Can't use method return value in write context

In my environment (running PHP 5.4.45) , I'm getting the following fatal error:

Fatal error: Can't use method return value in write context in admin/class-admin-apple-news-list-table.php on line 289. Output triggered in /srv/www/wp-content/plugins/query-monitor/collectors/php_errors.php on line 142

The culprit line seems to be this:

if ( ! empty( $this->get_pagenum() ) && $this->get_pagenum() > 1 ) {
    $params['paged'] = $this->get_pagenum();
}

If I change it to something like this, it seems to works fine:

$pagenum = $this->get_pagenum();
if ( isset($pagenum) && $pagenum > 1 ) {
    $params['paged'] = $this->get_pagenum();
}

MIME_PART_INVALID_SIZE Error

I received the below response/error when setting up an article to publish:

[body] => {"errors":[{"code":"MIME_PART_INVALID_SIZE","keyPath":["tumblr_ngerha4yez1tlysmeo1_500.gif"]}]}

What would be the reason for the error?

Caption shortcode tag appearing in excerpt metadata

Sometimes our articles begin with an image, and sometimes that image has a caption.

When a caption starts an article, the resulting caption shortcode will sometimes appear in the Apple News excerpt when showing our list of articles.

I believe this isn't being stripped before sending to the Apple News API. Obviously Apple News has no knowledge of a WP shortcode.

This looks like the problematic section:

metadata":{"excerpt":"[caption id=\"attachment_238259\" align=\"aligncenter\" width=\"630\"] Pathable's Jordan Schwartz spent three months working from Europe last spring. In Portugal, he had a view of the ocean as he looked toward the town of Salema. (Via Jordan Schwartz)[/caption]\r\n\r\n

Can't add custom fonts

Couple of steps needed here in my view:

  1. Add a field on the settings page for uploading ttf or otf files
  2. Add the uploaded fonts to the tmp folder during push along with other media
  3. Enable addition of fonts through code by adding a filter for an array of post script names and file paths

Point 3 is probably the quickest / simplest win. I'll work on a patch to cover all points though.

Get VIP to update

We'd really like to get a newer version of this running on WordPress.com VIP. I was going to open a support request, but wanted to check in with you first.

  • Shall I go ahead and open a ticket requesting update to latest version from github?
  • Any reason not to update to latest trunk? or would it be better to use latest tagged 1.0 release?
  • If the latter - are you planning a new tagged release any time soon? As there are some features we'd like that came after this.

Not possible to publish to a specific Apple News Section

Hi,

When creating sections within Apple News, there seems to be no way to publish a post from WP to a specific Apple News section (using the manual publish button)

There seem to be no controls or settings to be able to switch from the default section to any other section. Could this functionality possibly be added to the plugin? e.g. via the "Options" link (now used to set the pull quote)?

I'm asking because It is not possible from within iCloud Apple News manager (or any other place that I'm aware of) to move a published post to a different section manually.

thanks...

a

Articles Don't Work With Newest Version

Downloaded Apple News Preview application https://developer.apple.com/news-preview/ and articles that have published fine to Apple News throw an error when I try and preview them in the application, generally it is to do with images "Unable to determine mime-type of URL [bundle://imagename]". Also get a warning that the articles were created in V0.10 and a newer version 1.1.0 is available.

More tag not stripped out

We use the More tag on all of our posts - in the outputted json file, it seems that the comment tags are stripped out, but it still outputs the word 'more'

E.g.
Nullam ac egestas nunc.more

Don't ob_start() on every page load

ob_start() shouldn't be included in __construct() of Admin_Apple_News, which is instantiated on every page load. I'm not sure why this hasn't broken things.

Update to adhere to coding standards

This plugin should be updated to adhere to WordPress Coding Standards. Much of it does already, it just needs a once-over to e.g. convert indentation to tabs.

Images causing text overlap on iPhone 6; fine on iPad

Our images are 640px wide; when previewed on iPad, they are correctly aligned to the right, following the plugin's default "anchor-layout-right" positioning. However, when previewed on an iPhone, they appear to be causing text overlap.

In the screenshot attached, the overlapping text is supposed to be immediately after the heading, then an image, then the next paragraph. However, we end up with heading , image, text + text overlaid.

img_3534

This is the content that's causing it (though this is happening on all posts, not just this one)

<h3><a href="http://www.flickr.com/">Flickr</a></h3>
While it's generally thought of as an <a href="http://www.makeuseof.com/tag/online-photo-albums-host-free/">image-sharing site</a>, Flickr is also great for photo storage and organization, mostly because of the fact that you receive an entire terabyte of storage for free when you sign up for a free account.

<img class="aligncenter" src="http://www.makeuseof.com/wp-content/uploads/2016/03/flickr-photostream.png" alt="flickr-photostream" width="640" height="437" />

You also get editing tools powered by Aviary; they're not the best, but you can do all of the basics that you're likely to need, like adjusting brightness and contrast, and getting rid of red-eye.

Where does exporter pull from?

How does the exporter grab the data for each post?

The reason I ask is that we have some custom post styles that we use for things like galleries, so in those cases the actual content of the post would be seen as empty, but should actually have the data instead from some custom fields. Basically there is a custom template in my theme like single-gallery.php. So how could I get that applied over to Apple News as well?

And on that same note, is there a way to check for something being created in the Apple News format? For example, I have a custom shortcode that I need to output in a certain format in order for the plugin to render properly. So in my custom shortcode in my functions.php is there something like the below I could use?

if (is_apple_news()) {
 //do something
}

Add debugging mode

Add a debugging mode to the plugin to allow for more detailed troubleshooting of publishing issues. Will log detailed status on a failed publish and/or send an email to an administrator.

Error in page load for list of published articles

I received the error on the first article, but have had it midway down the list before. Only way to fix at the moment is to clear the db table from this post.

Fatal error: Uncaught exception 'Apple_Push_API\Request\Request_Exception' with message 'NOT_FOUND' in /public_html/_wp/wp-content/plugins/publish-to-apple-news/includes/apple-push-api/request/class-request.php:201 Stack trace: #0 /public_html/_wp/wp-content/plugins/publish-to-apple-news/includes/apple-push-api/request/class-request.php(157): Apple_Push_API\Request\Request->parse_response(Array, true, 'get') #1 /public_html/_wp/wp-content/plugins/publish-to-apple-news/includes/apple-push-api/class-api.php(158): Apple_Push_API\Request\Request->get('https://u48r14....') #2 /public_html/_wp/wp-content/plugins/publish-to-apple-news/includes/apple-push-api/class-api.php(103): Apple_Push_API\API->send_get_request('https://u48r14....') #3 /public_html/_wp/wp-content/plugins/publish-to-apple-news/admin/apple-actions/index/class-get.php(44): Apple_Push_API\API->get_article('0c8d4af2-d071-4...') #4 /public_html/_wp/wp-content/plugins/publish-to-apple-news in /public_html/_wp/wp-content/plugins/publish-to-apple-news/includes/apple-push-api/request/class-request.php on line 201

Handle the isPreview flag

A future release of Apple News will support an isPreview flag to control whether an article is actually going live when published, or whether it is only uploaded for previewing purposes. This should be added to the plugin and we should evaluate if it should be tied into post status.

Manual publish button doesn't appear to work

Publishing a post with the manual publish button doesn't seem to work.

I have automatic publishing set to no, and the option to display a publish button in a metabox enabled.

Have done a lot of debugging. When the publish button is clicked on the post edit screen, we run through the do_publish function in class-admin-apple-meta-boxes.php, which passes us on to the do_publish function in class-admin-apple-post-sync.php.

In this function $updated gets set to false, since the post isn't on Apple News yet.

This condition is therefore true:

! $updated && 'yes' != $this->settings->get( 'api_autosync' )

Which means we return and never publish the post.

Am I missing something?

Some errors on the setting dashboard

Some errors on the setting dashboard

Component Order
Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method Admin_Apple_Settings_Section_Formatting::render_meta_component_order() should not be called statically, assuming $this from compatible context Admin_Apple_Settings_Section_Formatting in /srv/www/wordpress-default/wp-content/plugins/apple-news/admin/settings/class-admin-apple-settings-section.php on line 496

And when I failed to publish the article that already published using the plug-in version got from wordpress plugin successfully before, Got API error as well, Wonder if you can give some advice.

Thanks,
Wei

No Save Button Functioning, Settings Page

Title says it all. Latest update 1.0.6 has caused the settings page to have no ability to save. Therefor the plugin will not work for new installations or for installations that wish to make changes in the settings page.
Overall the save button is just not present.
Could we please have a fix ASAP guys :)
Cheers!

Error in Component Order section in settings

Receiving the error:

Component Order
Fatal error: Using $this when not in object context in /public_html/_wp/wp-content/plugins/publish-to-apple-news/admin/settings/class-admin-apple-settings-section-formatting.php on line 233

But the sections of the text above are moveable objects.

Updating articles in Apple News

The update feature does not seem to be working. Also, articles that are updated in WordPress should have the ability to auto-update Apple News.

Video URL matched but invalid JSON created.

Originally commented in WP Enterprise Slack channel, but cross posting here too.

So standard embeds, a single url on its own line, all work fine. But I have a URL that wasn't added correctly, and this is causing errors. My article ended up with the HTML like so:

<p>https://www.youtube.com/watch?v=lEsPhTbJhuo<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula.</p>

In this case, the node is matched. However the build method appears to handle both the URL on its own line, and also tries to do some smart matching on iFrames.

The code tries to treat mine as the latter.

What to do? Whilst my situation is not 100% correct embed format, it shouldn't create invalid JSON.

I think we should remove the fallback iFrame handling. The iFrame code would NOT match the initial nodeMatches logic anyway. Furthermore - its appears there are issues with this anyway: see #44. For youtube at least, the src required by the iFrame is different from that used by the pattern for this component.

Alternatively, we can improve the iFrame code to actually work. I have run into some issues with Jetpack enabled where youtube videos are converted into an iFrame before AN gets to them.

Permissions Issues

I have installed the plugin to my web-server and when I go to click activate in the Wordpress menu it comes up with this error:

Parse error: syntax error, unexpected '{' in /mounted-storage/home142/sub015/sc87331-QOJL/DOMAIN/wp-content/plugins/apple-news-master/admin/apple-actions/index/class-push.php on line 136

I have read the part which says "Troubleshooting: Resolving Potential Permissions Issues" and have tried looking for “./apple-export/workspace” and “./apple-export/workspace/tmp” but cannot seem to find them.

Could someone please point me in the right direction to try and solve this issue?

Enhancements to debug mode

Any exception should trigger debug mode to send an email with the error message and the full contents of the workspace. This will be crucial for troubleshooting bundle errors.

date stamps in metadata ignores

I've been testing the three date stamps that can be added to the metadata array, but it appears as though they are ignored by Apple News, showing the date is was published to Apple instead of the date passes.

Is this an issue with Apple or the plugin?

Performance issues with new Apple News Status column in 1.04

Every time the Apple News admin page is visited, an API request is sent for every listed post to Apple News to fetch the status, with no caching whatsoever. This causes the page to be very slow loading, and if email logging is activated, 20 emails to be sent out any time anyone views the page.

Not sure on a fix, but if there isn't a quick one might want to revert the change.

fatal error call to a member function is_anchor_target

I have a post with two things:
a jpeg image and the text 'test' next to it.

When I hit the 'update' button, I get a notice and an error.

Notice: Undefined offset: 1 in /var/www/mywebsite/wp-content/plugins/publish-to-apple-news/includes/apple-exporter/builders/class-components.php on line 237
Fatal Error: Call to a member function is_anchor_target() on a non-object in /var/www/mywebsite/wp-content/plugins/publish-to-apple-news/includes/apple-exporter/builders/class-components.php on line 238

What is happening is that anchor_components function is looping on a $components array that has two elements. It's trying to get element at index 1. However, the array has indices 0 and 2.
Where this missing index happens:
In split_into_components function, $result array has 3 elements. But after it is passed to the function add_thumbnail_if_needed, it has 2 elements only, and their indices are 0 and 2. That function is unsetting the element with index 1 and it's not re-indexing the array.

Timeouts on pushes

Have you seen the article push to Apple timeout? e.g. "Operation timed out after 30001 milliseconds with 0 bytes received".

Obviously could have several causes (Apple, size of the article + assets being sent, etc), but I was wondering what you thought of automatically re-pushing failed submissions due to timeout? (on a cron, for example) or had other thoughts.

Plugin cannot be used if allow_url_fopen is unsupported

Running v1.0.6 of the plugin, when trying to publish a post, it throws the following error:

There has been an error with the API. Please make sure your API settings are correct and try again: The attachment could not be included in the request because it was empty.

Manual publish yields error

Hi,

Since a few weeks the manual publish button (both in a WordPress post and in the post list of plugin) seems to have stopped working, showing the following error in WP:

"There has been an error with the API. Please make sure your API settings are correct and try again: INVALID_DOCUMENT, INVALID DOCUMENT"

I have checked and re-entered all API keys to no avail. The plugin worked fine before that, there was no specific event or anything in our posting habits that triggered this (to my knowledge).

I enabled debugging, and this is the detailed error message:

Array 
( 
[headers] => Array 
( 
[date] => Tue, 08 Mar 2016 11:18:51 GMT 
[request-id] => 1814d88d-485b-4c7b-9963-45996e3c4837 
[content-type] => application/json; charset=UTF-8 
[content-length] => 281 
[connection] => keep-alive 
) 

[body] => {"errors":[{"code":"INVALID_DOCUMENT","keyPath":["root","components","[3]","text"],"message":"\"text\" was \"\\\"\\\"\" should be not (null or an empty string)"},{"code":"INVALID_DOCUMENT","keyPath":["root","components","[3]"],"message":"no components defined for role=heading4"}]} 
[response] => Array 
( 
[code] => 400 
[message] => Bad Request 
) 

[cookies] => Array 
( 
) 

[filename] => 
) 

using latest version of WP, and (i think) latest version of this plugin (v1.0.5)

thank you,

anton

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.