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/Library.php +171 -230 3.0.51.5.3 View file →
@@ -1,230 +1,171 @@
1 -<?php
2 -// +----------------------------------------------------------------------+
3 -// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4 -// +----------------------------------------------------------------------+
5 -// | This program is free software; you can redistribute it and/or modify |
6 -// | it under the terms of the GNU General Public License, version 2, as |
7 -// | published by the Free Software Foundation. |
8 -// | |
9 -// | This program is distributed in the hope that it will be useful, |
10 -// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 -// | GNU General Public License for more details. |
13 -// | |
14 -// | You should have received a copy of the GNU General Public License |
15 -// | along with this program; if not, write to the Free Software |
16 -// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
17 -// | MA 02110-1301 USA |
18 -// +----------------------------------------------------------------------+
19 -// | Author: Eugene Manuilov <eugene@manuilov.org> |
20 -// +----------------------------------------------------------------------+
21 -/**
22 - * Renders visualizer library page.
23 - *
24 - * @category Visualizer
25 - * @package Render
26 - *
27 - * @since 1.0.0
28 - */
29 -class Visualizer_Render_Library extends Visualizer_Render {
30 -
31 - /**
32 - * Renders library page.
33 - *
34 - * @since 1.0.0
35 - *
36 - * @access protected
37 - */
38 - protected function _toHTML() {
39 - echo '<div class="wrap">';
40 - echo '<div id="visualizer-icon" class="icon32"><br></div>';
41 - echo '<h2>';
42 - esc_html_e( 'Visualizer Library', 'visualizer' );
43 - echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', 'visualizer' ), '</a>';
44 - echo '</h2>';
45 - $this->_renderMessages();
46 - $this->_renderLibrary();
47 - echo '</div>';
48 - }
49 -
50 - /**
51 - * Renders notification messages if need be.
52 - *
53 - * @since 1.4.2
54 - *
55 - * @access private
56 - */
57 - private function _renderMessages() {
58 - if ( ! filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
59 - echo '<div class="updated error">';
60 - echo '<p>';
61 - printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', 'visualizer' ), '<b>allow_url_fopen</b>' );
62 - echo '</p>';
63 - echo '</div>';
64 - }
65 - }
66 -
67 - /**
68 - * Renders library content.
69 - *
70 - * @since 1.0.0
71 - *
72 - * @access private
73 - */
74 - private function _renderLibrary() {
75 - // Added by Ash/Upwork
76 - $filterBy = null;
77 - if ( isset( $_GET['s'] ) && strlen( $_GET['s'] ) > 0 ) {
78 - $filterBy = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
79 - }
80 - // Added by Ash/Upwork
81 - echo '<div id="visualizer-types" class="visualizer-clearfix">';
82 - echo '<ul class="subsubsub">';
83 - foreach ( $this->types as $type => $array ) {
84 - if ( ! is_array( $array ) ) {
85 - // support for old pro
86 - $array = array( 'enabled' => true, 'name' => $array );
87 - }
88 - $label = $array['name'];
89 - $link = '<a class=" " href="' . esc_url(
90 - add_query_arg(
91 - array(
92 - 'type' => $type,
93 - 'vpage' => false,
94 - )
95 - )
96 - ) . '">';
97 - if ( ! $array['enabled'] ) {
98 - $link = "<a class=' visualizer-pro-only' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
99 - }
100 - echo '<li class="visualizer-list-item all">';
101 - if ( $type == $this->type ) {
102 - echo '<a class=" current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
103 - echo $label;
104 - echo '</a>';
105 - } else {
106 - echo $link;
107 - echo $label;
108 - echo '</a>';
109 - }
110 - echo ' | </li>';
111 - }
112 - echo '</ul>';
113 - echo '<form action="" method="get"><p id="visualizer-search" class="search-box">
114 - <input type="search" name="s" value="' . $filterBy . '">
115 - <input type="hidden" name="page" value="visualizer">
116 - <input type="submit" id="search-submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
117 - </p> </form>';
118 - echo '</div>';
119 - echo '<div id="visualizer-content-wrapper">';
120 - if ( ! empty( $this->charts ) ) {
121 - echo '<div id="visualizer-library" class="visualizer-clearfix">';
122 - foreach ( $this->charts as $placeholder_id => $chart ) {
123 - $this->_renderChartBox( $placeholder_id, $chart['id'] );
124 - }
125 - echo '</div>';
126 - } else {
127 - echo '<div id="visualizer-library" class="visualizer-clearfix">';
128 - echo '<div class="visualizer-chart">';
129 - echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
130 - echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
131 - echo '</div>';
132 - echo '<div class="visualizer-chart-footer visualizer-clearfix">';
133 - echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
134 - echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
135 - echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
136 - echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>';
137 - echo '<span class="visualizer-chart-shortcode">';
138 - echo '&nbsp;[visualizer]&nbsp;';
139 - echo '</span>';
140 - echo '</div>';
141 - echo '</div>';
142 - echo '</div>';
143 - }
144 - $this->_renderSidebar();
145 - echo '</div>';
146 - if ( is_array( $this->pagination ) ) {
147 - echo '<ul class=" subsubsub">';
148 - foreach ( $this->pagination as $page ) {
149 - echo '<li class="all">', $page, '</li>';
150 - }
151 - echo '</ul>';
152 - }
153 - }
154 -
155 - /**
156 - * Renders chart's box block.
157 - *
158 - * @since 1.0.0
159 - *
160 - * @access private
161 - *
162 - * @param string $placeholder_id The placeholder's id for the chart.
163 - * @param int $chart_id The id of the chart.
164 - */
165 - private function _renderChartBox( $placeholder_id, $chart_id ) {
166 - $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS );
167 - $title = '#' . $chart_id;
168 - if ( ! empty( $settings[0]['title'] ) ) {
169 - $title = $settings[0]['title'];
170 - }
171 - $ajax_url = admin_url( 'admin-ajax.php' );
172 - $delete_url = add_query_arg(
173 - array(
174 - 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
175 - 'nonce' => wp_create_nonce(),
176 - 'chart' => $chart_id,
177 - ), $ajax_url
178 - );
179 - $clone_url = add_query_arg(
180 - array(
181 - 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
182 - 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
183 - 'chart' => $chart_id,
184 - 'type' => $this->type,
185 - ), $ajax_url
186 - );
187 - $export_link = add_query_arg(
188 - array(
189 - 'action' => Visualizer_Plugin::ACTION_EXPORT_DATA,
190 - 'chart' => $chart_id,
191 - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION ),
192 - ), admin_url( 'admin-ajax.php' )
193 - );
194 - echo '<div class="visualizer-chart"><div class="visualizer-chart-title">', esc_html( $title ), '</div>';
195 - echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
196 - echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
197 - echo '</div>';
198 - echo '<div class="visualizer-chart-footer visualizer-clearfix">';
199 - echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>';
200 - echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>';
201 - echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>';
202 - echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>';
203 - echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">';
204 - echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
205 - echo '</span>';
206 - echo '</div>';
207 - echo '</div>';
208 - }
209 -
210 - /**
211 - * Render sidebar.
212 - */
213 - private function _renderSidebar() {
214 - if ( ! VISUALIZER_PRO ) {
215 - echo '<div id="visualizer-sidebar">';
216 - echo '<div class="visualizer-sidebar-box">';
217 - echo '<h3>' . __( 'Gain more editing power', 'visualizer' ) . '</h3><ul>';
218 - echo '<li>' . __( 'Spreadsheet like editor', 'visualizer' ) . '</li>';
219 - echo '<li>' . __( 'Import from other charts', 'visualizer' ) . '</li>';
220 - echo '<li>' . __( 'Frontend editor', 'visualizer' ) . '</li>';
221 - echo '<li>' . __( 'Private charts', 'visualizer' ) . '</li>';
222 - echo '<li>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li>';
223 - echo '<li>' . __( '3 more chart types', 'visualizer' ) . '</li></ul>';
224 - echo '<a href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a>';
225 - echo '</div>';
226 - echo '</div>';
227 - }
228 - }
229 -
230 -}
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 + * Renders visualizer library page.
25 + *
26 + * @category Visualizer
27 + * @package Render
28 + *
29 + * @since 1.0.0
30 + */
31 +class Visualizer_Render_Library extends Visualizer_Render {
32 +
33 + /**
34 + * Renders chart's box block.
35 + *
36 + * @since 1.0.0
37 + *
38 + * @access private
39 + * @param string $placeholder_id The placeholder's id for the chart.
40 + * @param int $chart_id The id of the chart.
41 + */
42 + private function _renderChartBox( $placeholder_id, $chart_id ) {
43 + $ajax_url = admin_url( 'admin-ajax.php' );
44 +
45 + $delete_url = add_query_arg( array(
46 + 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
47 + 'nonce' => wp_create_nonce(),
48 + 'chart' => $chart_id,
49 + ), $ajax_url );
50 +
51 + $clone_url = add_query_arg( array(
52 + 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
53 + 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
54 + 'chart' => $chart_id,
55 + 'type' => $this->type,
56 + ), $ajax_url );
57 +
58 + echo '<div class="visualizer-chart">';
59 + echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
60 + echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
61 + echo '</div>';
62 + echo '<div class="visualizer-chart-footer visualizer-clearfix">';
63 + echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', Visualizer_Plugin::NAME ), '" onclick="return showNotice.warn();"></a>';
64 + echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', Visualizer_Plugin::NAME ), '"></a>';
65 + echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', Visualizer_Plugin::NAME ), '" data-chart="', $chart_id, '"></a>';
66 +
67 + echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', Visualizer_Plugin::NAME ), '">';
68 + echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
69 + echo '</span>';
70 + echo '</div>';
71 + echo '</div>';
72 + }
73 +
74 + /**
75 + * Renders library content.
76 + *
77 + * @since 1.0.0
78 + *
79 + * @access private
80 + */
81 + private function _renderLibrary() {
82 + echo '<div id="visualizer-types" class="visualizer-clearfix">';
83 + echo '<ul>';
84 + foreach ( $this->types as $type => $label ) {
85 + echo '<li class="visualizer-list-item">';
86 + if ( $type == $this->type ) {
87 + echo '<a class="page-numbers current" href="', add_query_arg( 'vpage', false ), '">';
88 + echo $label;
89 + echo '</a>';
90 + } else {
91 + echo '<a class="page-numbers" href="', add_query_arg( array( 'type' => $type, 'vpage' => false ) ), '">';
92 + echo $label;
93 + echo '</a>';
94 + }
95 + echo '</li>';
96 + }
97 + echo '</ul>';
98 + echo '</div>';
99 +
100 + if ( !empty( $this->charts ) ) {
101 + echo '<div id="visualizer-library" class="visualizer-clearfix">';
102 + foreach ( $this->charts as $placeholder_id => $chart ) {
103 + $this->_renderChartBox( $placeholder_id, $chart['id'] );
104 + }
105 + echo '</div>';
106 +
107 + if ( is_array( $this->pagination ) ) {
108 + echo '<ul class="visualizer-library-pagination">';
109 + foreach ( $this->pagination as $page ) {
110 + echo '<li class="visualizer-list-item">', $page, '</li>';
111 + }
112 + echo '</ul>';
113 + }
114 + } else {
115 + echo '<div id="visualizer-library" class="visualizer-clearfix">';
116 + echo '<div class="visualizer-chart">';
117 + echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
118 + echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', Visualizer_Plugin::NAME ), '</div>';
119 + echo '</div>';
120 + echo '<div class="visualizer-chart-footer visualizer-clearfix">';
121 + echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
122 + echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
123 + echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
124 +
125 + echo '<span class="visualizer-chart-shortcode">';
126 + echo '&nbsp;[visualizer]&nbsp;';
127 + echo '</span>';
128 + echo '</div>';
129 + echo '</div>';
130 + echo '</div>';
131 + }
132 + }
133 +
134 + /**
135 + * Renders library page.
136 + *
137 + * @since 1.0.0
138 + *
139 + * @access protected
140 + */
141 + protected function _toHTML() {
142 + echo '<div class="wrap">';
143 + echo '<div id="visualizer-icon" class="icon32"><br></div>';
144 + echo '<h2>';
145 + esc_html_e( 'Visualizer Library', Visualizer_Plugin::NAME );
146 + echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', Visualizer_Plugin::NAME ), '</a>';
147 + echo '</h2>';
148 +
149 + $this->_renderMessages();
150 + $this->_renderLibrary();
151 + echo '</div>';
152 + }
153 +
154 + /**
155 + * Renders notification messages if need be.
156 + *
157 + * @since 1.4.2
158 + *
159 + * @access private
160 + */
161 + private function _renderMessages() {
162 + if ( !filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
163 + echo '<div class="updated error">';
164 + echo '<p>';
165 + printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', Visualizer_Plugin::NAME ), '<b>allow_url_fopen</b>' );
166 + echo '</p>';
167 + echo '</div>';
168 + }
169 + }
170 +
171 +}