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