| @@ -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,50 +28,34 @@ | ||
| 26 | 28 | * @since 1.0.0 |
| 27 | 29 | */ |
| 28 | 30 | class Visualizer_Plugin { |
| 29 | 31 | |
| 30 | - const NAME = 'visualizer'; | |
| 31 | - const VERSION = '3.0.6'; | |
| 32 | + const NAME = 'visualizer'; | |
| 33 | + const VERSION = '1.4.2.2'; | |
| 32 | 34 | |
| 33 | 35 | // custom post types |
| 34 | 36 | const CPT_VISUALIZER = 'visualizer'; |
| 35 | 37 | |
| 36 | 38 | // custom meta fields |
| 37 | - const CF_CHART_TYPE = 'visualizer-chart-type'; | |
| 38 | - const CF_SOURCE = 'visualizer-source'; | |
| 39 | - 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'; | |
| 40 | 42 | const CF_DEFAULT_DATA = 'visualizer-default-data'; |
| 41 | - const CF_SETTINGS = 'visualizer-settings'; | |
| 43 | + const CF_SETTINGS = 'visualizer-settings'; | |
| 42 | 44 | |
| 43 | - const CF_SOURCE_FILTER = 'visualizer-source-filter'; | |
| 44 | - | |
| 45 | 45 | // custom actions |
| 46 | - const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 46 | + const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 47 | 47 | const ACTION_CREATE_CHART = 'visualizer-create-chart'; |
| 48 | - const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 49 | - const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 48 | + const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 49 | + const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 50 | 50 | const ACTION_DELETE_CHART = 'visualizer-delete-chart'; |
| 51 | - const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 52 | - // Added by Ash/Upwork | |
| 53 | - const ACTION_EXPORT_DATA = 'visualizer-export-data'; | |
| 51 | + const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 54 | 52 | |
| 55 | - /** | |
| 56 | - *Action used for fetching specific users/roles for permissions. | |
| 57 | - */ | |
| 58 | - const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data'; | |
| 59 | - | |
| 60 | 53 | // custom filters |
| 61 | 54 | const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; |
| 62 | - const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; | |
| 63 | - const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; | |
| 64 | - const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; | |
| 55 | + const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; | |
| 56 | + const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; | |
| 65 | 57 | |
| 66 | - const CF_CHART_URL = 'visualizer-chart-url'; | |
| 67 | - const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; | |
| 68 | - // Added by Ash/Upwork | |
| 69 | - const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 70 | - const PRO_TEASER_TITLE = 'Check PRO version '; | |
| 71 | - // Added by Ash/Upwork | |
| 72 | 58 | /** |
| 73 | 59 | * Singletone instance of the plugin. |
| 74 | 60 | * |
| 75 | 61 | * @since 1.0.0 |
| @@ -95,12 +81,20 @@ | ||
| 95 | 81 | * @since 1.0.0 |
| 96 | 82 | * |
| 97 | 83 | * @access private |
| 98 | 84 | */ |
| 99 | - private function __construct() { | |
| 100 | - } | |
| 85 | + private function __construct() {} | |
| 101 | 86 | |
| 102 | 87 | /** |
| 88 | + * Private clone method. | |
| 89 | + * | |
| 90 | + * @since 1.0.0 | |
| 91 | + * | |
| 92 | + * @access private | |
| 93 | + */ | |
| 94 | + private function __clone() {} | |
| 95 | + | |
| 96 | + /** | |
| 103 | 97 | * Returns singletone instance of the plugin. |
| 104 | 98 | * |
| 105 | 99 | * @since 1.0.0 |
| 106 | 100 | * |
| @@ -116,35 +110,18 @@ | ||
| 116 | 110 | return self::$_instance; |
| 117 | 111 | } |
| 118 | 112 | |
| 119 | 113 | /** |
| 120 | - * Returns chart types. | |
| 121 | - * | |
| 122 | - * @since 1.0.0 | |
| 123 | - * | |
| 124 | - * @static | |
| 125 | - * @access public | |
| 126 | - * @return array | |
| 127 | - */ | |
| 128 | - public static function getChartTypes() { | |
| 129 | - $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() ); | |
| 130 | - | |
| 131 | - return $array; | |
| 132 | - } | |
| 133 | - | |
| 134 | - /** | |
| 135 | 114 | * Returns a module if it was registered before. Otherwise NULL. |
| 136 | 115 | * |
| 137 | 116 | * @since 1.0.0 |
| 138 | 117 | * |
| 139 | 118 | * @access public |
| 140 | - * | |
| 141 | 119 | * @param string $name The name of the module to return. |
| 142 | - * | |
| 143 | 120 | * @return Visualizer_Module|null Returns a module if it was registered or NULL. |
| 144 | 121 | */ |
| 145 | 122 | public function getModule( $name ) { |
| 146 | - return isset( $this->_modules[ $name ] ) ? $this->_modules[ $name ] : null; | |
| 123 | + return isset( $this->_modules[$name] ) ? $this->_modules[$name] : null; | |
| 147 | 124 | } |
| 148 | 125 | |
| 149 | 126 | /** |
| 150 | 127 | * Determines whether the module has been registered or not. |
| @@ -151,15 +128,13 @@ | ||
| 151 | 128 | * |
| 152 | 129 | * @since 1.0.0 |
| 153 | 130 | * |
| 154 | 131 | * @access public |
| 155 | - * | |
| 156 | 132 | * @param string $name The name of a module to check. |
| 157 | - * | |
| 158 | 133 | * @return boolean TRUE if the module has been registered. Otherwise FALSE. |
| 159 | 134 | */ |
| 160 | 135 | public function hasModule( $name ) { |
| 161 | - return isset( $this->_modules[ $name ] ); | |
| 136 | + return isset( $this->_modules[$name] ); | |
| 162 | 137 | } |
| 163 | 138 | |
| 164 | 139 | /** |
| 165 | 140 | * Register new module in the plugin. |
| @@ -166,22 +141,24 @@ | ||
| 166 | 141 | * |
| 167 | 142 | * @since 1.0.0 |
| 168 | 143 | * |
| 169 | 144 | * @access public |
| 170 | - * | |
| 171 | - * @param string $class The name of the module to use in the plugin. | |
| 145 | + * @param string $module The name of the module to use in the plugin. | |
| 172 | 146 | */ |
| 173 | 147 | public function setModule( $class ) { |
| 174 | - $this->_modules[ $class ] = new $class( $this ); | |
| 148 | + $this->_modules[$class] = new $class( $this ); | |
| 175 | 149 | } |
| 176 | 150 | |
| 177 | 151 | /** |
| 178 | - * Private clone method. | |
| 152 | + * Returns chart types. | |
| 179 | 153 | * |
| 180 | 154 | * @since 1.0.0 |
| 181 | 155 | * |
| 182 | - * @access private | |
| 156 | + * @static | |
| 157 | + * @access public | |
| 158 | + * @return array | |
| 183 | 159 | */ |
| 184 | - private function __clone() { | |
| 160 | + public static function getChartTypes() { | |
| 161 | + return array( 'line', 'area', 'bar', 'column', 'pie', 'geo', 'scatter', 'candlestick', 'gauge' ); | |
| 185 | 162 | } |
| 186 | 163 | |
| 187 | -} | |
| 164 | +} | |