| @@ -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 | |
| @@ -26,59 +27,40 @@ | ||
| 26 | 27 | * @since 1.0.0 |
| 27 | 28 | */ |
| 28 | 29 | class Visualizer_Plugin { |
| 29 | 30 | |
| 30 | - const NAME = 'visualizer'; | |
| 31 | - const VERSION = '3.1.2'; | |
| 31 | + const NAME = 'visualizer'; | |
| 32 | + const VERSION = '1.7.1'; | |
| 32 | 33 | |
| 33 | 34 | // custom post types |
| 34 | 35 | const CPT_VISUALIZER = 'visualizer'; |
| 35 | 36 | |
| 36 | 37 | // custom meta fields |
| 37 | - const CF_CHART_TYPE = 'visualizer-chart-type'; | |
| 38 | - const CF_SOURCE = 'visualizer-source'; | |
| 39 | - const CF_SERIES = 'visualizer-series'; | |
| 38 | + const CF_CHART_TYPE = 'visualizer-chart-type'; | |
| 39 | + const CF_SOURCE = 'visualizer-source'; | |
| 40 | + const CF_SERIES = 'visualizer-series'; | |
| 40 | 41 | const CF_DEFAULT_DATA = 'visualizer-default-data'; |
| 41 | - const CF_SETTINGS = 'visualizer-settings'; | |
| 42 | + const CF_SETTINGS = 'visualizer-settings'; | |
| 42 | 43 | |
| 43 | - const CF_SOURCE_FILTER = 'visualizer-source-filter'; | |
| 44 | - | |
| 45 | 44 | // custom actions |
| 46 | - const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 45 | + const ACTION_GET_CHARTS = 'visualizer-get-charts'; | |
| 47 | 46 | const ACTION_CREATE_CHART = 'visualizer-create-chart'; |
| 48 | - const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 49 | - const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 47 | + const ACTION_EDIT_CHART = 'visualizer-edit-chart'; | |
| 48 | + const ACTION_CLONE_CHART = 'visualizer-clone-chart'; | |
| 50 | 49 | const ACTION_DELETE_CHART = 'visualizer-delete-chart'; |
| 51 | - const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 52 | - const ACTION_EXPORT_DATA = 'visualizer-export-data'; | |
| 50 | + const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; | |
| 51 | + // Added by Ash/Upwork | |
| 52 | + const ACTION_EXPORT_DATA = 'visualizer-export-data'; | |
| 53 | 53 | |
| 54 | - /** | |
| 55 | - *Action used for fetching specific users/roles for permissions. | |
| 56 | - */ | |
| 57 | - const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data'; | |
| 58 | - | |
| 59 | - /** | |
| 60 | - *Action used for fetching db import data. | |
| 61 | - */ | |
| 62 | - const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data'; | |
| 63 | - const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query'; | |
| 64 | - | |
| 65 | 54 | // custom filters |
| 66 | 55 | const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; |
| 67 | - const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; | |
| 68 | - const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; | |
| 69 | - const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; | |
| 70 | - const FILTER_UNDO_REVISIONS = 'visualizer-undo-revisions'; | |
| 71 | - const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions'; | |
| 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'; | |
| 72 | 59 | |
| 73 | - const CF_DB_SCHEDULE = 'visualizer-db-schedule'; | |
| 74 | - const CF_DB_QUERY = 'visualizer-db-query'; | |
| 75 | - | |
| 76 | - const CF_CHART_URL = 'visualizer-chart-url'; | |
| 77 | - const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; | |
| 78 | 60 | // Added by Ash/Upwork |
| 79 | - const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 80 | - const PRO_TEASER_TITLE = 'Check PRO version '; | |
| 61 | + const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/'; | |
| 62 | + const PRO_TEASER_TITLE = 'Check PRO version '; | |
| 81 | 63 | // Added by Ash/Upwork |
| 82 | 64 | /** |
| 83 | 65 | * Singletone instance of the plugin. |
| 84 | 66 | * |
| @@ -105,15 +87,20 @@ | ||
| 105 | 87 | * @since 1.0.0 |
| 106 | 88 | * |
| 107 | 89 | * @access private |
| 108 | 90 | */ |
| 109 | - private function __construct() { | |
| 110 | - if ( VISUALIZER_DEBUG ) { | |
| 111 | - add_action( 'themeisle_log_event', array( $this, 'themeisle_log_event_debug' ), 10, 5 ); | |
| 112 | - } | |
| 113 | - } | |
| 91 | + private function __construct() {} | |
| 114 | 92 | |
| 115 | 93 | /** |
| 94 | + * Private clone method. | |
| 95 | + * | |
| 96 | + * @since 1.0.0 | |
| 97 | + * | |
| 98 | + * @access private | |
| 99 | + */ | |
| 100 | + private function __clone() {} | |
| 101 | + | |
| 102 | + /** | |
| 116 | 103 | * Returns singletone instance of the plugin. |
| 117 | 104 | * |
| 118 | 105 | * @since 1.0.0 |
| 119 | 106 | * |
| @@ -129,31 +116,14 @@ | ||
| 129 | 116 | return self::$_instance; |
| 130 | 117 | } |
| 131 | 118 | |
| 132 | 119 | /** |
| 133 | - * Returns chart types. | |
| 134 | - * | |
| 135 | - * @since 1.0.0 | |
| 136 | - * | |
| 137 | - * @static | |
| 138 | - * @access public | |
| 139 | - * @return array | |
| 140 | - */ | |
| 141 | - public static function getChartTypes() { | |
| 142 | - $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() ); | |
| 143 | - | |
| 144 | - return $array; | |
| 145 | - } | |
| 146 | - | |
| 147 | - /** | |
| 148 | 120 | * Returns a module if it was registered before. Otherwise NULL. |
| 149 | 121 | * |
| 150 | 122 | * @since 1.0.0 |
| 151 | 123 | * |
| 152 | 124 | * @access public |
| 153 | - * | |
| 154 | 125 | * @param string $name The name of the module to return. |
| 155 | - * | |
| 156 | 126 | * @return Visualizer_Module|null Returns a module if it was registered or NULL. |
| 157 | 127 | */ |
| 158 | 128 | public function getModule( $name ) { |
| 159 | 129 | return isset( $this->_modules[ $name ] ) ? $this->_modules[ $name ] : null; |
| @@ -164,11 +134,9 @@ | ||
| 164 | 134 | * |
| 165 | 135 | * @since 1.0.0 |
| 166 | 136 | * |
| 167 | 137 | * @access public |
| 168 | - * | |
| 169 | 138 | * @param string $name The name of a module to check. |
| 170 | - * | |
| 171 | 139 | * @return boolean TRUE if the module has been registered. Otherwise FALSE. |
| 172 | 140 | */ |
| 173 | 141 | public function hasModule( $name ) { |
| 174 | 142 | return isset( $this->_modules[ $name ] ); |
| @@ -179,9 +147,8 @@ | ||
| 179 | 147 | * |
| 180 | 148 | * @since 1.0.0 |
| 181 | 149 | * |
| 182 | 150 | * @access public |
| 183 | - * | |
| 184 | 151 | * @param string $class The name of the module to use in the plugin. |
| 185 | 152 | */ |
| 186 | 153 | public function setModule( $class ) { |
| 187 | 154 | $this->_modules[ $class ] = new $class( $this ); |
| @@ -187,24 +154,19 @@ | ||
| 187 | 154 | $this->_modules[ $class ] = new $class( $this ); |
| 188 | 155 | } |
| 189 | 156 | |
| 190 | 157 | /** |
| 191 | - * Private clone method. | |
| 158 | + * Returns chart types. | |
| 192 | 159 | * |
| 193 | 160 | * @since 1.0.0 |
| 194 | 161 | * |
| 195 | - * @access private | |
| 162 | + * @static | |
| 163 | + * @access public | |
| 164 | + * @return array | |
| 196 | 165 | */ |
| 197 | - private function __clone() { | |
| 198 | - } | |
| 199 | - | |
| 200 | - /** | |
| 201 | - * For local testing, overrides the 'themeisle_log_event' hook and redirects to error.log. | |
| 202 | - */ | |
| 203 | - final function themeisle_log_event_debug( $name, $message, $type, $file, $line ) { | |
| 204 | - if ( Visualizer_Plugin::NAME !== $name ) { | |
| 205 | - return; | |
| 206 | - } | |
| 207 | - error_log( sprintf( '%s (%s): %s in %s:%s', $name, $type, $message, $file, $line ) ); | |
| 166 | + public static function getChartTypes() { | |
| 167 | + $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() ); | |
| 168 | + unset( $array[0] ); // all | |
| 169 | + return $array; | |
| 208 | 170 | } |
| 209 | 171 | |
| 210 | 172 | } |