PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / trunk
ShareThis Dashboard for Google Analytics vtrunk
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / class / core / class-ga-view-core.php
googleanalytics / class / core Last commit date
class-ga-controller-core.php 1 year ago class-ga-view-core.php 4 years ago
class-ga-view-core.php
45 lines
1 <?php
2 /**
3 * GoogleAnalytics View Core.
4 *
5 * @package GoogleAnalytics
6 */
7
8 /**
9 * View Core class.
10 */
11 class Ga_View_Core {
12
13 /**
14 * Name of the view folder.
15 */
16 const PATH = 'view';
17
18 /**
19 * Loads given view file and it's data.
20 * Displays view or returns HTML code.
21 *
22 * @param string $view Filename string.
23 * @param array $data_array Data array.
24 * @param bool $html Whether to display or return HTML code.
25 *
26 * @return string
27 */
28 public static function load( $view, $data_array = array(), $html = false ) {
29 if ( ! empty( $view ) ) {
30 foreach ( $data_array as $k => $v ) {
31 $$k = $v;
32 }
33
34 ob_start();
35 include GA_PLUGIN_DIR . '/' . self::PATH . '/' . $view . '.php';
36 if ( $html ) {
37 return ob_get_clean();
38 } else {
39 // Note: this gets escaped elsewhere.
40 echo ob_get_clean(); // phpcs:ignore
41 }
42 }
43 }
44 }
45