Skip to content
Draft
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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions includes/class-newspack.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ private function includes() {

include_once NEWSPACK_ABSPATH . 'includes/wizards/class-setup-wizard.php';
include_once NEWSPACK_ABSPATH . 'includes/wizards/class-components-demo.php';
include_once NEWSPACK_ABSPATH . 'includes/wizards/class-subscribers-demo.php';

// Listings Wizard.
include_once NEWSPACK_ABSPATH . 'includes/wizards/class-listings-wizard.php';
Expand Down
1 change: 1 addition & 0 deletions includes/class-wizards.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static function init() {
public static function init_wizards() {
self::$wizards = [
'components-demo' => new Components_Demo(),
'subscribers-demo' => new Subscribers_Demo(),
// v2 Information Architecture.
'newspack-dashboard' => new Newspack_Dashboard(),
'setup' => new Setup_Wizard(),
Expand Down
74 changes: 74 additions & 0 deletions includes/wizards/class-subscribers-demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
* Newspack Subscribers Demo.
*
* @package Newspack
*/

namespace Newspack;

defined( 'ABSPATH' ) || exit;

require_once NEWSPACK_ABSPATH . '/includes/wizards/class-wizard.php';

/**
* Subscribers demo wizard.
*/
class Subscribers_Demo extends Wizard {

/**
* The slug of this wizard.
*
* @var string
*/
protected $slug = 'newspack-subscribers-demo';

/**
* The capability required to access this wizard.
*
* @var string
*/
protected $capability = 'manage_options';

/**
* Whether the wizard should be displayed in the Newspack submenu.
*
* @var bool
*/
protected $hidden = true;

/**
* Get the name for this wizard.
*
* @return string The wizard name.
*/
public function get_name() {
return esc_html__( 'Subscribers demo', 'newspack' );
}

/**
* Enqueue Subscribers Demo scripts and styles.
*/
public function enqueue_scripts_and_styles() {
parent::enqueue_scripts_and_styles();

if ( filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) !== $this->slug ) {
return;
}

wp_enqueue_script(
'newspack-subscribers-demo',
Newspack::plugin_url() . '/dist/subscribersDemo.js',
$this->get_script_dependencies( [ 'wp-html-entities' ] ),
NEWSPACK_PLUGIN_VERSION,
true
);

wp_enqueue_style(
'newspack-subscribers-demo',
Newspack::plugin_url() . '/dist/subscribersDemo.css',
[ 'wp-components' ],
NEWSPACK_PLUGIN_VERSION
);
}
}
5 changes: 3 additions & 2 deletions includes/wizards/class-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ public function enqueue_scripts_and_styles() {
}

if ( Newspack::is_debug_mode() && current_user_can( 'manage_options' ) ) {
$urls['components_demo'] = esc_url( admin_url( 'admin.php?page=newspack-components-demo' ) );
$urls['setup_wizard'] = esc_url( admin_url( 'admin.php?page=newspack-setup-wizard' ) );
$urls['components_demo'] = esc_url( admin_url( 'admin.php?page=newspack-components-demo' ) );
$urls['subscribers_demo'] = esc_url( admin_url( 'admin.php?page=newspack-subscribers-demo' ) );
$urls['setup_wizard'] = esc_url( admin_url( 'admin.php?page=newspack-setup-wizard' ) );
$urls['reset_url'] = esc_url(
add_query_arg(
array(
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import './style.scss';
const Footer = ( { simple = undefined } ) => {
const {
components_demo: componentsDemo = false,
subscribers_demo: subscribersDemo = false,
support = false,
setup_wizard: setupWizard = false,
reset_url: resetUrl = false,
Expand Down Expand Up @@ -47,6 +48,12 @@ const Footer = ( { simple = undefined } ) => {
url: componentsDemo,
} );
}
if ( subscribersDemo ) {
footerElements.push( {
label: __( 'Subscribers Demo', 'newspack-plugin' ),
url: subscribersDemo,
} );
}
if ( setupWizard ) {
footerElements.push( {
label: __( 'Setup Wizard', 'newspack-plugin' ),
Expand Down
12 changes: 12 additions & 0 deletions src/wizards/subscribersDemo/assets/cards/amex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions src/wizards/subscribersDemo/assets/cards/discover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions src/wizards/subscribersDemo/assets/cards/jcb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/wizards/subscribersDemo/assets/cards/mastercard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/wizards/subscribersDemo/assets/cards/visa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading