GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 9cd7e5...74e7fc )
by Chris
16:50
created

PPP_Welcome::about_screen()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 74

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 74
rs 8.5672
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Weclome Page Class
4
 *
5
 * @package     PPP
6
 * @subpackage  Admin/Welcome
7
 * @copyright   Copyright (c) 2014, Pippin Williamson
8
 * Adapted for Post Promoter Pro
9
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
 * @since       1.2
11
 */
12
13
// Exit if accessed directly
14
if ( ! defined( 'ABSPATH' ) ) {
15
	exit;
16
}
17
18
/**
19
 * PPP_Welcome Class
20
 *
21
 * A general class for About and Credits page.
22
 *
23
 * @since 1.2
24
 */
25
class PPP_Welcome {
26
27
	/**
28
	 * Get things started
29
	 *
30
	 * @since 1.2
31
	 */
32
	public function __construct() {
33
		add_action( 'admin_menu', array( $this, 'admin_menus') );
34
		add_action( 'admin_head', array( $this, 'admin_head' ) );
35
		add_action( 'admin_init', array( $this, 'welcome'    ) );
36
	}
37
38
	/**
39
	 * Register the Dashboard Pages which are later hidden but these pages
40
	 * are used to render the Welcome and Credits pages.
41
	 *
42
	 * @access public
43
	 * @since 1.2
44
	 * @return void
45
	 */
46
	public function admin_menus() {
47
		// About Page
48
		add_dashboard_page(
49
			__( 'Welcome to Post Promoter Pro', 'ppp-txt' ),
50
			__( 'Welcome to Post Promoter Pro', 'ppp-txt' ),
51
			PostPromoterPro::get_manage_capability(),
52
			'ppp-about',
53
			array( $this, 'about_screen' )
54
		);
55
56
		// Getting Started Page
57
		add_dashboard_page(
58
			__( 'Getting started with Post Promoter Pro', 'ppp-txt' ),
59
			__( 'Getting started with Post Promoter Pro', 'ppp-txt' ),
60
			PostPromoterPro::get_manage_capability(),
61
			'ppp-getting-started',
62
			array( $this, 'getting_started_screen' )
63
		);
64
65
	}
66
67
	/**
68
	 * Hide Individual Dashboard Pages
69
	 *
70
	 * @access public
71
	 * @since 1.2
72
	 * @return void
73
	 */
74
	public function admin_head() {
75
		remove_submenu_page( 'index.php', 'ppp-about' );
76
		remove_submenu_page( 'index.php', 'ppp-getting-started' );
77
78
		// Badge for welcome page
79
		$badge_url = PPP_URL . 'includes/images/ppp-badge.png';
80
		?>
81
		<style type="text/css" media="screen">
82
		/*<![CDATA[*/
83
		.ppp-badge {
84
			padding-top: 150px;
85
			height: 50px;
86
			width: 300px;
87
			color: #666;
88
			font-weight: bold;
89
			font-size: 14px;
90
			text-align: center;
91
			text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
92
			margin: 0 -5px;
93
			background: url('<?php echo $badge_url; ?>') no-repeat;
94
		}
95
96
		.about-wrap .ppp-badge {
97
			position: absolute;
98
			top: 0;
99
			right: 0;
100
		}
101
102
		.ppp-welcome-screenshots {
103
			float: right;
104
			margin-left: 10px!important;
105
		}
106
		/*]]>*/
107
		</style>
108
		<?php
109
	}
110
111
	/**
112
	 * Navigation tabs
113
	 *
114
	 * @access public
115
	 * @since 1.2
116
	 * @return void
117
	 */
118
	public function tabs() {
119
		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'ppp-about';
120
		?>
121
		<h1 class="nav-tab-wrapper">
122
			<a class="nav-tab <?php echo $selected == 'ppp-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'ppp-about' ), 'index.php' ) ) ); ?>">
123
				<?php _e( "What's New", 'ppp-txt' ); ?>
124
			</a>
125
		</h1>
126
		<?php
127
	}
128
129
	/**
130
	 * Render About Screen
131
	 *
132
	 * @access public
133
	 * @since 1.2
134
	 * @return void
135
	 */
136
	public function about_screen() {
137
		list( $display_version ) = explode( '-', PPP_VERSION );
138
		?>
139
		<div class="wrap about-wrap">
140
			<h1><?php printf( __( 'Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1>
141
			<div class="about-text"><?php printf( __( 'The most effective way to promote your WordPress content.', 'ppp-txt' ), $display_version ); ?></div>
142
			<div class="ppp-badge"><?php printf( __( 'Version %s', 'ppp-txt' ), $display_version ); ?></div>
143
144
			<?php $this->tabs(); ?>
145
146
			<div class="changelog">
147
				<h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' );?></h3>
148
149
				<div class="feature-section">
150
151
					<img src="<?php echo PPP_URL . '/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/>
152
153
					<h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' );?></h4>
154
					<p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' );?></p>
155
					<p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' );?></p>
156
157
				</div>
158
			</div>
159
160
			<div class="changelog">
161
				<h3><?php _e( 'Twitter Cards Support', 'ppp-txt' );?></h3>
162
163
				<div class="feature-section">
164
165
					<img src="<?php echo PPP_URL . '/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/>
166
167
					<h4><?php _e( 'Increased visibility on Twitter','ppp-txt' );?></h4>
168
					<p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' );?></p>
169
					<p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' );?></p>
170
171
				</div>
172
			</div>
173
174
			<div class="changelog">
175
				<h3><?php _e( 'Variable Twitter Images', 'ppp-txt' );?></h3>
176
177
				<div class="feature-section">
178
179
					<h4><?php _e( 'Change the image attached to each Tweet','ppp-txt' );?></h4>
180
					<p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' );?></p>
181
182
				</div>
183
			</div>
184
185
			<div class="changelog">
186
				<h3><?php _e( 'Additional Updates', 'ppp-txt' );?></h3>
187
188
				<div class="feature-section col three-col">
189
					<div>
190
						<h4><?php _e( 'Updated image sizes', 'ppp-txt' );?></h4>
191
						<p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' );?></p>
192
193
						<h4><?php _e( 'CSS Updates', 'ppp-txt' );?></h4>
194
						<p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' );?></p>
195
					</div>
196
197
					<div class="last-feature">
198
						<h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' );?></h4>
199
						<p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' );?></p>
200
					</div>
201
				</div>
202
			</div>
203
204
			<div class="return-to-dashboard">
205
				<a href="<?php echo esc_url( admin_url( 'admin.php?page=ppp-options' ) ); ?>"><?php _e( 'Start Using Post Promoter Pro!', 'ppp-txt' ); ?></a>
206
			</div>
207
		</div>
208
		<?php
209
	}
210
211
	/**
212
	 * Render Getting Started Screen
213
	 *
214
	 * @access public
215
	 * @since 1.2
216
	 * @return void
217
	 */
218
	public function getting_started_screen() {
219
		list( $display_version ) = explode( '-', PPP_VERSION );
220
		?>
221
		<div class="wrap about-wrap">
222
			<h1><?php printf( __( 'Welcome to Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1>
223
			<div class="about-text"><?php printf( __( 'The most effective way to promote your WordPress content.', 'ppp-txt' ), $display_version ); ?></div>
224
			<div class="ppp-badge"><?php printf( __( 'Version %s', 'ppp-txt' ), $display_version ); ?></div>
225
226
			<?php $this->tabs(); ?>
227
228
			<p class="about-description"><?php _e( 'Post Promoter Pro makes sharing your content as easy as possible.', 'ppp-txt' ); ?></p>
229
230
		</div>
231
		<?php
232
	}
233
234
	/**
235
	 * Sends user to the Welcome page on first activation of PPP as well as each
236
	 * time PPP is upgraded to a new version
237
	 *
238
	 * @access public
239
	 * @since 1.2
240
	 * @return void
241
	 */
242
	public function welcome() {
243
244
		$version_level = explode( '.', PPP_VERSION );
245
		if ( count( $version_level ) > 2 ) {
246
			return;
247
		}
248
249
		// Bail if no activation redirect
250
		if ( ! get_transient( '_ppp_activation_redirect' ) ) {
251
			return;
252
		}
253
254
		// Delete the redirect transient
255
		delete_transient( '_ppp_activation_redirect' );
256
257
		// Bail if activating from network, or bulk
258
		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
259
			return;
260
		}
261
262
		wp_safe_redirect( admin_url( 'index.php?page=ppp-about' ) ); exit;
263
	}
264
}
265
new PPP_Welcome();
266