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/Plugin.php +170 -249 3.10.121.5.3 View file →
@@ -1,249 +1,170 @@
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 - * The core plugin class.
23 - *
24 - * @category Visualizer
25 - *
26 - * @since 1.0.0
27 - */
28 -class Visualizer_Plugin {
29 -
30 - const NAME = 'visualizer';
31 - const VERSION = '3.10.12';
32 -
33 - // custom post types
34 - const CPT_VISUALIZER = 'visualizer';
35 -
36 - // custom meta fields
37 - const CF_CHART_IMAGE = 'visualizer-chart-image';
38 - const CF_CHART_TYPE = 'visualizer-chart-type';
39 - const CF_SOURCE = 'visualizer-source';
40 - const CF_SERIES = 'visualizer-series';
41 - const CF_DEFAULT_DATA = 'visualizer-default-data';
42 - const CF_SETTINGS = 'visualizer-settings';
43 - const CF_CHART_LIBRARY = 'visualizer-chart-library';
44 - const CF_ERROR = 'visualizer-error';
45 - const CF_REMOTE_DB_PARAMS = 'visualizer-remote-db-params';
46 -
47 - const CF_SOURCE_FILTER = 'visualizer-source-filter';
48 - const CF_FILTER_CONFIG = 'visualizer-filter-config';
49 - const CF_EDITABLE_TABLE = 'visualizer-editable-table';
50 -
51 - // custom actions
52 - const ACTION_GET_CHARTS = 'visualizer-get-charts';
53 - const ACTION_CREATE_CHART = 'visualizer-create-chart';
54 - const ACTION_EDIT_CHART = 'visualizer-edit-chart';
55 - const ACTION_CLONE_CHART = 'visualizer-clone-chart';
56 - const ACTION_DELETE_CHART = 'visualizer-delete-chart';
57 - const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
58 - const ACTION_EXPORT_DATA = 'visualizer-export-data';
59 -
60 - /**
61 - *Action used for fetching specific users/roles for permissions.
62 - */
63 - const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data';
64 -
65 - /**
66 - *Action used for fetching db import data.
67 - */
68 - const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data';
69 - const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query';
70 -
71 - const ACTION_JSON_GET_ROOTS = 'visualizer-json-get-roots';
72 - const ACTION_JSON_GET_DATA = 'visualizer-json-get-data';
73 - const ACTION_JSON_SET_DATA = 'visualizer-json-set-data';
74 - const ACTION_JSON_SET_SCHEDULE = 'visualizer-json-set-schedule';
75 - const CF_JSON_URL = 'visualizer-json-url';
76 - const CF_JSON_ROOT = 'visualizer-json-root';
77 - const CF_JSON_SCHEDULE = 'visualizer-json-schedule';
78 - const CF_JSON_PAGING = 'visualizer-json-paging';
79 - const CF_JSON_HEADERS = 'visualizer-json-headers';
80 - const CF_EDITOR = 'visualizer-editor';
81 -
82 - const ACTION_SAVE_FILTER_QUERY = 'visualizer-save-filter-query';
83 -
84 - // custom filters
85 - const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
86 - const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
87 - const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
88 - const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';
89 - const FILTER_UNDO_REVISIONS = 'visualizer-undo-revisions';
90 - const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions';
91 - const FILTER_GET_CHART_DATA_AS = 'visualizer-get-chart-data-as';
92 - const FILTER_HANDLE_CACHE_EXPIRATION_TIME = 'visualizer-handle-expiration-time';
93 - const FILTER_CHART_TITLE = 'the_title';
94 -
95 - const CF_DB_SCHEDULE = 'visualizer-db-schedule';
96 - const CF_DB_QUERY = 'visualizer-db-query';
97 -
98 - const CF_CHART_URL = 'visualizer-chart-url';
99 - const CF_CHART_SCHEDULE = 'visualizer-chart-schedule';
100 - // Added by Ash/Upwork
101 - const PRO_TEASER_URL = 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/';
102 - const PRO_TEASER_TITLE = 'Check PRO version ';
103 -
104 - const CF_CHART_CACHE = 'visualizer-chart-cache';
105 - const CF_JSON_WOOCOMMERCE_SOURCE = 'visualizer-woocommerce-source';
106 - const CF_IS_WOOCOMMERCE_SOURCE = 'visualizer-is-woocommerce-source';
107 -
108 - /**
109 - * Name of the option for WordPress DB.
110 - */
111 - const WP_DB_NAME = 'WordPress DB';
112 -
113 - // Added by Ash/Upwork
114 - /**
115 - * Singletone instance of the plugin.
116 - *
117 - * @since 1.0.0
118 - *
119 - * @access private
120 - * @var Visualizer_Plugin
121 - */
122 - private static $_instance = null;
123 -
124 - /**
125 - * The array of registered modules.
126 - *
127 - * @since 1.0.0
128 - *
129 - * @access private
130 - * @var array
131 - */
132 - private $_modules = array();
133 -
134 - /**
135 - * Returns the date queries supported in the library date filter.
136 - */
137 - public static function getSupportedDateFilter() {
138 - return apply_filters( 'visualizer_filter_by_date', array( '' => __( 'All dates', 'visualizer' ), 'yesterday' => __( 'Yesterday', 'visualizer' ), 'last week' => __( 'Last Week', 'visualizer' ), 'last month' => __( 'Last Month', 'visualizer' ), 'last year' => __( 'Last Year', 'visualizer' ) ) );
139 - }
140 -
141 - /**
142 - * Private constructor.
143 - *
144 - * @since 1.0.0
145 - *
146 - * @access private
147 - */
148 - private function __construct() {
149 - if ( VISUALIZER_DEBUG ) {
150 - add_action( 'themeisle_log_event', array( $this, 'themeisle_log_event_debug' ), 10, 5 );
151 - }
152 - }
153 -
154 - /**
155 - * Returns singletone instance of the plugin.
156 - *
157 - * @since 1.0.0
158 - *
159 - * @static
160 - * @access public
161 - * @return Visualizer_Plugin
162 - */
163 - public static function instance() {
164 - if ( is_null( self::$_instance ) ) {
165 - self::$_instance = new Visualizer_Plugin();
166 - }
167 -
168 - return self::$_instance;
169 - }
170 -
171 - /**
172 - * Returns chart types.
173 - *
174 - * @since 1.0.0
175 - *
176 - * @static
177 - * @access public
178 - * @return array
179 - */
180 - public static function getChartTypes() {
181 - $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() );
182 -
183 - return $array;
184 - }
185 -
186 - /**
187 - * Returns a module if it was registered before. Otherwise NULL.
188 - *
189 - * @since 1.0.0
190 - *
191 - * @access public
192 - *
193 - * @param string $name The name of the module to return.
194 - *
195 - * @return Visualizer_Module|null Returns a module if it was registered or NULL.
196 - */
197 - public function getModule( $name ) {
198 - return isset( $this->_modules[ $name ] ) ? $this->_modules[ $name ] : null;
199 - }
200 -
201 - /**
202 - * Determines whether the module has been registered or not.
203 - *
204 - * @since 1.0.0
205 - *
206 - * @access public
207 - *
208 - * @param string $name The name of a module to check.
209 - *
210 - * @return boolean TRUE if the module has been registered. Otherwise FALSE.
211 - */
212 - public function hasModule( $name ) {
213 - return isset( $this->_modules[ $name ] );
214 - }
215 -
216 - /**
217 - * Register new module in the plugin.
218 - *
219 - * @since 1.0.0
220 - *
221 - * @access public
222 - *
223 - * @param string $class The name of the module to use in the plugin.
224 - */
225 - public function setModule( $class ) {
226 - $this->_modules[ $class ] = new $class( $this );
227 - }
228 -
229 - /**
230 - * Private clone method.
231 - *
232 - * @since 1.0.0
233 - *
234 - * @access private
235 - */
236 - private function __clone() {
237 - }
238 -
239 - /**
240 - * For local testing, overrides the 'themeisle_log_event' hook and redirects to error.log.
241 - */
242 - final function themeisle_log_event_debug( $name, $message, $type, $file, $line ) {
243 - if ( Visualizer_Plugin::NAME !== $name ) {
244 - return;
245 - }
246 - error_log( sprintf( '%s (%s): %s in %s:%s', $name, $type, $message, $file, $line ) );
247 - }
248 -
249 -}
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 + * The core plugin class.
25 + *
26 + * @category Visualizer
27 + *
28 + * @since 1.0.0
29 + */
30 +class Visualizer_Plugin {
31 +
32 + const NAME = 'visualizer';
33 + const VERSION = '1.5.2';
34 +
35 + // custom post types
36 + const CPT_VISUALIZER = 'visualizer';
37 +
38 + // custom meta fields
39 + const CF_CHART_TYPE = 'visualizer-chart-type';
40 + const CF_SOURCE = 'visualizer-source';
41 + const CF_SERIES = 'visualizer-series';
42 + const CF_DEFAULT_DATA = 'visualizer-default-data';
43 + const CF_SETTINGS = 'visualizer-settings';
44 +
45 + // custom actions
46 + const ACTION_GET_CHARTS = 'visualizer-get-charts';
47 + const ACTION_CREATE_CHART = 'visualizer-create-chart';
48 + const ACTION_EDIT_CHART = 'visualizer-edit-chart';
49 + const ACTION_CLONE_CHART = 'visualizer-clone-chart';
50 + const ACTION_DELETE_CHART = 'visualizer-delete-chart';
51 + const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
52 +
53 + // custom filters
54 + const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
55 + const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
56 + const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
57 + const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';
58 +
59 + // Added by Ash/Upwork
60 + const PRO_TEASER_URL = "http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/";
61 + const PRO_TEASER_TITLE = "Check PRO version ";
62 + // Added by Ash/Upwork
63 +
64 + /**
65 + * Singletone instance of the plugin.
66 + *
67 + * @since 1.0.0
68 + *
69 + * @access private
70 + * @var Visualizer_Plugin
71 + */
72 + private static $_instance = null;
73 +
74 + /**
75 + * The array of registered modules.
76 + *
77 + * @since 1.0.0
78 + *
79 + * @access private
80 + * @var array
81 + */
82 + private $_modules = array();
83 +
84 + /**
85 + * Private constructor.
86 + *
87 + * @since 1.0.0
88 + *
89 + * @access private
90 + */
91 + private function __construct() {}
92 +
93 + /**
94 + * Private clone method.
95 + *
96 + * @since 1.0.0
97 + *
98 + * @access private
99 + */
100 + private function __clone() {}
101 +
102 + /**
103 + * Returns singletone instance of the plugin.
104 + *
105 + * @since 1.0.0
106 + *
107 + * @static
108 + * @access public
109 + * @return Visualizer_Plugin
110 + */
111 + public static function instance() {
112 + if ( is_null( self::$_instance ) ) {
113 + self::$_instance = new Visualizer_Plugin();
114 + }
115 +
116 + return self::$_instance;
117 + }
118 +
119 + /**
120 + * Returns a module if it was registered before. Otherwise NULL.
121 + *
122 + * @since 1.0.0
123 + *
124 + * @access public
125 + * @param string $name The name of the module to return.
126 + * @return Visualizer_Module|null Returns a module if it was registered or NULL.
127 + */
128 + public function getModule( $name ) {
129 + return isset( $this->_modules[$name] ) ? $this->_modules[$name] : null;
130 + }
131 +
132 + /**
133 + * Determines whether the module has been registered or not.
134 + *
135 + * @since 1.0.0
136 + *
137 + * @access public
138 + * @param string $name The name of a module to check.
139 + * @return boolean TRUE if the module has been registered. Otherwise FALSE.
140 + */
141 + public function hasModule( $name ) {
142 + return isset( $this->_modules[$name] );
143 + }
144 +
145 + /**
146 + * Register new module in the plugin.
147 + *
148 + * @since 1.0.0
149 + *
150 + * @access public
151 + * @param string $module The name of the module to use in the plugin.
152 + */
153 + public function setModule( $class ) {
154 + $this->_modules[$class] = new $class( $this );
155 + }
156 +
157 + /**
158 + * Returns chart types.
159 + *
160 + * @since 1.0.0
161 + *
162 + * @static
163 + * @access public
164 + * @return array
165 + */
166 + public static function getChartTypes() {
167 + return array( 'line', 'area', 'bar', 'column', 'pie', 'geo', 'scatter', 'candlestick', 'gauge' );
168 + }
169 +
170 +}