PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Render / Templates.php

Templates.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.0.0, at classes/Visualizer/Render/Templates.php

113 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // +----------------------------------------------------------------------+
4 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5 // +----------------------------------------------------------------------+
6 // | This program is free software; you can redistribute it and/or modify |
7 // | it under the terms of the GNU General Public License, version 2, as |
8 // | published by the Free Software Foundation. |
9 // | |
10 // | This program is distributed in the hope that it will be useful, |
11 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 // | GNU General Public License for more details. |
14 // | |
15 // | You should have received a copy of the GNU General Public License |
16 // | along with this program; if not, write to the Free Software |
17 // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
18 // | MA 02110-1301 USA |
19 // +----------------------------------------------------------------------+
20 // | Author: Eugene Manuilov <eugene@manuilov.org> |
21 // +----------------------------------------------------------------------+
22 /**
23 * Media view template rendering class.
24 *
25 * @category Visualizer
26 * @package Render
27 *
28 * @since 1.0.0
29 */
30 class Visualizer_Render_Templates extends Visualizer_Render {
31
32 /**
33 * The array of template names.
34 *
35 * @since 1.0.0
36 *
37 * @access private
38 * @var array
39 */
40 private $_templates = array(
41 'library-chart',
42 'library-empty',
43 );
44
45 /**
46 * Renders concreate template and wraps it into script tag.
47 *
48 * @since 1.0.0
49 *
50 * @param string $id The name of a template.
51 * @param string $callback The name of the function to render a template.
52 */
53 private function _renderTemplate( $id, $callback ) {
54 echo '<script id="tmpl-visualizer-', $id, '" type="text/html">';
55 call_user_func( array( $this, $callback ) );
56 echo '</script>';
57 }
58
59 /**
60 * Renders library-chart template.
61 *
62 * @since 1.0.0
63 *
64 * @access protected
65 */
66 protected function _renderLibraryChart() {
67 echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
68 echo '<a class="visualizer-library-chart-action visualizer-library-chart-delete" href="javascript:;" title="', esc_attr__( 'Delete', 'visualizer' ), '"></a>';
69 echo '<a class="visualizer-library-chart-action visualizer-library-chart-insert" href="javascript:;" title="', esc_attr__( 'Insert', 'visualizer' ), '"></a>';
70
71 echo '<span class="visualizer-library-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">&nbsp;[visualizer id=&quot;{{data.id}}&quot;]&nbsp;</span>';
72 echo '</div>';
73 }
74
75 /**
76 * Renders library-empty template.
77 *
78 * @since 1.0.0
79 *
80 * @access protected
81 */
82 protected function _renderLibraryEmpty() {
83 echo '<div class="visualizer-library-chart">';
84 echo '<div class="visualizer-library-chart-canvas visualizer-library-nochart-canvas">';
85 echo '<div class="visualizer-library-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
86 echo '</div>';
87 echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
88 echo '<span class="visualizer-library-chart-action visualizer-library-nochart-delete"></span>';
89 echo '<span class="visualizer-library-chart-action visualizer-library-nochart-insert"></span>';
90
91 echo '<span class="visualizer-library-chart-shortcode">';
92 echo '&nbsp;[visualizer]&nbsp;';
93 echo '</span>';
94 echo '</div>';
95 echo '</div>';
96 }
97
98 /**
99 * Renders templates.
100 *
101 * @since 1.0.0
102 *
103 * @access protected
104 */
105 protected function _toHTML() {
106 foreach ( $this->_templates as $template ) {
107 $callback = '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $template ) ) );
108 $this->_renderTemplate( $template, $callback );
109 }
110 }
111
112 }
113