PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.5.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.5.3
4.0.8 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 All 149 releases
← All changes | classes/Visualizer/Render/Templates.php +113 -108 4.0.41.5.3 View file →
@@ -1,108 +1,113 @@
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 visualizer-library-media-popup">';
68 - echo '<span class="visualizer-library-chart-shortcode" title="', esc_attr__( 'Select Chart', 'visualizer' ), '">&nbsp;[visualizer id=&quot;{{data.id}}&quot;]&nbsp;</span>';
69 - echo '</div>';
70 - }
71 -
72 - /**
73 - * Renders library-empty template.
74 - *
75 - * @since 1.0.0
76 - *
77 - * @access protected
78 - */
79 - protected function _renderLibraryEmpty() {
80 - echo '<div class="visualizer-library-chart">';
81 - echo '<div class="visualizer-library-chart-canvas visualizer-library-nochart-canvas">';
82 - echo '<div class="visualizer-library-notfound">', esc_html__( 'No charts found. Click \'Add New Chart\' to create one.', 'visualizer' ), '</div>';
83 - echo '</div>';
84 - echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
85 - echo '<span class="visualizer-library-chart-action visualizer-library-nochart-delete"></span>';
86 - echo '<span class="visualizer-library-chart-action visualizer-library-nochart-insert"></span>';
87 -
88 - echo '<span class="visualizer-library-chart-shortcode">';
89 - echo '&nbsp;[visualizer]&nbsp;';
90 - echo '</span>';
91 - echo '</div>';
92 - echo '</div>';
93 - }
94 -
95 - /**
96 - * Renders templates.
97 - *
98 - * @since 1.0.0
99 - *
100 - * @access protected
101 - */
102 - protected function _toHTML() {
103 - foreach ( $this->_templates as $template ) {
104 - $callback = '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $template ) ) );
105 - $this->_renderTemplate( $template, $callback );
106 - }
107 - }
108 -}
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 +/**
24 + * Media view template rendering class.
25 + *
26 + * @category Visualizer
27 + * @package Render
28 + *
29 + * @since 1.0.0
30 + */
31 +class Visualizer_Render_Templates extends Visualizer_Render {
32 +
33 + /**
34 + * The array of template names.
35 + *
36 + * @since 1.0.0
37 + *
38 + * @access private
39 + * @var array
40 + */
41 + private $_templates = array(
42 + 'library-chart',
43 + 'library-empty',
44 + );
45 +
46 + /**
47 + * Renders concreate template and wraps it into script tag.
48 + *
49 + * @since 1.0.0
50 + *
51 + * @param string $id The name of a template.
52 + * @param string $callback The name of the function to render a template.
53 + */
54 + private function _renderTemplate( $id, $callback ) {
55 + echo '<script id="tmpl-visualizer-', $id, '" type="text/html">';
56 + call_user_func( array( $this, $callback ) );
57 + echo '</script>';
58 + }
59 +
60 + /**
61 + * Renders library-chart template.
62 + *
63 + * @since 1.0.0
64 + *
65 + * @access protected
66 + */
67 + protected function _renderLibraryChart() {
68 + echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
69 + echo '<a class="visualizer-library-chart-action visualizer-library-chart-delete" href="javascript:;" title="', esc_attr__( 'Delete', Visualizer_Plugin::NAME ), '"></a>';
70 + echo '<a class="visualizer-library-chart-action visualizer-library-chart-insert" href="javascript:;" title="', esc_attr__( 'Insert', Visualizer_Plugin::NAME ), '"></a>';
71 +
72 + echo '<span class="visualizer-library-chart-shortcode" title="', esc_attr__( 'Click to select', Visualizer_Plugin::NAME ), '">&nbsp;[visualizer id=&quot;{{data.id}}&quot;]&nbsp;</span>';
73 + echo '</div>';
74 + }
75 +
76 + /**
77 + * Renders library-empty template.
78 + *
79 + * @since 1.0.0
80 + *
81 + * @access protected
82 + */
83 + protected function _renderLibraryEmpty() {
84 + echo '<div class="visualizer-library-chart">';
85 + echo '<div class="visualizer-library-chart-canvas visualizer-library-nochart-canvas">';
86 + echo '<div class="visualizer-library-notfound">', esc_html__( 'No charts found', Visualizer_Plugin::NAME ), '</div>';
87 + echo '</div>';
88 + echo '<div class="visualizer-library-chart-footer visualizer-clearfix">';
89 + echo '<span class="visualizer-library-chart-action visualizer-library-nochart-delete"></span>';
90 + echo '<span class="visualizer-library-chart-action visualizer-library-nochart-insert"></span>';
91 +
92 + echo '<span class="visualizer-library-chart-shortcode">';
93 + echo '&nbsp;[visualizer]&nbsp;';
94 + echo '</span>';
95 + echo '</div>';
96 + echo '</div>';
97 + }
98 +
99 + /**
100 + * Renders templates.
101 + *
102 + * @since 1.0.0
103 + *
104 + * @access protected
105 + */
106 + protected function _toHTML() {
107 + foreach ( $this->_templates as $template ) {
108 + $callback = '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $template ) ) );
109 + $this->_renderTemplate( $template, $callback );
110 + }
111 + }
112 +
113 +}