| @@ -129,8 +129,20 @@ | ||
| 129 | 129 | ?> |
| 130 | 130 | |
| 131 | 131 | <header> |
| 132 | 132 | <h1><?php esc_html_e( 'ConvertKit', 'convertkit' ); ?></h1> |
| 133 | + | |
| 134 | + <?php | |
| 135 | + // Output Help link tab, if it exists. | |
| 136 | + $documentation_url = $this->get_active_section_documentation_url( $active_section ); | |
| 137 | + if ( $documentation_url !== false ) { | |
| 138 | + printf( | |
| 139 | + '<a href="%s" class="convertkit-docs" target="_blank">%s</a>', | |
| 140 | + esc_attr( $documentation_url ), | |
| 141 | + esc_html__( 'Help', 'convertkit' ) | |
| 142 | + ); | |
| 143 | + } | |
| 144 | + ?> | |
| 133 | 145 | </header> |
| 134 | 146 | |
| 135 | 147 | <div class="wrap"> |
| 136 | 148 | <?php |
| @@ -149,9 +161,9 @@ | ||
| 149 | 161 | </form> |
| 150 | 162 | |
| 151 | 163 | <p class="description"> |
| 152 | 164 | <?php |
| 153 | - // Output Documentation link, if it exists. | |
| 165 | + // Output Help link, if it exists. | |
| 154 | 166 | $documentation_url = $this->get_active_section_documentation_url( $active_section ); |
| 155 | 167 | if ( $documentation_url !== false ) { |
| 156 | 168 | printf( |
| 157 | 169 | '%s <a href="%s" target="_blank">%s</a>', |
| @@ -240,18 +252,8 @@ | ||
| 240 | 252 | esc_html( $section->tab_text ), |
| 241 | 253 | $section->is_beta ? $this->get_beta_tab() : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 242 | 254 | ); |
| 243 | 255 | } |
| 244 | - | |
| 245 | - // Output Documentation link tab, if it exists. | |
| 246 | - $documentation_url = $this->get_active_section_documentation_url( $active_section ); | |
| 247 | - if ( $documentation_url !== false ) { | |
| 248 | - printf( | |
| 249 | - '<li class="convertkit-docs"><a href="%s" class="convertkit-tab" target="_blank">%s <span class="dashicons dashicons-external"></span></a></li>', | |
| 250 | - esc_attr( $documentation_url ), | |
| 251 | - esc_html__( 'Documentation', 'convertkit' ) | |
| 252 | - ); | |
| 253 | - } | |
| 254 | 256 | ?> |
| 255 | 257 | </ul> |
| 256 | 258 | <?php |
| 257 | 259 | // WordPress' JS will automatically move any .notice elements to be immediately below .wp-header-end |
| @@ -292,8 +294,23 @@ | ||
| 292 | 294 | * |
| 293 | 295 | * @since 1.9.6 |
| 294 | 296 | */ |
| 295 | 297 | public function register_sections() { |
| 298 | + | |
| 299 | + // If no Access Token exists, register a settings section that shows a button | |
| 300 | + // to start the OAuth authentication flow. | |
| 301 | + $settings = new ConvertKit_Settings(); | |
| 302 | + if ( ! $settings->has_access_and_refresh_token() ) { | |
| 303 | + // Just register the OAuth screen. | |
| 304 | + $sections = array( | |
| 305 | + 'oauth' => new ConvertKit_Settings_OAuth(), | |
| 306 | + ); | |
| 307 | + | |
| 308 | + // Assign them to this class. | |
| 309 | + $this->sections = $sections; | |
| 310 | + | |
| 311 | + return; | |
| 312 | + } | |
| 296 | 313 | |
| 297 | 314 | // Register the General and Tools settings sections. |
| 298 | 315 | $sections = array( |
| 299 | 316 | 'general' => new ConvertKit_Settings_General(), |