ALNP_Getting_Started   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 94
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
B output() 0 72 4
1
<?php
2
/**
3
 * Auto Load Next Post Getting Started class
4
 *
5
 * Thanks the user for choosing Auto Load Next Post.
6
 *
7
 * @since    1.6.0
8
 * @author   Sébastien Dumont
9
 * @category Classes
10
 * @package  Auto Load Next Post/Classes/Getting Started
11
 * @license  GPL-2.0+
12
 */
13
14
// Exit if accessed directly.
15
if ( ! defined( 'ABSPATH' ) ) {
16
	exit;
17
}
18
19
if ( ! class_exists( 'ALNP_Getting_Started' ) ) {
20
21
	class ALNP_Getting_Started {
22
23
		/**
24
		 * Initialize Getting Started.
25
		 *
26
		 * @access public
27
		 */
28
		public function __construct() {
29
			$this->id    = 'getting-started';
0 ignored issues
show
Bug introduced by
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
30
			$this->label = esc_html__( 'Getting Started', 'auto-load-next-post' );
0 ignored issues
show
Bug introduced by
The property label does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31
32
			add_action( 'auto_load_next_post_settings_end', array( $this, 'output' ), 10, 2 );
33
		} // END __construct()
34
35
		/**
36
		 * Output the getting started page.
37
		 * 
38
		 * @access public
39
		 * @param string $current_view
40
		 */
41
		public function output( $current_view ) {
42
			if ( $current_view !== 'getting-started' ) {
43
				return;
44
			}
45
46
			// Get active theme
47
			$active_theme = wp_get_theme();
48
			?>
49
			<div class="auto-load-next-post getting-started">
50
51
				<div class="container">
52
53
					<div class="content">
54
						<div class="logo">
55
							<a href="<?php echo AUTO_LOAD_NEXT_POST_STORE_URL; ?>" target="_blank">
56
								<img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/logo.png'; ?>" alt="<?php esc_html_e( 'Auto Load Next Post', 'auto-load-next-post' ); ?>" />
57
							</a>
58
						</div>
59
60
						<h1><?php printf( __( 'Getting started with %s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></h1>
61
62
						<p><strong><?php printf( __( 'Thanks for choosing %s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></strong></p>
63
64
						<p><?php echo esc_html__( 'Your well on your way to increasing your pageviews by engaging your site viewers to keep reading your content and reduce bounce rate.', 'auto-load-next-post' ); ?></p>
65
66
						<?php
67
						// Is Theme already supported?
68
						if ( is_alnp_supported() ) {
69
						?>
70
							<p><?php echo sprintf( __( 'Your active theme %1$s supports %2$s so everything is already setup for you.', 'auto-load-next-post' ), '<strong>' . $active_theme->name . '</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p>
71
						<?php
72
						} else {
73
						?>
74
							<p><?php echo sprintf( __( 'Run the %1$s to be ready in less than 5-minutes, setting up %2$s for the first time is easy. The wizard will scan your theme to process the installation.', 'auto-load-next-post' ), esc_html__( 'Setup Wizard', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p>
75
76
							<p><strong class="red"><?php _e( 'Developers:', 'auto-load-next-post' ); ?></strong> <?php printf( __( 'Enable %1$sWP_DEBUG%2$s in your %3$swp-config.php%4$s file before running the %5$s to provide you results for each step once it has scanned your theme.', 'auto-load-next-post' ), '<strong>', '</strong>', '<code>', '</code>', esc_html__( 'Setup Wizard', 'auto-load-next-post' ) ); ?></p>
77
78
							<p><?php echo sprintf( __( 'You can add support for %1$s for future users by viewing the documentation and developer guides, snippets and more.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p>
79
80
							<?php
81
							/**
82
							 * Display content if you have Auto Load Next Post Pro installed or not.
83
							 */
84
							if ( is_alnp_pro_version_installed() ) {
85
								include( dirname( __FILE__ ) . '/views/html-getting-started-pro.php' );
86
							}
87
							?>
88
89
							<p style="text-align: center;">
90
								<a class="button button-primary button-large" href="<?php echo add_query_arg( array( 'page' => 'auto-load-next-post', 'view' => 'setup-wizard' ), admin_url( 'options-general.php' ) ); ?>"><?php _e( 'Setup Wizard', 'auto-load-next-post' ); ?></a>
91
								<a class="button button-large" href="<?php echo AUTO_LOAD_NEXT_POST_DOCUMENTATION_URL; ?>"><?php _e( 'View Documentation', 'auto-load-next-post' ); ?></a>
92
							</p>
93
94
							<hr>
95
							<?php
96
						}
97
						?>
98
99
						<p><?php echo sprintf(
100
							/* translators: 1: Opening <a> tag to the Auto Load Next Post Twitter account, 2: Opening <a> tag to the Auto Load Next Post Instagram account, 3: Opening <a> tag to the Auto Load Next Post contact page, 4: Opening <a> tag to the Auto Load Next Post newsletter, 5: Closing </a> tag */
101
							esc_html__( 'If you have any questions or feedback, let me know on %1$sTwitter%5$s, %2$sInstagram%5$s or via the %3$sContact page%5$s. Also, %4$ssubscribe to my newsletter%5$s if you want to stay up to date with what\'s new and upcoming in Auto Load Next Post.', 'auto-load-next-post' ), '<a href="https://twitter.com/autoloadnxtpost" target="_blank">', '<a href="https://instagram.com/autoloadnextpost" target="_blank">', '<a href="https://autoloadnextpost.com/contact/" target="_blank">', '<a href="http://eepurl.com/bvLz2H" target="_blank">', '</a>'
102
						);
103
						?></p>
104
105
						<p><?php echo esc_html__( 'Enjoy!', 'auto-load-next-post' ); ?></p>
106
					</div>
107
108
				</div>
109
110
			</div>
111
		<?php
112
		} // END output()
113
114
	} // END class
115
116
} // END if class
117
118
return new ALNP_Getting_Started();