Completed
Push — master-stable ( ae7755...f03c30 )
by
unknown
87:13 queued 78:25
created

views/admin/my-jetpack-page.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<div class="clouds-sm"></div>
2
3
<div class="page-content landing">
4
	<?php Jetpack::init()->load_view( 'admin/network-activated-notice.php' ); ?>
5
6
	<?php
7
		/** This action is already documented in views/admin/admin-page.php */
8
		do_action( 'jetpack_notices' );
9
	?>
10
11
	<div id="my-jetpack-page-template"></div>
12
13
	<script id="tmpl-connection-page" type="text/html">
14
		<div class="content-container">
15
			<div id="my-jetpack-content" class="content">
16
				<h2><?php _e( 'My Jetpack', 'jetpack' ); ?></h2>
17
18
				<?php
19
				/*
20
				 * 3-column row shown to non-masters
21
				 */
22
				?>
23
				<# if ( ! data.currentUser.isMasterUser || ( ! data.currentUser.isMasterUser && data.masterUser ) ) { #>
24
					<div class="connection-details local-user j-row">
25
						<?php // left col ?>
26
						<div class="j-col j-lrg-4 j-md-6 j-sm-12 jp-user">
27
							<h3 title="<?php esc_attr_e( 'Username', 'jetpack' ); ?>"><?php _e( 'Site Username', 'jetpack' ); ?></h3>
28
							<div class="user-01">
29
								{{{ data.currentUser.gravatar }}} {{{ data.currentUser.adminUsername }}}
30
							</div>
31
						</div>
32
33
						<?php // middle col ?>
34
						<div class="j-col j-lrg-4 j-md-6 j-sm-12 wp-user">
35
							<h3 title="<?php esc_attr_e( 'WordPress.com Username', 'jetpack' ); ?>"><?php _e( 'WordPress.com Username', 'jetpack' ); ?></h3>
36
							<div class="wpuser-02">
37
								<# if ( data.currentUser.isUserConnected ) { #>
38
									{{{ data.currentUser.userComData.login }}}
39
								<# } else { #>
40
									<span><em><?php _e( 'Not connected', 'jetpack' ); ?></em></span>
41
								<# } #>
42
							</div>

43
						</div>
44
45
						<?php // right col ( Link/Unlink my account ) ?>
46
						<div class="j-col j-lrg-4 j-md-12 j-sm-12 wp-action">
47
							<?php //@todo h3 tags here for styling purposes ?>
48
							<h3>&nbsp</h3>
49
							<div class="action-btns">
50
								<# if ( data.currentUser.isUserConnected ) { #>
51
									<a class="button" title="<?php esc_attr_e( 'Unlink your account from WordPress.com', 'jetpack' ); ?>" href="<?php echo wp_nonce_url( Jetpack::admin_url( 'action=unlink&redirect=my_jetpack' ), 'jetpack-unlink' ); ?>"><?php esc_html_e( 'Unlink my account ', 'jetpack' ); ?></a>
52
								<# } else { #>
53
									<a class="button button-primary" title="<?php esc_attr_e( 'Link your account to WordPress.com', 'jetpack' ); ?>" href="<?php echo Jetpack::init()->build_connect_url( false, Jetpack::admin_url( array( 'page' => 'my_jetpack' ) ) ); ?>" ><?php esc_html_e( 'Link your account', 'jetpack' ); ?></a>
54
								<# } #>
55
							</div>
56
						</div>
57
					</div>
58
				<# } #>
59
60
61
				<?php
62
				/*
63
				 * 2-column row shown to master users.
64
				 */
65
				?>
66
				<# if ( data.currentUser.isMasterUser ) { #>
67
					<div class="connection-details master-user j-row">
68
						<?php // Left Col ?>
69
						<div class="j-col j-lrg-6 j-md-6 j-sm-12 jp-user">
70
							<h3 title="<?php esc_attr_e( 'Primary User of the site', 'jetpack' ); ?>"><?php _e( 'Site Username (Primary)', 'jetpack' ); ?></h3>
71
							<div class="user-01">
72
								{{{ data.currentUser.gravatar }}} {{{ data.currentUser.adminUsername }}}
73
							</div>
74
						</div>
75
76
						<?php // Right Col ?>
77
						<div class="j-col j-lrg-6 j-md-6 j-sm-12 wp-user">
78
							<h3 title="<?php esc_attr_e( 'WordPress.com Username', 'jetpack' ); ?>"><?php _e( 'WordPress.com Username', 'jetpack' ); ?></h3>
79
							<div class="wpuser-02">
80
								<span>{{{ data.currentUser.userComData.login }}}</span>
81
							</div>

82
						</div>
83
					</div>
84
				<# } #>
85
86
			</div><?php // my-jetpack-content ?>
87
88
			<?php
89
			/*
90
			 * User actions, only shown to admins
91
			 *
92
			 * Disconnect site, or change primary user
93
			 */
94
			?>
95
			<?php if ( current_user_can( 'jetpack_disconnect' ) ) : ?>
96
				<div class="j-row my-jetpack-actions">
97
					<div class="j-col j-lrg-6 j-md-6 j-sm-12">
98
						<h4><?php _e( 'Jetpack Primary User', 'jetpack' ); ?><a title="<?php esc_attr_e( 'Learn about what being the Primary User means.', 'jetpack' ); ?>" class="dashicons dashicons-editor-help what-is-primary" href="https://jetpack.me/support/primary-user" target="_blank"></a></h4>
