PageRenderTime 20ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wordpress-seo/admin/google_search_console/class-gsc-modal.php

https://bitbucket.org/carloskikea/helpet
PHP | 58 lines | 22 code | 8 blank | 28 comment | 0 complexity | d5fa10358d6383488d2de45cc56c513d MD5 | raw file
 1<?php
 2/**
 3 * WPSEO plugin file.
 4 *
 5 * @package WPSEO\Admin\Google_Search_Console
 6 */
 7
 8/**
 9 * Represents the Google Search Console modal.
10 */
11class WPSEO_GSC_Modal {
12
13	/** @var string */
14	protected $view;
15
16	/** @var int  */
17	protected $height;
18
19	/** @var array */
20	protected $view_vars;
21
22	/**
23	 * Sets the required attributes for this object.
24	 *
25	 * @param string $view      The file with the view content.
26	 * @param int    $height    The height that the modal will get.
27	 * @param array  $view_vars The attributes to use in the view.
28	 */
29	public function __construct( $view, $height, array $view_vars = array() ) {
30		$this->view      = $view;
31		$this->height    = $height;
32		$this->view_vars = $view_vars;
33	}
34
35	/**
36	 * Returns the height of the modal.
37	 *
38	 * @return int The set height.
39	 */
40	public function get_height() {
41		return $this->height;
42	}
43
44	/**
45	 * Loads the view of the modal.
46	 *
47	 * @param string $unique_id An unique identifier for the modal.
48	 */
49	public function load_view( $unique_id ) {
50		extract( $this->view_vars );
51
52		echo '<div id="' . esc_attr( 'redirect-' . $unique_id ) . '" class="hidden">';
53		echo '<div class="form-wrap wpseo_content_wrapper">';
54		require $this->view;
55		echo '</div>';
56		echo '</div>';
57	}
58}