Skip to content

Commit

Permalink
Merge pull request #1133 from alleyinteractive/fix/issue-1132/remove-…
Browse files Browse the repository at this point in the history
…deprecated-advertising-settings

Remove Deprecated Advertising Settings
  • Loading branch information
kevinfodness authored Jun 4, 2024
2 parents b5f8bdc + 294072d commit fef101a
Show file tree
Hide file tree
Showing 18 changed files with 12 additions and 412 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The Publish to Apple News plugin enables your WordPress content to be published
- 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.
- Automatically adjust advertisement settings.

Please visit our [wiki](https://github.com/alleyinteractive/apple-news/wiki) for detailed information on the follow items:

Expand Down
3 changes: 0 additions & 3 deletions assets/themes/classic.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "#d3d3d3",
"aside_border_color": "#000000",
Expand Down Expand Up @@ -58,7 +56,6 @@
"dropcap_number_of_lines": 5,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#000000",
"header1_font": "Baskerville",
Expand Down
3 changes: 0 additions & 3 deletions assets/themes/colorful.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "#ffff00",
"aside_border_color": "#3045ca",
Expand Down Expand Up @@ -64,7 +62,6 @@
"dropcap_number_of_lines": 5,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#000000",
"header1_font": "HelveticaNeue-CondensedBlack",
Expand Down
3 changes: 0 additions & 3 deletions assets/themes/dark.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "",
"aside_border_color": "#ffe890",
Expand Down Expand Up @@ -64,7 +62,6 @@
"dropcap_number_of_lines": 5,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#ffffff",
"header1_font": "HelveticaNeue-CondensedBold",
Expand Down
3 changes: 0 additions & 3 deletions assets/themes/default.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "#e1e1e1",
"aside_border_color": "#4f4f4f",
Expand Down Expand Up @@ -64,7 +62,6 @@
"dropcap_number_of_lines": 4,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#333333",
"header1_font": "AvenirNext-Bold",
Expand Down
3 changes: 0 additions & 3 deletions assets/themes/modern.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "#e6f7ff",
"aside_border_color": "#30bcff",
Expand Down Expand Up @@ -64,7 +62,6 @@
"dropcap_number_of_lines": 4,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#000000",
"header1_font": "AvenirNext-Bold",
Expand Down
3 changes: 0 additions & 3 deletions assets/themes/pastel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"ad_frequency": 5,
"ad_margin": 15,
"aside_alignment": "right",
"aside_background_color": "#ffebe0",
"aside_border_color": "#ffffff",
Expand Down Expand Up @@ -64,7 +62,6 @@
"dropcap_number_of_lines": 5,
"dropcap_number_of_raised_lines": 0,
"dropcap_padding": 5,
"enable_advertisement": "yes",
"gallery_type": "gallery",
"header1_color": "#000000",
"header1_font": "BodoniSvtyTwoOSITCTT-Book",
Expand Down
69 changes: 0 additions & 69 deletions includes/apple-exporter/builders/class-advertising-settings.php

This file was deleted.

1 change: 0 additions & 1 deletion includes/apple-exporter/class-component-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public static function initialize(
self::register_component( 'author', '\\Apple_Exporter\\Components\\Author' );
self::register_component( 'date', '\\Apple_Exporter\\Components\\Date' );
self::register_component( 'slug', '\\Apple_Exporter\\Components\\Slug' );
self::register_component( 'advertisement', '\\Apple_Exporter\\Components\\Advertisement' );
self::register_component( 'end-of-article', '\\Apple_Exporter\\Components\\End_Of_Article' );
self::register_component( 'in-article', '\\Apple_Exporter\\Components\\In_Article' );

Expand Down
1 change: 0 additions & 1 deletion includes/apple-exporter/class-exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public function initialize_builders( $builders = null ) {
$this->register_builder( 'textStyles', new Builders\Text_Styles( $this->content, $this->settings ) );
$this->register_builder( 'componentLayouts', new Builders\Component_Layouts( $this->content, $this->settings ) );
$this->register_builder( 'metadata', new Builders\Metadata( $this->content, $this->settings ) );
$this->register_builder( 'autoplacement', new Builders\Advertising_Settings( $this->content, $this->settings ) );
}

Component_Factory::initialize(
Expand Down
26 changes: 0 additions & 26 deletions includes/apple-exporter/class-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,18 +556,6 @@ private static function sort_registry( $registry ) {
*/
private static function initialize_options() {
self::$options = [
'ad_frequency' => [
'default' => 5,
'description' => __( 'A number between 1 and 10 defining the frequency for automatically inserting dynamic advertisements into articles. For more information, see the <a href="https://developer.apple.com/documentation/apple_news/advertisementautoplacement" target="_blank">Apple News Format Reference</a>.', 'apple-news' ),
'label' => __( 'Ad Frequency', 'apple-news' ),
'type' => 'integer',
],
'ad_margin' => [
'default' => 15,
'description' => __( 'The margin to use above and below inserted ads.', 'apple-news' ),
'label' => __( 'Ad Margin', 'apple-news' ),
'type' => 'integer',
],
'aside_alignment' => [
'default' => 'right',
'label' => __( 'Aside component alignment', 'apple-news' ),
Expand Down Expand Up @@ -964,12 +952,6 @@ private static function initialize_options() {
'label' => __( 'Drop cap padding', 'apple-news' ),
'type' => 'integer',
],
'enable_advertisement' => [
'default' => 'yes',
'label' => __( 'Enable advertisements', 'apple-news' ),
'options' => [ 'yes', 'no' ],
'type' => 'select',
],
'gallery_type' => [
'default' => 'gallery',
'label' => __( 'Gallery type', 'apple-news' ),
Expand Down Expand Up @@ -2536,14 +2518,6 @@ private function initialize_groups() {
'description' => __( 'Can either be a standard gallery, or mosaic.', 'apple-news' ),
'settings' => [ 'gallery_type' ],
],
'advertisement' => [
'label' => __( 'Advertisement', 'apple-news' ),
'settings' => [
'enable_advertisement',
'ad_frequency',
'ad_margin',
],
],
'aside' => [
'label' => __( 'Aside', 'apple-news' ),
'description' => __( 'Content that is not directly related to the article.', 'apple-news' ),
Expand Down
74 changes: 0 additions & 74 deletions includes/apple-exporter/components/class-advertisement.php

This file was deleted.

3 changes: 1 addition & 2 deletions includes/apple-exporter/components/class-component.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ abstract class Component {

/**
* Anchorable components are anchored to the previous element that appears in
* the position specified. If the previous element is an advertisement,
* attaches to the next instead of the previous element.
* the position specified.
*
* @since 0.6.0
* @var int
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ The 'Publish to Apple News' plugin enables WordPress sites with approved Apple N
* 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.
* Automatically adjust advertisement settings.

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.

Expand All @@ -48,6 +47,7 @@ Please visit our [wiki](https://github.com/alleyinteractive/apple-news/wiki) for

= 2.5.0 =

* Breaking Change: Removed support for per-article advertising settings, which have been deprecated by Apple. Advertising settings can now only be set at the channel level.
* Enhancement: Added support for an aside component. To use, specify the class for the container that includes the aside content in the plugin settings.
* Enhancement: Added support for the Footnotes block.
* Enhancement: Added a new In Article module, similar to the End of Article module, but which is configurable to appear within article content instead.
Expand Down
31 changes: 10 additions & 21 deletions tests/admin/test-class-admin-apple-themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,10 @@ public function test_delete_theme() {
public function test_import_theme() {

// Setup.
$advertisement_json = [
'role' => 'banner_advertisement',
'bannerType' => 'double_height',
];
$import_settings = [
'layout_margin' => 100,
'layout_gutter' => 20,
'json_templates' => [
'advertisement' => [
'json' => $advertisement_json,
],
],
'theme_name' => 'Test Import Theme',
$import_settings = [
'layout_margin' => 100,
'layout_gutter' => 20,
'theme_name' => 'Test Import Theme',
];

// Test.
Expand All @@ -235,10 +226,6 @@ public function test_import_theme() {
$theme_settings = $theme->all_settings();
$this->assertEquals( 100, $theme_settings['layout_margin'] );
$this->assertEquals( 20, $theme_settings['layout_gutter'] );
$this->assertEquals(
$advertisement_json,
$theme_settings['json_templates']['advertisement']['json']
);

// Cleanup.
$theme->delete();
Expand Down Expand Up @@ -336,14 +323,16 @@ public function test_json_save_custom_spec() {
$this->create_default_theme();
$json = <<<JSON
{
"role": "banner_advertisement",
"bannerType": "double_height"
"role": "body",
"text": "#text#",
"format": "html",
"anchor": "abc123"
}
JSON;
$nonce = wp_create_nonce( 'apple_news_json' );
/* phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized */
$_POST['apple_news_theme'] = Theme::get_active_theme_name();
$_POST['apple_news_component'] = 'Advertisement';
$_POST['apple_news_component'] = 'Body';
$_POST['apple_news_action'] = 'apple_news_save_json';
$_POST['apple_news_json_json'] = $json;
$_POST['page'] = 'apple-news-json';
Expand All @@ -363,7 +352,7 @@ public function test_json_save_custom_spec() {
$this->assertTrue( $theme->load() );
$theme_settings = $theme->all_settings();
$stored_json = wp_json_encode(
$theme_settings['json_templates']['advertisement']['json'],
$theme_settings['json_templates']['body']['json'],
JSON_PRETTY_PRINT
);
$this->assertEquals( $stored_json, $json );
Expand Down
Loading

0 comments on commit fef101a

Please sign in to comment.