99
						<?php
100
						// Only show dropdown if there are other admins
101
						$all_users    = count_users();
102
						$primary_text = __( '(primary)', 'jetpack' );
103
						if ( 1 < $all_users['avail_roles']['administrator'] ) : ?>
104
							<form action="" method="post">
105
								<select name="jetpack-new-master" id="user-list">
106
									<?php
107
									$all_users = get_users();
108
109
									foreach ( $all_users as $user ) {
110
										if ( Jetpack::is_user_connected( $user->ID ) && $user->caps['administrator'] ) {
111
											if ( $user->ID == Jetpack_Options::get_option( 'master_user' ) ) {
112
												$master_user_option = "<option selected value='{$user->ID}'>$user->user_login $primary_text</option>";
113
											} else {
114
												$user_options .= "<option value='{$user->ID}'>$user->user_login</option>";
115
											}
116
										}
117
									}
118
									// Show master first
119
									echo $master_user_option;
120
121
									// Show the rest of the linked admins
122
									$user_options = ! empty( $user_options ) ? $user_options : printf( __( '%sConnect more admins%s', 'jetpack' ), "<option disabled='disabled'>", "</option>" );
123
									echo $user_options;
124
									?>
125
								</select>
126
								<?php wp_nonce_field( 'jetpack_change_primary_user', '_my_jetpack_nonce' ); ?>
127
								<# if ( data.otherAdminsLinked ) { #>
128
									<input type="submit" name="jetpack-set-master-user" id="save-primary-btn" class="button button-primary" value="Save" title="<?php esc_attr_e( 'Set the primary account holder', 'jetpack' ); ?>"/>
129
								<# } else { #>
130
									<input type="submit" disabled="disabled" name="jetpack-set-master-user" id="save-primary-btn" class="button" value="Save" title="<?php esc_attr_e( 'Set the primary account holder', 'jetpack' ); ?>"/>
131
								<# } #>
132
							</form>
133
						<?php else : ?>
134
							<p>{{{ data.masterUser.masterUser.data.user_login }}} <?php echo $primary_text; ?></p>
135
							<p><em><?php _e( 'Create additional admins to change primary user.', 'jetpack' ); ?></em></p>
136
						<?php endif; ?>
137
					</div>
138
					<div class="j-col j-lrg-6 j-md-6 j-sm-12">
139
						<h4><?php _e( 'Disconnect Jetpack', 'jetpack' ); ?></h4>
140
						<a class="button" id="jetpack-disconnect" href="#"><?php esc_html_e( 'Disconnect site from WordPress.com', 'jetpack' ); ?></a>
141
					</div>
142
				</div>
143
144
				<div id="jetpack-disconnect-content">
145
					<div class="j-row">
146
						<div class="j-col j-lrg-12 j-md-12 j-sm-12">
147
148
							<?php if ( ! Jetpack::jetpack_is_staging_site() ) : ?>
0 ignored issues
show
The method jetpack_is_staging_site() does not exist on Jetpack. Did you maybe mean is_staging_site()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
149
								<h2><?php _e( 'Disconnecting Jetpack', 'jetpack' ); ?></h2>
150
								<p><?php _e( 'Before you completely disconnect Jetpack is there anything we can do to help?', 'jetpack' ); ?></p>
151
								<a class="button" id="confirm-disconnect" title="<?php esc_attr_e( 'Disconnect Jetpack', 'jetpack' ); ?>" href="<?php echo wp_nonce_url( Jetpack::admin_url( 'action=disconnect' ), 'jetpack-disconnect' ); ?>"><?php _e( 'Confirm Disconnect', 'jetpack' ); ?></a>
152
								<a class="button primary" id="support-no-disconnect" target="_blank" title="<?php esc_attr_e( 'Jetpack Support', 'jetpack' ); ?>" href="http://jetpack.me/contact-support/"><?php esc_html_e( 'I Need Support', 'jetpack' ); ?></a>
153
							<?php else : ?>
154
								<h2><?php _e( 'Can not disconnect Jetpack', 'jetpack' ); ?></h2>
155
								<p><?php
156
									printf(
157
										__( 'Disconnecting is not possible while in staging mode.<br /><a href="%s" target="_blank">Learn more about how staging sites work</a>.', 'jetpack' ),
158
										'https://jetpack.me/support/why-cant-i-disconnect-my-site/'
159
									);
160
								?></p>
161
								<input type="button" class="button" disabled="disabled" id="confirm-disconnect" value="<?php _e( 'Confirm Disconnect', 'jetpack' ); ?>">
162
								<a class="button primary" id="support-no-disconnect" target="_blank" title="<?php esc_attr_e( 'Jetpack Support', 'jetpack' ); ?>" href="https://jetpack.me/support/why-cant-i-disconnect-my-site/"><?php esc_html_e( 'I Need Support', 'jetpack' ); ?></a>
163
							<?php endif; ?>
164
							<a class="cancel-disconnect" id="cancel-disconnect" target="_blank" title="<?php esc_attr_e( 'cancel', 'jetpack' ); ?>" href="#"><?php esc_html_e( 'cancel', 'jetpack' ); ?></a>
165
166
						</div>
167
168
					</div>
169
				</div>
170
			<?php endif;?>
171
		</div><?php // div.content-container ?>
172
	</script>
173
</div><?php // div.page-content ?>
174