PluginProbe
Datafeedr API / 1.1.2
Datafeedr API v1.1.2
1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 All 181 releases
datafeedr-api / src / Templates / Template.php

Template.php in Datafeedr API 1.1.2, at src/Templates/Template.php

57 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace Datafeedr\Api\Templates;
2
3 use Datafeedr\Api\Wuwei\Templates\Template as Template_Abstract;
4
5 /**
6 * Template class.
7 *
8 * Extends the Wuwei Template_Abstract class.
9 *
10 * @since 2.0.0
11 */
12 class Template extends Template_Abstract {
13
14 /**
15 * {@inheritdoc}
16 */
17 public function get_file() {
18
19 $path = trailingslashit( realpath( __DIR__ . '/..' ) );
20 $path = trailingslashit( $path . 'Views' );
21 $file = $path . $this->name;
22
23 /**
24 * Filter the full path to our template file. Examples of a full path might be:
25 *
26 * - /home/user/public_html/wp-content/plugins/plugin-name/src/Template/price.php
27 *
28 * This filter allows you to modify the file name used when rendering the template.
29 *
30 * @since 2.0.0
31 *
32 * @param string $file The full path to our template file.
33 * @param object $this The Template object.
34 */
35 return apply_filters( 'datafeedr/api/template/get_file/file', $file, $this );
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function get_data() {
42
43 $data = $this->data;
44
45 /**
46 * Filter the data we will have access to when rendering the template. The $data array is passed
47 * through the extract() function which sets its array keys as variables and are made available
48 * in the template files.
49 *
50 * @since 2.0.0
51 *
52 * @param array $data An array of data to populate the template.
53 * @param object $this The Template object.
54 */
55 return apply_filters( 'datafeedr/api/template/get_data/data', $data, $this );
56 }
57 }