PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.0.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.0.0
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 +128 -99 1.7.62.0.0 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 // +----------------------------------------------------------------------+
4 3 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5 4 // +----------------------------------------------------------------------+
6 5 // | This program is free software; you can redistribute it and/or modify |
@@ -29,53 +28,41 @@
29 28 */
30 29 class Visualizer_Render_Library extends Visualizer_Render {
31 30
32 31 /**
33 - * Renders chart's box block.
32 + * Renders library page.
34 33 *
35 34 * @since 1.0.0
36 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 + *
37 55 * @access private
38 - * @param string $placeholder_id The placeholder's id for the chart.
39 - * @param int $chart_id The id of the chart.
40 56 */
41 - private function _renderChartBox( $placeholder_id, $chart_id ) {
42 - $ajax_url = admin_url( 'admin-ajax.php' );
43 -
44 - $delete_url = add_query_arg( array(
45 - 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
46 - 'nonce' => wp_create_nonce(),
47 - 'chart' => $chart_id,
48 - ), $ajax_url );
49 -
50 - $clone_url = add_query_arg( array(
51 - 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
52 - 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
53 - 'chart' => $chart_id,
54 - 'type' => $this->type,
55 - ), $ajax_url );
56 -
57 - $export_link = add_query_arg( array(
58 - 'action' => Visualizer_Plugin::ACTION_EXPORT_DATA,
59 - 'chart' => $chart_id,
60 - 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION ),
61 - ), admin_url( 'admin-ajax.php' ) );
62 -
63 - echo '<div class="visualizer-chart">';
64 - echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
65 - echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
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>';
66 63 echo '</div>';
67 - echo '<div class="visualizer-chart-footer visualizer-clearfix">';
68 - echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>';
69 - echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>';
70 - echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>';
71 - echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>';
72 -
73 - echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">';
74 - echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
75 - echo '</span>';
76 - echo '</div>';
77 - echo '</div>';
64 + }
78 65 }
79 66
80 67 /**
81 68 * Renders library content.
@@ -85,29 +72,31 @@
85 72 * @access private
86 73 */
87 74 private function _renderLibrary() {
88 75 // Added by Ash/Upwork
89 - $filterBy = null;
90 - if ( isset( $_GET['filter'] ) && strlen( $_GET['filter'] ) > 0 ) {
91 - $filterBy = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
76 + $filterBy = null;
77 + if ( isset( $_GET['s'] ) && strlen( $_GET['s'] ) > 0 ) {
78 + $filterBy = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
92 79 }
93 - echo '<div id="visualizer-search"><form action="" method="get">
94 - <input type="text" name="filter" value="' . $filterBy . '">
95 - <input type="hidden" name="page" value="visualizer">
96 - <input type="submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
97 - </form></div>';
98 80 // Added by Ash/Upwork
99 81 echo '<div id="visualizer-types" class="visualizer-clearfix">';
100 - echo '<ul>';
82 + echo '<ul class="subsubsub">';
101 83 foreach ( $this->types as $type => $array ) {
102 - $label = $array['name'];
103 - $link = '<a class="page-numbers" href="' . esc_url( add_query_arg( array( 'type' => $type, 'vpage' => false ) ) ) . '">';
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( add_query_arg( array(
90 + 'type' => $type,
91 + 'vpage' => false,
92 + ) ) ) . '">';
104 93 if ( ! $array['enabled'] ) {
105 - $link = "<a class='pro-upsell page-numbers' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
94 + $link = "<a class=' visualizer-pro-only' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
106 95 }
107 - echo '<li class="visualizer-list-item">';
96 + echo '<li class="visualizer-list-item all">';
108 97 if ( $type == $this->type ) {
109 - echo '<a class="page-numbers current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
98 + echo '<a class=" current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
110 99 echo $label;
111 100 echo '</a>';
112 101 } else {
113 102 echo $link;
@@ -113,81 +102,121 @@
113 102 echo $link;
114 103 echo $label;
115 104 echo '</a>';
116 105 }
117 - echo '</li>';
106 + echo ' | </li>';
118 107 }
119 - echo '</ul>';
108 + echo '</ul>';
109 + echo '<form action="" method="get"><p id="visualizer-search" class="search-box">
110 + <input type="search" name="s" value="' . $filterBy . '">
111 + <input type="hidden" name="page" value="visualizer">
112 + <input type="submit" id="search-submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
113 + </p> </form>';
120 114 echo '</div>';
121 -
115 + echo '<div id="visualizer-content-wrapper">';
122 116 if ( ! empty( $this->charts ) ) {
123 117 echo '<div id="visualizer-library" class="visualizer-clearfix">';
124 - foreach ( $this->charts as $placeholder_id => $chart ) {
118 + foreach ( $this->charts as $placeholder_id => $chart ) {
125 119 $this->_renderChartBox( $placeholder_id, $chart['id'] );
126 120 }
127 121 echo '</div>';
128 -
129 122 if ( is_array( $this->pagination ) ) {
130 - echo '<ul class="visualizer-library-pagination">';
123 + echo '<ul class=" subsubsub">';
131 124 foreach ( $this->pagination as $page ) {
132 - echo '<li class="visualizer-list-item">', $page, '</li>';
125 + echo '<li class="all">', $page, '</li>';
133 126 }
134 127 echo '</ul>';
135 128 }
136 129 } else {
137 130 echo '<div id="visualizer-library" class="visualizer-clearfix">';
138 - echo '<div class="visualizer-chart">';
139 - echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
140 - echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
141 - echo '</div>';
142 - echo '<div class="visualizer-chart-footer visualizer-clearfix">';
143 - echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
144 - echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
145 - echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
146 - echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>';
147 -
148 - echo '<span class="visualizer-chart-shortcode">';
149 - echo '&nbsp;[visualizer]&nbsp;';
150 - echo '</span>';
151 - echo '</div>';
152 - echo '</div>';
131 + echo '<div class="visualizer-chart">';
132 + echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
133 + echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
153 134 echo '</div>';
135 + echo '<div class="visualizer-chart-footer visualizer-clearfix">';
136 + echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
137 + echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
138 + echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
139 + echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>';
140 + echo '<span class="visualizer-chart-shortcode">';
141 + echo '&nbsp;[visualizer]&nbsp;';
142 + echo '</span>';
143 + echo '</div>';
144 + echo '</div>';
145 + echo '</div>';
154 146 }
147 + $this->_renderSidebar();
148 + echo '</div>';
155 149 }
156 150
157 151 /**
158 - * Renders library page.
152 + * Renders chart's box block.
159 153 *
160 154 * @since 1.0.0
161 155 *
162 - * @access protected
156 + * @access private
157 + *
158 + * @param string $placeholder_id The placeholder's id for the chart.
159 + * @param int $chart_id The id of the chart.
163 160 */
164 - protected function _toHTML() {
165 - echo '<div class="wrap">';
166 - echo '<div id="visualizer-icon" class="icon32"><br></div>';
167 - echo '<h2>';
168 - esc_html_e( 'Visualizer Library', 'visualizer' );
169 - echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', 'visualizer' ), '</a>';
170 - echo '</h2>';
171 -
172 - $this->_renderMessages();
173 - $this->_renderLibrary();
161 + private function _renderChartBox( $placeholder_id, $chart_id ) {
162 + $ajax_url = admin_url( 'admin-ajax.php' );
163 + $delete_url = add_query_arg( array(
164 + 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
165 + 'nonce' => wp_create_nonce(),
166 + 'chart' => $chart_id,
167 + ), $ajax_url );
168 + $clone_url = add_query_arg( array(
169 + 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
170 + 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
171 + 'chart' => $chart_id,
172 + 'type' => $this->type,
173 + ), $ajax_url );
174 + $export_link = add_query_arg( array(
175 + 'action' => Visualizer_Plugin::ACTION_EXPORT_DATA,
176 + 'chart' => $chart_id,
177 + 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION ),
178 + ), admin_url( 'admin-ajax.php' ) );
179 + echo '<div class="visualizer-chart">';
180 + echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
181 + echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
174 182 echo '</div>';
183 + echo '<div class="visualizer-chart-footer visualizer-clearfix">';
184 + echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>';
185 + echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>';
186 + echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>';
187 + echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>';
188 + echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">';
189 + echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
190 + echo '</span>';
191 + echo '</div>';
192 + echo '</div>';
175 193 }
176 194
177 195 /**
178 - * Renders notification messages if need be.
179 - *
180 - * @since 1.4.2
181 - *
182 - * @access private
196 + * Render sidebar.
183 197 */
184 - private function _renderMessages() {
185 - if ( ! filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
186 - echo '<div class="updated error">';
187 - echo '<p>';
188 - 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>' );
189 - echo '</p>';
198 + private function _renderSidebar() {
199 + if ( ! VISUALIZER_PRO ) {
200 + $checked = apply_filters( 'visualizer_logger_flag', false );
201 + $checked = ( $checked === false ) ? '' : 'checked';
202 + echo '<div id="visualizer-sidebar">';
203 + echo '<div class="visualizer-sidebar-box">';
204 + echo '<h3>' . __( 'Gain more editing power', 'visualizer' ) . '</h3><ul>';
205 + echo '<li>' . __( 'Spreadsheet like editor', 'visualizer' ) . '</li>';
206 + echo '<li>' . __( 'Import from other charts', 'visualizer' ) . '</li>';
207 + echo '<li>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li>';
208 + echo '<li>' . __( '3 more chart types', 'visualizer' ) . '</li></ul>';
209 + echo '<a href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a>';
210 + echo '</div>';
211 + echo '<div class="visualizer-sidebar-box visualizer-tracking">';
212 + echo '<label class="visualizer-switch">';
213 + echo '<input type="checkbox" ' . $checked . ' >';
214 + echo '<div class="visualizer-slider visualizer-round"></div>';
215 + echo '</label>';
216 + echo '<span>' . __( 'Enable Tracking', 'visualizer' ) . '<sup>*</sup></span>';
217 + echo '<p><small><sup>*</sup>' . __( 'Allow Visualizer to anonymously track how this plugin is used and help us make the plugin better. No sensitive data is tracked.', 'visualizer' ) . '</small></p>';
218 + echo '</div>';
190 219 echo '</div>';
191 220 }
192 221 }
193 222