PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.1.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.1.1
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
visualizer / classes / Visualizer / Plugin.php

Plugin.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.1.1, at classes/Visualizer/Plugin.php

182 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 = '2.1.1';
32
33 // custom post types
34 const CPT_VISUALIZER = 'visualizer';
35
36 // custom meta fields
37 const CF_CHART_TYPE = 'visualizer-chart-type';
38 const CF_SOURCE = 'visualizer-source';
39 const CF_SERIES = 'visualizer-series';
40 const CF_DEFAULT_DATA = 'visualizer-default-data';
41 const CF_SETTINGS = 'visualizer-settings';
42
43 // custom actions
44 const ACTION_GET_CHARTS = 'visualizer-get-charts';
45 const ACTION_TRACK = 'visualizer-track';
46 const ACTION_CREATE_CHART = 'visualizer-create-chart';
47 const ACTION_EDIT_CHART = 'visualizer-edit-chart';
48 const ACTION_CLONE_CHART = 'visualizer-clone-chart';
49 const ACTION_DELETE_CHART = 'visualizer-delete-chart';
50 const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
51 // Added by Ash/Upwork
52 const ACTION_EXPORT_DATA = 'visualizer-export-data';
53
54 // custom filters
55 const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
56 const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
57 const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
58 const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';
59
60 const CF_CHART_URL = 'visualizer-chart-url';
61 const CF_CHART_SCHEDULE = 'visualizer-chart-schedule';
62 // Added by Ash/Upwork
63 const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/';
64 const PRO_TEASER_TITLE = 'Check PRO version ';
65 // Added by Ash/Upwork
66 /**
67 * Singletone instance of the plugin.
68 *
69 * @since 1.0.0
70 *
71 * @access private
72 * @var Visualizer_Plugin
73 */
74 private static $_instance = null;
75
76 /**
77 * The array of registered modules.
78 *
79 * @since 1.0.0
80 *
81 * @access private
82 * @var array
83 */
84 private $_modules = array();
85
86 /**
87 * Private constructor.
88 *
89 * @since 1.0.0
90 *
91 * @access private
92 */
93 private function __construct() {
94 }
95
96 /**
97 * Returns singletone instance of the plugin.
98 *
99 * @since 1.0.0
100 *
101 * @static
102 * @access public
103 * @return Visualizer_Plugin
104 */
105 public static function instance() {
106 if ( is_null( self::$_instance ) ) {
107 self::$_instance = new Visualizer_Plugin();
108 }
109
110 return self::$_instance;
111 }
112
113 /**
114 * Returns chart types.
115 *
116 * @since 1.0.0
117 *
118 * @static
119 * @access public
120 * @return array
121 */
122 public static function getChartTypes() {
123 $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() );
124
125 return $array;
126 }
127
128 /**
129 * Returns a module if it was registered before. Otherwise NULL.
130 *
131 * @since 1.0.0
132 *
133 * @access public
134 *
135 * @param string $name The name of the module to return.
136 *
137 * @return Visualizer_Module|null Returns a module if it was registered or NULL.
138 */
139 public function getModule( $name ) {
140 return isset( $this->_modules[ $name ] ) ? $this->_modules[ $name ] : null;
141 }
142
143 /**
144 * Determines whether the module has been registered or not.
145 *
146 * @since 1.0.0
147 *
148 * @access public
149 *
150 * @param string $name The name of a module to check.
151 *
152 * @return boolean TRUE if the module has been registered. Otherwise FALSE.
153 */
154 public function hasModule( $name ) {
155 return isset( $this->_modules[ $name ] );
156 }
157
158 /**
159 * Register new module in the plugin.
160 *
161 * @since 1.0.0
162 *
163 * @access public
164 *
165 * @param string $class The name of the module to use in the plugin.
166 */
167 public function setModule( $class ) {
168 $this->_modules[ $class ] = new $class( $this );
169 }
170
171 /**
172 * Private clone method.
173 *
174 * @since 1.0.0
175 *
176 * @access private
177 */
178 private function __clone() {
179 }
180
181 }
182